im trying to destroy a timer that i created, what is happenig is that it counts down, then creates another timer just below it, then that too counts down, Then it creates another timer below it and so on .
How to Destroy a timer when it counts down to 0 seconds?
this is the trigger i have so far
Timer - Create a timer window for (Triggering timer), with the title "Hero Revive In", using Remaining time (initially Visible)
Timer - Set (Last created timer window) Time color to (85%, 54%, 7%) with 5.0% transparency
Timer - Start (Triggering timer) as a One Shot timer that will expire in 5.0 Real Time seconds
Timer - Set timer for (Last created timer window) to (Triggering timer)
Timer - Show (Last created timer window) for (All players)
General - Wait for (Last started timer) to have 0.0 seconds Remaining
Events
Timer - Elapsed time is 3.0 Real Time seconds
Local Variables
last c timer = No Timer Window <Timer Window>
Conditions
Actions
Timer - Create a timer window for (Triggering timer), with the title "Hero Revive In", using Remaining time (initially Visible)
Variable - Set last c timer = (Last created timer window)
Timer - Set last c timer Time color to (85%, 54%, 7%) with 5.0% transparency
Timer - Start (Triggering timer) as a One Shot timer that will expire in 5.0 Real Time seconds
Timer - Set timer for last c timer to (Triggering timer)
Timer - Show last c timer for (All players)
General - Wait for (Last started timer) to have 0.0 seconds Remaining
Timer - Destroy last c timer
Ignore the "all players part" i just trying too see if i can get the timer to be destroyed, then i will be using "create timer for owner of triggering unit" ..
How to destroy this timer when it reaches 0? all it does is countdown, then create another timer just below, then another after 5 second, then another.. Are timers buged?
What I find more useful is that instead of destroying the timer, you should just restart the expired timer.
Consider the following case:
Each player has their own SC2 copy locally to their computer.
Each player can only control 1 hero at a time.
Therefore, only one timer is needed for hero revival.
When a timer is expired, it stops counting and will be caught by other trigger given that tis even is: When youTimeVariableName expired.
When your player's hero die again, you can simply restart the same timer used.
To do it:
Simply create a global variable call it heroRevivalTimer
During game setup, create a timer (new timer) and assign it to your variable.
Then to use it, simply make it start, and then restart when ever you need it.
I am not sure, but maybe the timer is not properly destroyed because the "garbage" is not collected yet. I remember Galaxy Editor has a garbage collection function, try to see if that helps by calling garbage collection after you try to destroy your timer. I still say restarting the timer is the best as it save both space, and memory allocation time :)
im trying to destroy a timer that i created, what is happenig is that it counts down, then creates another timer just below it, then that too counts down, Then it creates another timer below it and so on .
How to Destroy a timer when it counts down to 0 seconds?
this is the trigger i have so far
Timer - Create a timer window for (Triggering timer), with the title "Hero Revive In", using Remaining time (initially Visible)
Timer - Set (Last created timer window) Time color to (85%, 54%, 7%) with 5.0% transparency
Timer - Start (Triggering timer) as a One Shot timer that will expire in 5.0 Real Time seconds
Timer - Set timer for (Last created timer window) to (Triggering timer)
Timer - Show (Last created timer window) for (All players) General - Wait for (Last started timer) to have 0.0 seconds Remaining
Timer - Destroy (Last created timer window)
Don't refer to the timer as "last created timer". Set it to a global variable immediately and use that instead.
@Berrala: Go
crap it still refuses to work properly :(
------------------------Events Timer - Elapsed time is 3.0 Real Time seconds
Local Variables last c timer = No Timer Window <Timer Window>
Conditions
Actions
Timer - Create a timer window for (Triggering timer), with the title "Hero Revive In", using Remaining time (initially Visible)
Variable - Set last c timer = (Last created timer window)
Timer - Set last c timer Time color to (85%, 54%, 7%) with 5.0% transparency
Timer - Start (Triggering timer) as a One Shot timer that will expire in 5.0 Real Time seconds
Timer - Set timer for last c timer to (Triggering timer)
Timer - Show last c timer for (All players)
General - Wait for (Last started timer) to have 0.0 seconds Remaining
Timer - Destroy last c timer
Ignore the "all players part" i just trying too see if i can get the timer to be destroyed, then i will be using "create timer for owner of triggering unit" ..
How to destroy this timer when it reaches 0? all it does is countdown, then create another timer just below, then another after 5 second, then another.. Are timers buged?
@Jinxxx123: Go
What I find more useful is that instead of destroying the timer, you should just restart the expired timer.
Consider the following case:
Each player has their own SC2 copy locally to their computer. Each player can only control 1 hero at a time. Therefore, only one timer is needed for hero revival. When a timer is expired, it stops counting and will be caught by other trigger given that tis even is: When youTimeVariableName expired. When your player's hero die again, you can simply restart the same timer used.
To do it:
Simply create a global variable call it heroRevivalTimer During game setup, create a timer (new timer) and assign it to your variable. Then to use it, simply make it start, and then restart when ever you need it.
I am not sure, but maybe the timer is not properly destroyed because the "garbage" is not collected yet. I remember Galaxy Editor has a garbage collection function, try to see if that helps by calling garbage collection after you try to destroy your timer. I still say restarting the timer is the best as it save both space, and memory allocation time :)
I haven't been using timers much, but destroying the timer would still leave the window, right? Try hiding the timer window.