You could do it like this.
- Revive Timer
- Events
- Unit - A unit Dies
- Conditions
- ((Dying unit) is A Hero) Equal to True
- ((Owner of (Dying unit)) slot status) Equal to Is playing
- Actions
- Set Hero[(Player number of (Owner of (Dying unit)))] = (Dying unit)
- Countdown Timer - Start Timer[(Player number of (Owner of (Dying unit)))] as a One-shot timer that will expire in 10.00 seconds
- Countdown Timer - Create a timer window for (Last started timer) with title Reviving in...
- Set Timer_Window[(Player number of (Owner of (Dying unit)))] = (Last created timer window)
- Revive
- Events
- Time - Timer[1] expires
- Time - Timer[2] expires
- Conditions
- Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Remaining time for Timer[1]) Less than or equal to 0.00
- Then - Actions
- Hero - Instantly revive Hero[1] at (Center of (Playable map area)), Hide revival graphics
- Countdown Timer - Destroy Timer_Window[1]
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Remaining time for Timer[2]) Less than or equal to 0.00
- Then - Actions
- Hero - Instantly revive Hero[2] at (Center of (Playable map area)), Hide revival graphics
- Countdown Timer - Destroy Timer_Window[2]
- Else - Actions
http://www.hiveworkshop.com/forums/world-editor-help-zone-98/timers-230384/index2.html - another way that uses a hashtable.
You may want to check the whole thread in the above link as it is devoted to the same topic.
You need 2 triggers:You can also just do something like this:
Hey,
use Wietlol's solution, only this one is right.
You need 2 triggers:
- Hero dies
- Events
- Unit - A unit Dies
- Conditions
- And - All (Conditions) are true
- Conditions
- ((Dying unit) is A Hero) Equal to True
- (Owner of (Dying unit)) Not equal to Player 11 (Dark Green)
- (Owner of (Dying unit)) Not equal to Player 12 (Brown)
- Actions
- Set HeroRespawnHero[(Player number of (Owner of (Dying unit)))] = (Dying unit)
- Set HeroRespawnTime[(Player number of (Owner of (Dying unit)))] = (15 + (Hero level of (Dying unit)))
- Countdown Timer - Start HeroRespawnTimer[(Player number of (Owner of (Dying unit)))] as a One-shot timer that will expire in (Real(HeroRespawnTime[(Player number of (Owner of (Dying unit)))])) seconds
- Countdown Timer - Change the title of (Last created timer window) to Respawn Time
- 1st hide window for all players, then:
- Countdown Timer - Show (Last created timer window) for (Owner of (Dying unit))
and 2nd:
- Hero Respawn
- Events
- Time - HeroRespawnTimer[1] expires
- Time - HeroRespawnTimer[2] expires
- Time - HeroRespawnTimer[3] expires
- Time - HeroRespawnTimer[4] expires
- Time - HeroRespawnTimer[5] expires
- Time - HeroRespawnTimer[6] expires
- Time - HeroRespawnTimer[7] expires
- Time - HeroRespawnTimer[8] expires
- Time - HeroRespawnTimer[9] expires
- Time - HeroRespawnTimer[10] expires
- Conditions
- Actions
- For each (Integer TempInteger) from 1 to 10, do (Actions)
- Loop - Actions
- Custom script: if (GetExpiredTimer() == udg_HeroRespawnTimer[udg_TempInteger]) then
- Countdown Timer - Destroy HeroRespawnTimerWindow[(Player number of (Triggering player))]
- Hero - Instantly revive HeroRespawnHero[(Player number of (Triggering player))] at (Center of HeroSpawn Exit <gen>), Show revival graphics
- Camera - Pan camera for (Triggering player) to (Position of (Reviving Hero)) over 0.00 seconds
- Game - Display to (All players) the text: (Hero of + ((Name of (Player(Integer))) + has respawned.))
- Custom script: endif
be sure you have TempInteger variable (integer type no array)
be sure you have HeroRespawnTimer in variable list set to array 10
zibi
Dont remove the problem Sirade278 in the first post... other may have the same...
Hey,
use Wietlol's solution, only this one is right.
You need 2 triggers:
- Hero dies
- Events
- Unit - A unit Dies
- Conditions
- And - All (Conditions) are true
- Conditions
- ((Dying unit) is A Hero) Equal to True
- (Owner of (Dying unit)) Not equal to Player 11 (Dark Green)
- (Owner of (Dying unit)) Not equal to Player 12 (Brown)
- Actions
- Set HeroRespawnHero[(Player number of (Owner of (Dying unit)))] = (Dying unit)
- Set HeroRespawnTime[(Player number of (Owner of (Dying unit)))] = (15 + (Hero level of (Dying unit)))
- Countdown Timer - Start HeroRespawnTimer[(Player number of (Owner of (Dying unit)))] as a One-shot timer that will expire in (Real(HeroRespawnTime[(Player number of (Owner of (Dying unit)))])) seconds
- Countdown Timer - Change the title of (Last created timer window) to Respawn Time
- 1st hide window for all players, then:
- Countdown Timer - Show (Last created timer window) for (Owner of (Dying unit))
and 2nd:
- Hero Respawn
- Events
- Time - HeroRespawnTimer[1] expires
- Time - HeroRespawnTimer[2] expires
- Time - HeroRespawnTimer[3] expires
- Time - HeroRespawnTimer[4] expires
- Time - HeroRespawnTimer[5] expires
- Time - HeroRespawnTimer[6] expires
- Time - HeroRespawnTimer[7] expires
- Time - HeroRespawnTimer[8] expires
- Time - HeroRespawnTimer[9] expires
- Time - HeroRespawnTimer[10] expires
- Conditions
- Actions
- For each (Integer TempInteger) from 1 to 10, do (Actions)
- Loop - Actions
- Custom script: if (GetExpiredTimer() == udg_HeroRespawnTimer[udg_TempInteger]) then
- Countdown Timer - Destroy HeroRespawnTimerWindow[(Player number of (Triggering player))]
- Hero - Instantly revive HeroRespawnHero[(Player number of (Triggering player))] at (Center of HeroSpawn Exit <gen>), Show revival graphics
- Camera - Pan camera for (Triggering player) to (Position of (Reviving Hero)) over 0.00 seconds
- Game - Display to (All players) the text: (Hero of + ((Name of (Player(Integer))) + has respawned.))
- Custom script: endif
be sure you have TempInteger variable (integer type no array)
be sure you have HeroRespawnTimer in variable list set to array 10
zibi