Members | Sign In
All Forums > Mission Scripting
avatar

Timers

posted Aug 31, 2012 16:20:13 by coreyk6767
Does setting a timer actually start the timer? Or do you have to do that separately?

I have a condition that once we dock with a station a timer action starts and after 10 seconds an attack action happens on another station.

The attack never happens.
page   1
3 replies
avatar
GregKurlinski said Sep 01, 2012 03:03:45
It is a two step process.
first:
<event >
<if_docked name="DS1" />
<if_variable name="docked" comparator="EQUALS" value="0.0" />
<set_timer name="SneakAttack" seconds="10" />
<set_variable name="docked" value="1.0" />
</event>

Second:
<event >
<if_timer_finished name="SneakAttack" />
<if_variable name="SneakAttackHappened" comparator="EQUALS" value="0.0" />
<create ... the enemy ships... />
<set_variable name="SneakAttackHappened" value="1.0" />
</event>


note: you need the docked and SneakAttackHappened variables to prevent the enemy ships from being created infinitely.

[Last edited Sep 01, 2012 03:50:43]
avatar
RobMuller said Sep 02, 2012 10:35:10
I had this problem once. What Greg is doing here is how I fixed it.

You see, every single event that you want to fire ONCE, has to have a variable previously set (like in the start event) and then listed in teh conditions (that the variable is still set the same) and then at the very END of your actions change that variable to something else. Otherwise it continues to fire that event over and over and over again (thereby resetting your timer to 10 seconds over and over and over again).

Hope the explanation is helpful.
avatar
coreyk6767 said Sep 04, 2012 18:56:17
Thanks Guys !
Login below to reply: