• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Hero Revive trigger not working properly

Status
Not open for further replies.
Level 2
Joined
Jul 28, 2009
Messages
24
I am working on an auto hero-revive system and it doesn't seem to be working out properly.

The hero revive works perfectly fine for Player 1, but it seems to cause a build up of timers with no actual digits in the timer, when a player other than Player 1 dies. Other players that die also don't get their heroes back.

I also want to isolate it so that the computers (Players 11 and 12) don't get their heroes back. I'd like some suggestions on how to change my triggers to make it do that.

Here are the triggers I am using to revive heroes in my map:

  • Revive Hero
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
    • Actions
      • Unit Group - Add (Dying unit) to RevivableHeroes
      • Set TempReal = (((Real((Hero level of (Dying unit)))) x 3.00) + 5.00)
      • Countdown Timer - Start ReviveTimers[(Player number of (Owner of (Dying unit)))] as a One-shot timer that will expire in TempReal seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • Countdown Timer - Create a timer window for (Last started timer) with title (Name of (Owner of (Dying unit)))
          • Countdown Timer - Show (Last created timer window) for (Owner of (Dying unit))
          • Set RevivableTimersWindows[(Player number of (Owner of (Dying unit)))] = (Last created timer window)
        • Else - Actions
And

  • Revive Hero Timer
    • Events
      • Time - ReviveTimers[1] expires
      • Time - ReviveTimers[2] expires
      • Time - ReviveTimers[3] expires
      • Time - ReviveTimers[4] expires
      • Time - ReviveTimers[5] expires
      • Time - ReviveTimers[6] expires
      • Time - ReviveTimers[7] expires
      • Time - ReviveTimers[8] expires
      • Time - ReviveTimers[9] expires
      • Time - ReviveTimers[10] expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in RevivableHeroes and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for ReviveTimers[(Player number of (Owner of (Picked unit)))]) Less than 1.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Owner of (Picked unit)) is in PlayersResistance) Equal to True
                • Then - Actions
                  • Countdown Timer - Destroy (Last created timer window)
                  • Hero - Instantly revive (Picked unit) at (Center of Hero Revive <gen>), Show revival graphics
                  • Camera - Pan camera for (Owner of (Picked unit)) to (Center of Hero Revive <gen>) over 0.00 seconds
                • Else - Actions
            • Else - Actions

Here are the Variables I am using:


ReviveTimers : timer
Array:1
New Timer (Default)


Revivable Heroes : Unit Group
Empty Unit Group (Default)


PlayersResistance : Player Group
Empty Player Group (Default)


TempReal : Real
0 (Default)


RevivableTimersWindows : Timer Window
Array:1
None


Please help me and thank you in advance.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
There's no IF condition in the first trigger.

You're not removing heroes from the unit group after they've been revived.

Change "Countdown Timer - Destroy (Last created timer window)" to "Countdown Timer - Destroy RevivableTimersWindows[(Player number of (Owner of (Picked unit)))]"

Use:
TempLoc = (Center of Hero Revive <gen>)
Hero - Instantly revive (Picked unit) at (TempLoc), Show revival graphics
call RemoveLocation(udg_TempLoc)

What is PlayersResistance? Are you sure the player whos heroes you're trying to revive is in that group?
 
Level 2
Joined
Jul 28, 2009
Messages
24
There's no IF condition in the first trigger.

You're not removing heroes from the unit group after they've been revived.

Change "Countdown Timer - Destroy (Last created timer window)" to "Countdown Timer - Destroy RevivableTimersWindows[(Player number of (Owner of (Picked unit)))]"

Use:
TempLoc = (Center of Hero Revive <gen>)
Hero - Instantly revive (Picked unit) at (TempLoc), Show revival graphics
call RemoveLocation(udg_TempLoc)

What is PlayersResistance? Are you sure the player whos heroes you're trying to revive is in that group?

After editing the triggers the way you recommended, it stopped working for even Player 1. (Meaning no revives were working at all. Timer stayed there this time as well, not disappearing)

This is how I set it up [Tell me if I messed it up]:
  • Revive Hero Timer
    • Events
      • Time - ReviveTimers[1] expires
      • Time - ReviveTimers[2] expires
      • Time - ReviveTimers[3] expires
      • Time - ReviveTimers[4] expires
      • Time - ReviveTimers[5] expires
      • Time - ReviveTimers[6] expires
      • Time - ReviveTimers[7] expires
      • Time - ReviveTimers[8] expires
      • Time - ReviveTimers[9] expires
      • Time - ReviveTimers[10] expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in RevivableHeroes and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for ReviveTimers[(Player number of (Owner of (Picked unit)))]) Less than 1.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Owner of (Picked unit)) is in PlayersResistance) Equal to True
                • Then - Actions
                  • Set HeroRess = (Center of Hero Revive <gen>)
                  • Hero - Instantly revive (Picked unit) at HeroRess, Show revival graphics
                  • Camera - Pan camera for (Owner of (Picked unit)) to (Center of Hero Revive <gen>) over 0.00 seconds
                  • Countdown Timer - Destroy RevivableTimersWindows[(Player number of (Owner of (Picked unit)))]
                  • Custom script: call RemoveLocation(udg_HeroRess)
                • Else - Actions
            • Else - Actions

Also, this is what PlayersResistance is.... I'm not too sure of it myself, but if you can help me make the proper changes, I'd appreciate that.
Edit: I think this new trigger looks more accurate as to what it should be.

  • Players
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Add Player 1 (Red) to PlayersResistance
      • Player Group - Add Player 2 (Blue) to PlayersResistance
      • Player Group - Add Player 3 (Teal) to PlayersResistance
      • Player Group - Add Player 4 (Purple) to PlayersResistance
      • Player Group - Add Player 5 (Yellow) to PlayersResistance
      • Player Group - Add Player 6 (Orange) to PlayersResistance
      • Player Group - Add Player 7 (Green) to PlayersResistance
      • Player Group - Add Player 8 (Pink) to PlayersResistance
      • Player Group - Add Player 9 (Gray) to PlayersResistance
      • Player Group - Add Player 10 (Light Blue) to PlayersResistance
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
I used these:

  • Joo
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Owner of (Triggering unit)) Not equal to Player 11 (Dark Green)
      • (Owner of (Triggering unit)) Not equal to Player 12 (Brown)
    • Actions
      • Unit Group - Add (Triggering unit) to HeroesGroup
      • Set HeroTimer = (((Real((Hero level of (Dying unit)))) x 3.00) + 5.00)
      • Countdown Timer - Start Timers[(Player number of (Owner of (Dying unit)))] as a One-shot timer that will expire in HeroTimer seconds
      • Countdown Timer - Create a timer window for (Last started timer) with title (Name of (Owner of (Dying unit)))
      • Countdown Timer - Show (Last created timer window) for (Owner of (Dying unit))
      • Set RevivableTimersWindows[(Player number of (Owner of (Dying unit)))] = (Last created timer window)
  • Juu
    • Events
      • Time - Timers[1] expires
      • Time - Timers[2] expires
      • Time - Timers[3] expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HeroesGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for Timers[(Player number of (Owner of (Picked unit)))]) Equal to 0.00
            • Then - Actions
              • Countdown Timer - Destroy RevivableTimersWindows[(Player number of (Owner of (Picked unit)))]
              • Set TempLoc = (Center of Rect 010 <gen>)
              • Hero - Instantly revive (Picked unit) at TempLoc, Hide revival graphics
              • Custom script: call RemoveLocation(udg_TempLoc)
              • Unit Group - Remove (Picked unit) from HeroesGroup
            • Else - Actions
In my map, I killer my own (player 1) hero, computer controlled P2,P3 & P12 heroes. All heroes revived except P12. The timer windows were there, diaplayed the times correctly and they got destroyed.

This will bug if you have more than one hero per player, it needs to be modified. The heroes still respawn, but all timers of that player will be set to the last created timer's time. You need to enable the use of more timers per player, currently it only supports one.
 
Level 2
Joined
Jul 28, 2009
Messages
24
I used these:

  • Joo
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Owner of (Triggering unit)) Not equal to Player 11 (Dark Green)
      • (Owner of (Triggering unit)) Not equal to Player 12 (Brown)
    • Actions
      • Unit Group - Add (Triggering unit) to HeroesGroup
      • Set HeroTimer = (((Real((Hero level of (Dying unit)))) x 3.00) + 5.00)
      • Countdown Timer - Start Timers[(Player number of (Owner of (Dying unit)))] as a One-shot timer that will expire in HeroTimer seconds
      • Countdown Timer - Create a timer window for (Last started timer) with title (Name of (Owner of (Dying unit)))
      • Countdown Timer - Show (Last created timer window) for (Owner of (Dying unit))
      • Set RevivableTimersWindows[(Player number of (Owner of (Dying unit)))] = (Last created timer window)
  • Juu
    • Events
      • Time - Timers[1] expires
      • Time - Timers[2] expires
      • Time - Timers[3] expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HeroesGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for Timers[(Player number of (Owner of (Picked unit)))]) Equal to 0.00
            • Then - Actions
              • Countdown Timer - Destroy RevivableTimersWindows[(Player number of (Owner of (Picked unit)))]
              • Set TempLoc = (Center of Rect 010 <gen>)
              • Hero - Instantly revive (Picked unit) at TempLoc, Hide revival graphics
              • Custom script: call RemoveLocation(udg_TempLoc)
              • Unit Group - Remove (Picked unit) from HeroesGroup
            • Else - Actions
In my map, I killer my own (player 1) hero, computer controlled P2,P3 & P12 heroes. All heroes revived except P12. The timer windows were there, diaplayed the times correctly and they got destroyed.

This will bug if you have more than one hero per player, it needs to be modified. The heroes still respawn, but all timers of that player will be set to the last created timer's time. You need to enable the use of more timers per player, currently it only supports one.
I tried to imitate your shown triggers and they work like they should......except they don't for all other players than Player 1. I am not seeing any errors between yours or mine and it still doesn't seem to work for any other player.... any suggestions?
 
Last edited:
Level 2
Joined
Jul 28, 2009
Messages
24
Post your triggers :)

How did you test it?

I used the "Test Map" Function to test for player 1, and to test for other players, I logged on battle.net to be players 2-10, and they didn't work.

  • Revive Heroes
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Owner of (Triggering unit)) Not equal to Player 11 (Dark Green)
      • (Owner of (Triggering unit)) Not equal to Player 12 (Brown)
    • Actions
      • Unit Group - Add (Triggering unit) to RevivableHeroes
      • Set TempReal = (((Real((Hero level of (Dying unit)))) x 3.00) + 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)))
      • Countdown Timer - Show (Last created timer window) for (Owner of (Dying unit))
      • Set RevivableTimersWindows[(Player number of (Owner of (Dying unit)))] = (Last created timer window)
  • Revive Hero Timerrr
    • Events
      • Time - ReviveTimers[1] expires
      • Time - ReviveTimers[2] expires
      • Time - ReviveTimers[3] expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in RevivableHeroes and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for ReviveTimers[(Player number of (Owner of (Picked unit)))]) Less than 1.00
            • Then - Actions
              • Countdown Timer - Destroy RevivableTimersWindows[(Player number of (Owner of (Picked unit)))]
              • Set HeroRess = (Center of Hero Revive <gen>)
              • Hero - Instantly revive (Picked unit) at HeroRess, Hide revival graphics
              • Camera - Pan camera for (Owner of (Picked unit)) to HeroRess over 0.00 seconds
              • Custom script: call RemoveLocation(udg_HeroRess)
              • Unit Group - Remove (Picked unit) from RevivableHeroes
            • Else - Actions
 
Level 15
Joined
Sep 3, 2006
Messages
1,738
  • (Remaining time for ReviveTimers[(Player number of (Owner of (Picked unit)))]) Less than 1.00
change it to
  • (Remaining time for Timers[(Player number of (Owner of (Picked unit)))]) Equal to 0.00

Also, when you use DotA template triggers, you have to be careful. A lot of the triggers depend on others to work. So you should prolly check the others in the template.
 
Level 2
Joined
Jul 28, 2009
Messages
24
  • (Remaining time for ReviveTimers[(Player number of (Owner of (Picked unit)))]) Less than 1.00
change it to
  • (Remaining time for Timers[(Player number of (Owner of (Picked unit)))]) Equal to 0.00

Also, when you use DotA template triggers, you have to be careful. A lot of the triggers depend on others to work. So you should prolly check the others in the template.

I tried it, but it still didn't change anything to make it able to work for players 2-10....

And yeah, I noticed that about the DotA Template... I've read through this trigger that I copied from Maker and it seems pretty stand-alone, yet it doesn't seem to work when I am in a slot other than player 1...
 
Level 2
Joined
Jul 28, 2009
Messages
24
Okay, I feel dumb. I found out the main reason why it wasn't working. The variable arrays were set so it would only work for player 1, and thus, it didn't work for players 2-10. Thank you all for your help, however. ^^ +rep to those that helped me.
 
Level 3
Joined
Feb 13, 2008
Messages
65
I use a very simple set of custom script triggers for hero revival. Its very easy to work with as well

  • Events
  • Unit - A unit Dies
  • Conditions
  • And - All (Conditions) are true
    • Conditions
      • ((Dying Unit) Is a Hero) Equal to True
  • Actions
  • Custom Script: local timerdialog WINDOW
  • Custom Script: local integer HEROWAIT
  • Custom Script: local timer OURTIMER
  • Custom Script: local unit OURHERO
  • Custom Script: set OURHERO = GetDyingUnit()
  • Custom Script: set HEROWAIT = ( GetHeroLevel(OURHERO) * 2)
  • Custom Script: set OURTIMER = CreateTimer()
  • Custom Script: call StartTimerBJ( OURTIMER, false, (I2R(HEROWAIT)))
  • Custom Script: call CreateTimerDialogBJ( OURTIMER, GetPlayerName(GetOwningPlayer(OURHERO)))
  • Custom Script: set WINDOW = GetLastCreatedTimerDialogBJ()
  • Custom Script: call TimerDialogDisplayForPlayerBJ( true, WINDOW, GetOwningPlayer(OURHERO))
  • Custom Script: call PolledWait(HEROWAIT)
  • Custom Script: call ReviveHeroLoc(OURHERO, GetRectCenter(gg_rct_loc),true)
  • Custom Script: call PanCameraToTimedLocForPlayer(GetOwningPlayer(OURHERO),GetUnitLoc(OURHERO),0.60)
  • Custom Script: call DestroyTimerDialog(WINDOW)
To change the location of the rez simply switch the "loc" in gg_rct_loc to the name of the region. Right now the rez timer is set to 2x the hero's level, you can edit that as well.
 
Status
Not open for further replies.
Top