demonocus666 Posted October 11, 2012 Share Posted October 11, 2012 scriptname AAAko2min float s begin scripteffectstartif (s > 1)forceav fatigue -1000 endif if ( s > 120 )forceav fatigue 1000set s to s + getsecondspassed endif end i'm trying to get it to last for 2min and then have the npc recover and get up Link to comment Share on other sites More sharing options...
Hickory Posted October 11, 2012 Share Posted October 11, 2012 Off the top of my head (so untested), try this: ScriptName AAAko2min Float s Begin ScriptEffectStart ForceAV Fatigue -1000 End Begin ScriptEffectFinish If ( s > 120 ) ForceAV Fatigue 1000 EndIf End Begin GameMode If s > 120 Return Else Set s to s + GetSecondsPassed EndIf End Link to comment Share on other sites More sharing options...
demonocus666 Posted October 11, 2012 Author Share Posted October 11, 2012 it never worked npc never gets up gave you kudoes for trying Link to comment Share on other sites More sharing options...
Hickory Posted October 11, 2012 Share Posted October 11, 2012 Ok, maybe the ScriptEffectFinish is the problem. Try it this way: ScriptName AAAko2min Float s Begin ScriptEffectStart Set s To 0 ForceAV Fatigue -1000 End Begin GameMode If s < 120 Set s to s + GetSecondsPassed Else ForceAV Fatigue 1000 EndIf End Link to comment Share on other sites More sharing options...
demonocus666 Posted October 11, 2012 Author Share Posted October 11, 2012 that did not work either same thing guy never gets up thanks again for trying Link to comment Share on other sites More sharing options...
Hickory Posted October 11, 2012 Share Posted October 11, 2012 That's odd. Does he get up if you use the forceav command on him (select him first) from the console? Link to comment Share on other sites More sharing options...
d0cipx Posted October 11, 2012 Share Posted October 11, 2012 I'm not sure what scripting language this is but I would think you would do something like I have below.I'm not even using the variable or function get_time, I just wanted to include it to show how it would look in c++It would look similar in perl it would just be called a sub instead. */int get_time(){// function to get time from game }/* int main(){// float time = get_time();float fatigue = -1000;float fatigue_inc = 8.3;float new_fatigue;int i = 1; for (i>0, i<120, i++){new_fatigue=+fatigue_inc;} return 0; Link to comment Share on other sites More sharing options...
DrakeTheDragon Posted October 12, 2012 Share Posted October 12, 2012 The trouble is ScriptEffectStart only runs 1 time, when the spell is casted. It never executes again.ScriptEffectFinish only runs once the spell ran out and again only does this once.When ScriptEffectFinish executes is determined by the spell's "duration" and cannot be controlled from inside by a counter or something like you do. I suggest you use the duration of the spell itself instead of a seconds counter inside the script. Make the spell last 120 seconds and ScriptEffectFinish will execute exactly 120 seconds after ScriptEffectStart. You can use ScriptEffectStart to lower the fatigue and then ScriptEffectFinish to raise it up again. If your spell's duration was never set to 120 seconds but less, none of Hickory's solutions ever had even a chance to work, as they all depended on 120 seconds to be passed for the fatigue reset to get executed. In the first one "s" was never > 120 when ScriptEffectFinish executed, and in the second the script terminated (the spell's duration ran out) before "s" got > 120. I don't even know if you can use GetSecondsPassed inside a spell script. I remember inside a ScriptEffect... block it's said to not work at all. And if this was not the script for a spell even but an Object or Quest script, then using ScriptEffect... blocks was futile to begin with. Link to comment Share on other sites More sharing options...
demonocus666 Posted October 12, 2012 Author Share Posted October 12, 2012 The trouble is ScriptEffectStart only runs 1 time, when the spell is casted. It never executes again.ScriptEffectFinish only runs once the spell ran out and again only does this once.When ScriptEffectFinish executes is determined by the spell's "duration" and cannot be controlled from inside by a counter or something like you do. I suggest you use the duration of the spell itself instead of a seconds counter inside the script. Make the spell last 120 seconds and ScriptEffectFinish will execute exactly 120 seconds after ScriptEffectStart. You can use ScriptEffectStart to lower the fatigue and then ScriptEffectFinish to raise it up again. If your spell's duration was never set to 120 seconds but less, none of Hickory's solutions ever had even a chance to work, as they all depended on 120 seconds to be passed for the fatigue reset to get executed. In the first one "s" was never > 120 when ScriptEffectFinish executed, and in the second the script terminated (the spell's duration ran out) before "s" got > 120. I don't even know if you can use GetSecondsPassed inside a spell script. I remember inside a ScriptEffect... block it's said to not work at all. And if this was not the script for a spell even but an Object or Quest script, then using ScriptEffect... blocks was futile to begin with.your suggestion worked kudos to you heres what i did;scriptname AAAko2min begin scripteffectstartforceav fatigue -1000 end begin scripteffectfinishforceav fatigue 1000 end then i set the spell duration to 120 and it worked Link to comment Share on other sites More sharing options...
Recommended Posts