HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Destorying Timers

04-07-2007, 01:25 AM#1
Hsinker
My current Hero Revival trigger creates the timer but when the hero revives and the timer expires, the timer display remains.
04-07-2007, 01:57 AM#2
Earth-Fury
You have to destroy the timer window when the timer expires. Also, you may need to hide it before destroying it.

also, right-click: copy as text, paste into [trigger][/trigger] tags.
04-07-2007, 02:09 AM#3
Hsinker
Could you give an example of an action to do this?
04-07-2007, 02:22 AM#4
Earth-Fury
Trigger:
Untitled Trigger 002
Collapse Events
Time - my_timer expires
Conditions
Collapse Actions
Countdown Timer - Hide (Last created timer window)
Countdown Timer - Destroy (Last created timer window)
04-07-2007, 02:31 AM#5
Hsinker
This trigger applies to 10 different units, therefore 10 timers could be present at any given time, would that trigger still work? would would it need to be integrated into my original trigger somehow like a If action?
04-07-2007, 03:17 AM#6
Earth-Fury
If you have u pto 10 timers active, make a global timer array, a global timer window array, start timer_array[player_id_of_dying_hero], make a timer window, store the last crated timer window in the same index, make a trigger for each timer index, and destroy the related window.
04-07-2007, 03:25 AM#7
Hsinker
Blah im still noob at this, could you write a trigger that in cooperates my original trigger please?
04-07-2007, 03:31 AM#8
Earth-Fury
The part of your trigger you posted is the first part of that i said to do =)
Now, just add actions after you start the timer to create a timer window, then set a global timer dialog variable array to last crated timer dialog, with the same index as the timer you started. (index = the number between [ and ] for an array variable)

Then, destroy the corresponding timer dialog when the timer expires.
04-07-2007, 03:40 AM#9
Hsinker
T_T im lost

Heres my trigger as text not image:
Trigger:
Collapse Events
Unit - A unit Dies
Collapse Conditions
((Dying unit) is A Hero) Equal to True
Collapse Actions
Unit Group - Add (Dying unit) to RevivableHeroes
Set TempReal = (((Real((Hero level of (Dying unit)))) x Hero_Revive_Time_Factor) + 5.00)
Countdown Timer - Start ReviveTimers[(Player number of (Owner of (Dying unit)))] as a One-shot timer that will expire in TempReal seconds
Countdown Timer - Create a timer window for (Last started timer) with title (Name of (Owner of (Dying unit)))
04-07-2007, 03:52 AM#10
Earth-Fury
Post the timer expiration trigger too? Without that, i can't really just post a trigger.
04-07-2007, 03:56 AM#11
Hsinker
Is it this one?

Trigger:
Revive Hero Timer
Collapse Events
Time - ReviveTimers[2] expires
Time - ReviveTimers[3] expires
Time - ReviveTimers[4] expires
Time - ReviveTimers[5] expires
Time - ReviveTimers[6] expires
Time - ReviveTimers[8] expires
Time - ReviveTimers[9] expires
Time - ReviveTimers[7] expires
Time - ReviveTimers[11] expires
Time - ReviveTimers[12] expires
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in RevivableHeroes and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Remaining time for ReviveTimers[(Player number of (Owner of (Picked unit)))]) Less than 1.00
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Owner of (Picked unit)) is in TeamIce) Equal to True
Collapse Then - Actions
Hero - Instantly revive (Picked unit) at (Center of ice revive <gen>), Show revival graphics
Collapse Else - Actions
Hero - Instantly revive (Picked unit) at (Center of fire revive <gen>), Show revival graphics
Else - Actions
04-07-2007, 04:03 AM#12
Zwan
Well, you'll want to create a variable array for your timer windows to keep track of them. My suggestion is to make a timer window array, set to the size of players for the map. Then you can run a trigger with a unit revives event and destroy the windows.

Here is an old revive code from one of my maps if you use it as an example. It only shows the timer windows themselves to the owner of the hero. But displays a message upon death to all players the time until they will revive.

It really is a matter of taste and depends on your map, but since I am running a multi board, it becomes cluttered to have a revive window for every dead player.


Trigger:
Hero Revive
Collapse Events
Unit - A unit owned by Player 2 (Blue) Dies
Unit - A unit owned by Player 3 (Teal) Dies
Unit - A unit owned by Player 4 (Purple) Dies
Unit - A unit owned by Player 5 (Yellow) Dies
Unit - A unit owned by Player 6 (Orange) Dies
Unit - A unit owned by Player 7 (Green) Dies
Unit - A unit owned by Player 8 (Pink) Dies
Unit - A unit owned by Player 9 (Gray) Dies
Unit - A unit owned by Player 10 (Light Blue) Dies
Unit - A unit owned by Player 11 (Dark Green) Dies
Collapse Conditions
((Dying unit) is A Hero) Equal to True
Collapse Actions
Trigger - Run Champion Dies <gen> (checking conditions)
Trigger - Run MB Update Kills and Death <gen> (checking conditions)
Countdown Timer - Start DeathTimer[(Player number of (Owner of (Dying unit)))] as a One-shot timer that will expire in (15.00 + (5.00 x (Real((Integer((Real((Hero level of (Dying unit)))))))))) seconds
Countdown Timer - Create a timer window for DeathTimer[(Player number of (Owner of (Dying unit)))] with title (Name of (Owner of (Dying unit)))
Countdown Timer - Change the color of the title for (Last created timer window) to (40.00%, 40.00%, 96.00%) with 0.00% transparency
Countdown Timer - Change the color of the time for (Last created timer window) to (50.00%, 100.00%, 33.00%) with 0.00% transparency
Set DeathTimerWindow[(Player number of (Owner of (Dying unit)))] = (Last created timer window)
Game - Display to (All players) for 4.00 seconds the text: (|c00008040|r + (((Name of (Dying unit)) + ( will revive in + )) + ((String((15 + (5 x (Integer((Real((Hero level of (Dying unit)))))))))) + seconds)))
Wait (15.00 + ((5.00 x (Real((Integer((Real((Hero level of (Dying unit))))))))) + 0.00)) seconds
Hero - Instantly revive (Dying unit) at ((Owner of (Dying unit)) start location), Show revival graphics
Camera - Pan camera for (Owner of (Dying unit)) to ((Owner of (Dying unit)) start location) over 0.00 seconds
04-07-2007, 04:11 AM#13
Hsinker
Zwan, with some adjustments to it, that trigger can be used inplace of both of my triggers and do the job i want?
04-07-2007, 04:22 AM#14
Zwan
Yea. And add this to remove your windows when the hero actually revives.

Trigger:
Begin Revive
Collapse Events
Unit - A unit Begins reviving
Conditions
Collapse Actions
Countdown Timer - Destroy DeathTimerWindow[(Player number of (Owner of (Reviving Hero)))]

These two triggers will revive all your heroes, create the timer windows for players and remove them when the hero revives. You just need a Timer array and a timer window array. These are set to 10 since there are 10 players in the map.
04-07-2007, 05:03 AM#15
Hsinker
Woot it works nicely!