Realy Need some help with this Script

Post » Sat Mar 20, 2010 1:08 am

I realy Need help Makeing the player stay Knocked out for 10 seconds.

if (Player.getAV ActionPoints < 1);Player has low ap Get chance of Knock out			set PSKO to getrandompercent;Set percent	;set PSKO to 1;is 2	if (PSKOD == 0)		if (PSKO >= 75); 15 percent chance to KO			set PSKODTimer to (PSKODTimer + GetSecondsPassed);set timer			TriggerHitShader 3			set PSKOD to 1;Make player stay koed		endif	endifelseif (Player.getAV ActionPoints >= 2); Player recovers ap			if (PSKODTimer >= 10);10 seconds pass while player knocked outt		;PlaySound ?;Play alert sound				set PSKODTimer to 0;reset 				set PSKO to 0;reset				set PSKOD to 0;reset				player.restoreAV fatigue 201;reset Fatigue				Player.restoreAV Actionpoints 100;heal apendifendifif (PSKOD == 1)player.damageav fatigue 201endif

User avatar
Jade Muggeridge
 
Posts: 3439
Joined: Mon Nov 20, 2006 6:51 pm

Post » Fri Mar 19, 2010 2:01 pm

You should really specify what's going wrong; what its doing, etc...

From what I can tell, your GetSecondsPassed is only running once, because PSKOD is set to 1, and the timer update needs that variable set to 0 to run. So PSKODTimer never reaches >= 10, so it can't trigger the rest of the script.
User avatar
Jessie Rae Brouillette
 
Posts: 3469
Joined: Mon Dec 11, 2006 9:50 am

Post » Fri Mar 19, 2010 4:25 pm

If you want to knock out the player for 10 seconds, do more fatigue damage. IIRC the player will recover 1 fatigue point every second. Once the value reaches zero, the game automatically restores all of it back to 200. So, a 10 second knock out could be accomplished simply by doing 210 damage to fatigue. No additional scripting nescessary. It works the same with other actors, but for some reason all other actors only have 50 fatigue, so doing 60 fatigue to them will also knock them out for 10 seconds.
User avatar
Lily Evans
 
Posts: 3401
Joined: Thu Aug 31, 2006 11:10 am

Post » Fri Mar 19, 2010 11:28 pm

If you want to knock out the player for 10 seconds, do more fatigue damage. IIRC the player will recover 1 fatigue point every second. Once the value reaches zero, the game automatically restores all of it back to 200. So, a 10 second knock out could be accomplished simply by doing 210 damage to fatigue. No additional scripting nescessary. It works the same with other actors, but for some reason all other actors only have 50 fatigue, so doing 60 fatigue to them will also knock them out for 10 seconds.

Awesome!

I did not know this, one for the books. :read:

Thanks! :)
User avatar
Red Sauce
 
Posts: 3431
Joined: Fri Aug 04, 2006 1:35 pm

Post » Fri Mar 19, 2010 5:59 pm

So, a 10 second knock out could be accomplished simply by doing 210 damage to fatigue. No additional scripting nescessary. It works the same with other actors, but for some reason all other actors only have 50 fatigue, so doing 60 fatigue to them will also knock them out for 10 seconds.

So that's a +200 modified fatigue value, damaged past 0 to -10 (KO'ed), then recovers +1 per second until 0 is reached.. am I understanding that right?
That's a great simple solution for optimal conditions. I'm wondering though.. so what happens when fatigue isn't at 200 and/or the damage modifier isn't at 0 when you do this? I'm guessing you won't get 10 seconds till zero, and could be WAY off depending on the starting modified value, or if any other scripts/mods/items are affecting that stat at the time the OP's knockout effect is enabled. I'm thinking like recent hand-to-hand damage, SetAV, or all the different modifiers that can be affected by ModAV from script or console.

Hopefully this will adjust (over compensate) for that, if by chance and luck I might be right about the starting point thing.

Float CurrFatValFloat RetFatVal** other stuff **if (Player.getAV ActionPoints < 1) && (PSKOD == 0);**low AP and not KO'ed  set PSKODTimer to 0;**reset timer  set PSKO to GetRandomPercent;**get percent  if (PSKO >= 85);**15 percent chance to KO	TriggerHitShader 3	set CurrFatVal to player.GetAV fatigue;**modified fatigue value	player.damageav fatigue 1000;**decrease damage modifier	set PSKOD to 1;**trigger KO  endifendifif (PSKOD == 1);**state KO'ed  if (PSKODTimer < 10);**10 second check	set PSKODTimer to (PSKODTimer + GetSecondsPassed);**increment timer  else	set RetFatVal to ((1000 - PSKODTimer) - CurrFatVal);**calculate distance to zero	set PSKODTimer to 0;**reset timer	set PSKOD to 2;**trigger recovery after 10 secs  endifendifif (PSKOD == 2);**state Recovery  player.restoreAV Actionpoints 100;**heal ap  player.restoreAV fatigue RetFatVal;**reset damage mult right to 0  set PSKO to 0;**reset percent  set PSKOD to 0;**reset for chance to KO again when low apendif

User avatar
Joey Bel
 
Posts: 3487
Joined: Sun Jan 07, 2007 9:44 am

Post » Sat Mar 20, 2010 12:26 am

Could a magic effect be used? They have a timer function built-in.
User avatar
Mashystar
 
Posts: 3460
Joined: Mon Jul 16, 2007 6:35 am

Post » Sat Mar 20, 2010 1:38 am

So that's a +200 modified fatigue value, damaged past 0 to -10 (KO'ed), then recovers +1 per second until 0 is reached.. am I understanding that right?
That's a great simple solution for optimal conditions. I'm wondering though.. so what happens when fatigue isn't at 200 and/or the damage modifier isn't at 0 when you do this?


The thing is, the game does not allow for any positive value of fatigue under 200 (50 for all other actors). This means as soon as the player recovers from negative fatigue, his fatigue immedaitely jumps to 200. So there is never any any worry about the player having anything but a 200 fatigue, if he is up and moving about. I spent a bit of time checking this out a while back for a scripted scene I made for my mod. Try it yourself. Using the console, damage the player's fatigue by 50 points then check his fatigue, it will still be 200. Damage it by 199 and check it, it will still be 200. You may have to wait a frame between the damaging and checking, but it recovers all instantly. Then damage it by 210. Watch him fall to the ground and get back up in 10 seconds, check his fatigue then, its 200.
User avatar
Kelly Upshall
 
Posts: 3475
Joined: Sat Oct 28, 2006 6:26 pm

Post » Fri Mar 19, 2010 12:46 pm

The thing is, the game does not allow for any positive value of fatigue under 200 (50 for all other actors). This means as soon as the player recovers from negative fatigue, his fatigue immedaitely jumps to 200. So there is never any any worry about the player having anything but a 200 fatigue, if he is up and moving about. I spent a bit of time checking this out a while back for a scripted scene I made for my mod. Try it yourself. Using the console, damage the player's fatigue by 50 points then check his fatigue, it will still be 200. Damage it by 199 and check it, it will still be 200. You may have to wait a frame between the damaging and checking, but it recovers all instantly. Then damage it by 210. Watch him fall to the ground and get back up in 10 seconds, check his fatigue then, its 200.

Effectively that's how it works yes, but it's not the fatigue stat itself that can't be positive and less than 200, it's the damage modifier that can't change the stat unless it's more than the base amount. Fatigue.. the stat itself can be anything depending on how it's modified. The base geck number is added to the derived stat, which is made up of all the applicable modifier amounts, and that becomes the usable base number. However, my point was that the said "200" value it jumps to is not a fixed constant. It's only 200 (the geck value) if its derived stat is untouched and default. All it takes is a script from someones mod to call player.modav fatigue XXX (for any reason) and now that derived stat (fatigue in this case) doesn't jump to 200, it jumps to 200 plus whatever XXX was. Additionally, it stays that way (until a modav -XXX is called from a script) because the script modifier has been altered and can ONLY be changed back by a script (the game cannot do it). So if XXX was 100, 300 is now what it jumps to if/when the damage modifier is not in effect (preserved base amount + different modifier value). At 300, damaging fatigue 210 for a 10 second knockout will have no effect at all. If that script originally called a modav fatigue -XXX instead, and XXX is the same 100, it will jump to 100 instead of 200.. which then makes damaging fatigue 210 equal 110 seconds of wait time. See what I mean? The base editor value, damage modifier, script modifier, game modifier, and magic modifier (that all of 'em?) all affect whether or not 200 is the number you start with. Even careless console use can throw that off, I've done it *holds hand up*, and learned the hard way. One can still reliably use the "counting down of negative numbers" as a sort of timer like you say, but I would be sure to include a 'variable = player.GetAV fatigue + 10', then damage the variable amount. That way, if the starting stat isn't what it should be for whatever reason, you'll still hit your target number and get good results.
User avatar
brandon frier
 
Posts: 3422
Joined: Wed Oct 17, 2007 8:47 pm

Post » Fri Mar 19, 2010 6:39 pm

Duely noted: 'variable = player.GetAV fatigue + 10' is a more fool proof way. Who are those bloody fools anyway? Since fatigue is a rather pointless stat unless used to knock out the player, I can't see why anyone would want to modify it for a valid reason. But it definitely could happen.
User avatar
Charlie Sarson
 
Posts: 3445
Joined: Thu May 17, 2007 12:38 pm


Return to Fallout 3