scarycave Posted July 25, 2012 Share Posted July 25, 2012 (edited) 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 July 25, 2012 by scarycave Link to comment Share on other sites More sharing options...
DrakeTheDragon Posted July 25, 2012 Share Posted July 25, 2012 (edited) 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 July 25, 2012 by DrakeTheDragon Link to comment Share on other sites More sharing options...
scarycave Posted July 29, 2012 Author Share Posted July 29, 2012 (edited) Making it greater than 5 seems to have fixed the problem. Thanks. :) Edited July 29, 2012 by scarycave Link to comment Share on other sites More sharing options...
Recommended Posts