Jump to content

ScriptEffectElapsedSeconds never seems to work.


scarycave

Recommended Posts

I can never seem to get it to work...

I'm using an ability to check time, time is updated during the ScriptEffectUpdateBlock.

After what is supposed to be five seconds, the test subject is supposed to die. However, this never occurs.

Here's a sample code:

 

Begin ScriptEffectUpdate

 

Set Time to Time + ScriptEffectElapsedSeconds

 

If Time == 5

 

Kill

 

Endif

 

End

 

If I use the console command to set time to 5, nothing happens.

Any ideas why this isn't working?

Edited by scarycave
Link to comment
Share on other sites

First of all, "Time" will almost "never" be exactly "5.000000" seconds. Using a comparison like "Time >= 5" will yield far better results, as it'll also fire when time passed 5.0 seconds already.

 

Second, I found out the hard way myself that abilities are unreliable about their triggering of the "ScriptEffectXXX" blocks. It could be your ability is triggering the "ScriptEffectUpdate" block only once and never again, or not at all to begin with. Abilities are a little troublesome in this regard.

 

You can, however, also use a "GameMode" block in a spell script and it should still work. I don't know how regularly a "GameMode" block is triggered by a spell, or an ability, but it was far more reliable in my tests. On an object script it's like once per frame, so pretty often, for a spell script it could be a little less, but not necessarily so.

 

If you set "Time" to "5" through console, the next time this block gets executed, whenever this is, if at all even, another fracture of seconds gets added onto "Time" first before the evaluation is taking place. Thus it never was "5" during the check even by then.

 

For the sake of science you could just go ahead and add a 'Message "Time: %.2f" Time' line to the top of your block, right after "set Time to Time + ...", so you will see in what intervals, if at all, this block gets executed, or not.

Edited by DrakeTheDragon
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...