I was looking for a Stop Timer function, similar to Start Timer, and found none. The problem is as follows:
My weather engine spawns a one shot timer when it's set to storm. This timer basically does nothing except play a sound, and then spawn itself again as a one-shot timer with a random delay.
The engine however can be set to a different mode within this timer. Currently I added the condition that the weather engine's state must be storm for the timer to execute its actions.
What will happen though when the weather is set back to storm (and thus Start Timer is called again) when the previous timer hasn't run out again? Is this safe behaviour? Or will it spawn a new timer that overwrites the last one, causing unpredictable behaviour?
When the engine is set to storm:
Timer - Start <Weather Engine> Timer as a One Shot timer that will expire in 0.0 Game Time seconds
I don't know if this helps you, but I personally don't use Blizzard's timer for reasons like this.
What I do is make a simple dialog and dialog item label, and set the label to decrease in time each second. If I want to pause the timer, I'll just have something disable the trigger that subtracts time. Additionally, you can make your timer look prettier if you choose.
I'm kinda confused about what you're exactly trying to do and I apologize if you've already looked into it but have you tried the "pause timer" trigger ? If so, wouldn't a trigger like this work ?
(In the main trigger:) Run <Weather Engine> Storm Trigger
then
<Weather Engine> Storm
Events
***Blank****
Local Variables
theStorm = <none>
Conditions
Actions
Sound - Play BlastedLandsLightningbolt01Stand-Bolt for (All players) (at 100.0% volume, skip the first 0.0 seconds)
Create actor "GIANT STORM"
set variable theStorm = last created actor
wait 120seconds realtime
Destroy theStorm
==============================
and possibly even easier: Solution B (if it's possible to create a unit with a weather actor), make a unit with a timelife behavior
something like Unit -> unit's behavior -> "stormtimed life"
and in the behavior tab set that behavior's duration to "120seconds" and the effect when it expires to "Kill (generic)"
(you can check the mule for an example of timelife)
Actually I just use this timer to play the thunder sound periodically.
What does Start Timer do to a paused timer? Does it resume it? What is a timer anyway? Is it some kind of integer that is kept into an array that the engine checks?
Are you suggesting I call start timer when my weather engine initializes and then use pause and unpause behaviour for it?
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I was looking for a Stop Timer function, similar to Start Timer, and found none. The problem is as follows:
My weather engine spawns a one shot timer when it's set to storm. This timer basically does nothing except play a sound, and then spawn itself again as a one-shot timer with a random delay.
The engine however can be set to a different mode within this timer. Currently I added the condition that the weather engine's state must be storm for the timer to execute its actions.
What will happen though when the weather is set back to storm (and thus Start Timer is called again) when the previous timer hasn't run out again? Is this safe behaviour? Or will it spawn a new timer that overwrites the last one, causing unpredictable behaviour?
When the engine is set to storm: Timer - Start <Weather Engine> Timer as a One Shot timer that will expire in 0.0 Game Time seconds
The relevant code:
I don't know if this helps you, but I personally don't use Blizzard's timer for reasons like this.
What I do is make a simple dialog and dialog item label, and set the label to decrease in time each second. If I want to pause the timer, I'll just have something disable the trigger that subtracts time. Additionally, you can make your timer look prettier if you choose.
Use "Pause/Unpause timer" to stop it.
I'm kinda confused about what you're exactly trying to do and I apologize if you've already looked into it but have you tried the "pause timer" trigger ? If so, wouldn't a trigger like this work ?
(In the main trigger:) Run <Weather Engine> Storm Trigger
then
<Weather Engine> Storm
Events
***Blank****
Local Variables
theStorm = <none>
Conditions
Actions
Sound - Play BlastedLandsLightningbolt01Stand-Bolt for (All players) (at 100.0% volume, skip the first 0.0 seconds)
Create actor "GIANT STORM"
set variable theStorm = last created actor
wait 120seconds realtime
Destroy theStorm
==============================
and possibly even easier: Solution B (if it's possible to create a unit with a weather actor), make a unit with a timelife behavior
something like Unit -> unit's behavior -> "stormtimed life"
and in the behavior tab set that behavior's duration to "120seconds" and the effect when it expires to "Kill (generic)"
(you can check the mule for an example of timelife)
Hopefully that helps and if it doesnt sorry :3
Good luck mate!
@Koronis: Go
Actually I just use this timer to play the thunder sound periodically.
What does Start Timer do to a paused timer? Does it resume it? What is a timer anyway? Is it some kind of integer that is kept into an array that the engine checks?
Are you suggesting I call start timer when my weather engine initializes and then use pause and unpause behaviour for it?