• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Trigger] Hero Respawn

Status
Not open for further replies.
Level 5
Joined
Apr 29, 2015
Messages
143
Oh well, will have a look on that after school.

So what should I use instead of triggering player?
 
Level 10
Joined
Apr 4, 2010
Messages
509
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
 
Level 5
Joined
Apr 29, 2015
Messages
143
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

Thanks, will try it at home. :)

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.

Thanks but I prefer ordinary way, and I appreciate that though.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Im afraid DEE-BOO's way doesnt work because if you start the timer for player 2 and the timer for player 1 has never started, both will be 0 when timer 2 expires.

You need timer comparison.
You can do this using custom scripts checking if "if (GetExpiredTimer() == udg_Timer[1]) then"
It is not really nice because of GUI but it is the only way I can think of at the moment.
 
Level 13
Joined
Jun 20, 2014
Messages
479
Will post help shortly.

Edit: i dig through my old triggers this might help you.


  • Initialization
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set ReviveSystem_Hashtable = (Last created hashtable)
      • Set Select_Players = (All players)
  • Player Group - Pick every player in Select_Players and do (Actions)
    • Loop - Actions
      • Set Select_Player = (Picked player)
      • Set Select_Number = (Player number of Select_Player)
      • Leaderboard - Create a leaderboard for (Player group((Player(Select_Number)))) titled Your hero has fa...
      • Set ReviveSystem_Board[Select_Number] = (Last created leaderboard)
      • Leaderboard - Add Select_Player to ReviveSystem_Board[Select_Number] with label You will respawn in... and value 0
      • Leaderboard - Hide ReviveSystem_Board[Select_Number]
  • Revive Becomes Revivable
    • Events
      • Unit - A unit Becomes revivable
    • Conditions
    • Actions
      • -------- Death --------
      • Set ReviveSystem_RevivingHero = (Triggering unit)
      • Set ReviveSystem_Player = (Triggering player)
      • Set ReviveSystem_PlayerNumber = (Player number of ReviveSystem_Player)
      • Set ReviveSystem_Duration = ((Real((Level of ReviveSystem_RevivingHero))) x 2.00)
      • Unit Group - Add ReviveSystem_RevivingHero to ReviveSystem_RevivingGroup
      • Hashtable - Save ReviveSystem_Duration as 1 of (Key (Triggering unit)) in ReviveSystem_Hashtable
      • Hashtable - Save ReviveSystem_PlayerNumber as 2 of (Key (Triggering unit)) in ReviveSystem_Hashtable
      • Leaderboard - Show ReviveSystem_Board[ReviveSystem_PlayerNumber]
      • Leaderboard - Change the value for ReviveSystem_Player in ReviveSystem_Board[ReviveSystem_PlayerNumber] to (Integer(ReviveSystem_Duration))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in ReviveSystem_RevivingGroup) Equal to 1
        • Then - Actions
          • Trigger - Turn on Revive Revivable Hero <gen>
        • Else - Actions
  • Revive Revivable Hero
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in ReviveSystem_RevivingGroup and do (Actions)
        • Loop - Actions
          • Set ReviveSystem_PickedUnit = (Picked unit)
          • Set ReviveSystem_Duration = (Load 1 of (Key (Picked unit)) from ReviveSystem_Hashtable)
          • Set ReviveSystem_PlayerNumber = (Load 2 of (Key (Picked unit)) from ReviveSystem_Hashtable)
          • Set ReviveSystem_Duration = (ReviveSystem_Duration - 0.03)
          • Set ReviveSystem_Player = (Owner of ReviveSystem_PickedUnit)
          • Leaderboard - Change the value for ReviveSystem_Player in ReviveSystem_Board[ReviveSystem_PlayerNumber] to (Integer(ReviveSystem_Duration))
          • Hashtable - Save ReviveSystem_Duration as 1 of (Key (Picked unit)) in ReviveSystem_Hashtable
          • Hashtable - Save ReviveSystem_PlayerNumber as 2 of (Key (Picked unit)) in ReviveSystem_Hashtable
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ReviveSystem_Duration Less than or equal to 0.00
            • Then - Actions
              • Set ReviveSystem_RevivePoint = (Center of Your Location <gen>)
              • Leaderboard - Hide ReviveSystem_Board[ReviveSystem_PlayerNumber]
              • Hero - Instantly revive ReviveSystem_PickedUnit at ReviveSystem_RevivePoint, Show revival graphics
              • Camera - Pan camera for ReviveSystem_Player to ReviveSystem_RevivePoint over 0.00 seconds
              • Custom script: call RemoveLocation(udg_ReviveSystem_RevivePoint)
              • Selection - Clear selection for ReviveSystem_Player
              • Selection - Select ReviveSystem_PickedUnit for ReviveSystem_Player
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in ReviveSystem_Hashtable
              • Unit Group - Remove ReviveSystem_PickedUnit from ReviveSystem_RevivingGroup
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in ReviveSystem_RevivingGroup) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions


you can remove the camera lines.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
You can also just do something like this:
  • Hero Respawn
    • Events
      • Time - HeroRespawnTimer[0] expires
      • Time - HeroRespawnTimer[1] expires
      • Time - HeroRespawnTimer[2] expires
      • Time - HeroRespawnTimer[3] expires
    • Conditions
    • Actions
      • Set TempTimer[0] = (Expiring timer)
      • For each (Integer Integer) from 1 to 10, do (Actions)
        • Loop - Actions
          • Custom script: if udg_TempTimer[0] == udg_HeroRespawnTimer[udg_Integer-1] then
          • Game - Display to (All players) the text: (Hero of + ((Name of (Player(Integer))) + has respawned.))
          • Custom script: endif
 
Level 5
Joined
Apr 29, 2015
Messages
143
  • Hero Respawn
    • 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
      • Countdown Timer - Show (Last created timer window) for (Owner of (Dying unit))
      • Game - Display to (Player group((Owner of (Dying unit)))) the text: |cff7777aaYour hero...
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Remaining time for HeroRespawnTimer[(Player number of (Owner of (Dying unit)))]) Equal to 0.00
        • Then - Actions
          • Hero - Instantly revive HeroRespawnHero[(Player number of (Owner of (Dying unit)))] at (Center of Hero Spawn <gen>), Show revival graphics
          • Camera - Pan camera for (Triggering player) to (Center of Hero Spawn <gen>) over 0.00 seconds
          • Game - Display to (Player group((Owner of (Dying unit)))) the text: |cff7777aaYour hero...
        • Else - Actions
          • Countdown Timer - Destroy HeroRespawnTimerWindow[(Player number of (Owner of (Dying unit)))]
Ok, just redone it, will this work without any leaks?
 
Last edited:
Hey,
use Wietlol's solution, only this one is right.
You can also just do something like this:
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
 
Level 5
Joined
Apr 29, 2015
Messages
143
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

Thanks :) , too bad that it's about time to sleep now, no time to try that. =l
 
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

I've tried timer comparisons before and they were crashing the game. But maybe that only happened because I sometimes called GetExpiredTimer from outside an expire event.
 
Status
Not open for further replies.
Top