• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Hero Respawn System

Status
Not open for further replies.
Level 8
Joined
Jun 13, 2010
Messages
344
Hey, I have followed a lot of guides and copied the exact same system and triggers they used, but for some reason it just doesn't work.
I even tried to make the simplest of all triggers and sometimes it works, sometimes it doesn't. Now it just doesn't work no matter what.

  • Hero Revive Add
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Unit Group - Add (Triggering unit) to Hero_RevivableHeroes
      • Trigger - Turn on Hero Revive Periodic <gen>
  • Hero Revive Periodic
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set A_Counter = 0
      • Unit Group - Pick every unit in Hero_RevivableHeroes and do (Actions)
        • Loop - Actions
          • Set A_Counter = (A_Counter + 1)
          • Set A_All_Units = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Area_HeroSave[(Player number of (Owner of A_All_Units))] Equal to Alkarean Outpost
            • Then - Actions
              • Hero - Instantly revive A_All_Units at (Center of Starting Spawn Point <gen>), Hide revival graphics
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Area_HeroSave[(Player number of (Owner of A_All_Units))] Equal to Vevarian City
            • Then - Actions
              • Hero - Instantly revive A_All_Units at (Center of Area Vevarian City Revive <gen>), Hide revival graphics
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Area_HeroSave[(Player number of (Owner of A_All_Units))] Equal to The Misty Isles
            • Then - Actions
              • Hero - Instantly revive A_All_Units at (Center of Zeppelin Misty Isles Camp <gen>), Hide revival graphics
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Area_HeroSave[(Player number of (Owner of A_All_Units))] Equal to Alkarah Throne Room
            • Then - Actions
              • Hero - Instantly revive A_All_Units at (Center of Area Alkarah Throne Room <gen>), Hide revival graphics
            • Else - Actions
          • Camera - Pan camera for (Owner of A_All_Units) to (Position of A_All_Units) over 0.00 seconds
          • Unit Group - Remove A_All_Units from Hero_RevivableHeroes
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • A_Counter Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
There are different string variables which are a various of "save points" to be revived at.
But nothing happens when my Hero dies. Have I overseen something? I am getting quite frustrated actually.
Thanks for reading!
 
The Triggers are correct, but Leaks Locations.

If it doesn't work 2 Problems come me to mind, that could occur in your case.

Guess1:
the saved String is not equal to the String checked, for the area containing your dying hero.
Check if you insert an space " " or something other not easy visible difference.

For a test you could use the String-output, to check the Current Value of the String.
  • Game - Display to (All players) for 30.00 seconds the text: Area_HeroSave[(Player number of (Owner of A_All_Units))]
Guess2:
Important:
Did you create the "Hero_RevivableHeroes"-Group inside an init-Trigger?
If the group was not Created before, with an "Units in Area/in Range of" or custom Skript set udg_ Hero_RevivableHeroes = CreateGroup() Action the Group can't Contain any Unit.

You'll may me need something like this
  • Nahkampf-Initialisierung
    • Ereignisse
      • Map initialization
    • Bedingungen
    • Aktionen
    • -------- Both following Actions work to Create an empty Group. But you need only one. - -------
    • Set Hero_RevivableHeroes = (Units in (Playable map area) matching (False Gleich True))
    • Custom script: set udg_Hero_RevivableHeroes= CreateGroup()
 
Last edited:
Level 8
Joined
Jan 28, 2016
Messages
486
The Triggers are correct, but Leaks Locations.

If it doesn't work 2 Problems come me to mind, that could occur in your case.

Guess1:
the saved String is not equal to the String checked, for the area containing your dying hero.
Check if you insert an space " " or something other not easy visible difference.

For a test you could use the String-output, to check the Current Value of the String.
  • Game - Display to (All players) for 30.00 seconds the text: Area_HeroSave[(Player number of (Owner of A_All_Units))]
Guess2:
Important:
Did you create the "Hero_RevivableHeroes"-Group inside an init-Trigger?
If the group was not Created before, with an "Units in Area/in Range of" or custom Skript set udg_ Hero_RevivableHeroes = CreateGroup() Action the Group can't Contain any Unit.

You'll may me need something like this
  • Nahkampf-Initialisierung
    • Ereignisse
      • Map initialization
    • Bedingungen
    • Aktionen
    • -------- Both following Actions work to Create an empty Group. But you need only one. - -------
    • Set Hero_RevivableHeroes = (Units in (Playable map area) matching (False Gleich True))
    • Custom script: set udg_Hero_RevivableHeroes= CreateGroup()

Global unit groups created in the Variable Editor are initialised in the InitGlobals function of a map, so it can't be this. It's most likely your first guess. Might also want to double-check how those string variables are being saved.

Alternatively, why not store the checkpoints in a region array at map init and check them against an integer array instead. For example:
  • Checkpoint Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Checkpoint[1] = Starting Spawn Point <gen>
      • Set Checkpoint[2] = Area Vevarian City Revive <gen>
      • Set Checkpoint[3] = Zeppelin Misty Isles Camp <gen>
      • Set Checkpoint[4] = Area Alkarah Throne Room <gen>
      • Set CheckpointMax = 4
  • Hero Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Unit Group - Add (Triggering unit) to RevivableHeroes
  • Hero Revive
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in RevivableHeroes and do (Actions)
        • Loop - Actions
          • For each (Integer TempInteger) from 1 to CheckpointMax, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • SavedRegionInteger[(Player number of (Owner of (Picked unit)))] Equal to TempInteger
                • Then - Actions
                  • Set TempLocation = (Center of Checkpoint[TempInteger])
                  • Hero - Instantly revive (Picked unit) at Location, Hide revival graphics
                  • Unit Group - Remove (Picked unit) from RevivableHeroes
                  • Custom script: call RemoveLocation(udg_TempLocation)
                • Else - Actions
 
Level 8
Joined
Jun 13, 2010
Messages
344
Global unit groups created in the Variable Editor are initialised in the InitGlobals function of a map, so it can't be this. It's most likely your first guess. Might also want to double-check how those string variables are being saved.

Alternatively, why not store the checkpoints in a region array at map init and check them against an integer array instead. For example:
  • Checkpoint Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Checkpoint[1] = Starting Spawn Point <gen>
      • Set Checkpoint[2] = Area Vevarian City Revive <gen>
      • Set Checkpoint[3] = Zeppelin Misty Isles Camp <gen>
      • Set Checkpoint[4] = Area Alkarah Throne Room <gen>
      • Set CheckpointMax = 4
  • Hero Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Unit Group - Add (Triggering unit) to RevivableHeroes
  • Hero Revive
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in RevivableHeroes and do (Actions)
        • Loop - Actions
          • For each (Integer TempInteger) from 1 to CheckpointMax, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • SavedRegionInteger[(Player number of (Owner of (Picked unit)))] Equal to TempInteger
                • Then - Actions
                  • Set TempLocation = (Center of Checkpoint[TempInteger])
                  • Hero - Instantly revive (Picked unit) at Location, Hide revival graphics
                  • Unit Group - Remove (Picked unit) from RevivableHeroes
                  • Custom script: call RemoveLocation(udg_TempLocation)
                • Else - Actions

Okay so I tried your system with my own triggers.
But it does not work. And I just cannot seem to get it working.
The 5 seconds respawn trigger does not activate anything. Are you sure a dead unit can be added to a Unit Group and/or picked? Nothing happens, not even if I try to make a game message when it picks the dead unit in the Unit Group.

  • Hero Respawn Regions
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Player_Checkpoints[1] = Starting Spawn Point <gen>
      • Set Player_Checkpoints[2] = Area Vevarian City Revive <gen>
      • Set Player_Checkpoints[3] = Zeppelin Misty Isles Camp <gen>
      • Set Player_Checkpoints[4] = Area Alkarah Throne Room <gen>
      • Set Player_CheckpointsMax = 4
  • Hero Respawn Group
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Unit Group - Add (Triggering unit) to Hero_RevivableHeroes
  • Hero Respawn Timer
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Hero_RevivableHeroes and do (Actions)
        • Loop - Actions
          • Set A_All_Units = (Picked unit)
          • For each (Integer Player_CheckpointsTemp) from 1 to Player_CheckpointsMax, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Player_CheckpointSavedInt[(Player number of (Owner of A_All_Units))] Equal to Player_CheckpointsTemp
                • Then - Actions
                  • Set A_Point = (Center of Player_Checkpoints[Player_CheckpointsTemp])
                  • Hero - Instantly revive A_All_Units at A_Point, Hide revival graphics
                  • Unit Group - Remove A_All_Units from Hero_RevivableHeroes
                  • Custom script: call RemoveLocation (udg_A_Point)
                • Else - Actions
  • Hero Save Area Alkarean Outpost
    • Events
      • Unit - A unit enters Area Alkarean Outpost <gen>
      • Unit - A unit enters Zeppelin Alkarean Outpost <gen>
      • Unit - A unit enters Starting Spawn Point <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Owner of (Triggering unit)) Not equal to Player 12 (Brown)
      • (Owner of (Triggering unit)) Not equal to Neutral Passive
      • Player_CheckpointSavedInt[(Player number of (Owner of (Triggering unit)))] Not equal to 1
    • Actions
      • Set Player_CheckpointSavedInt[(Player number of (Owner of (Triggering unit)))] = 1
      • Game - Display to (Player group((Owner of (Triggering unit)))) for 1.00 seconds the text: |cffffcc00Save Poin...
 
Last edited:
Level 8
Joined
Jun 13, 2010
Messages
344
So you want to respawn a hero in random region after 5 seconds?
No I wish to have save points.

The last trigger is the 1. spawn area. It just has a spawn region, entrance region and fly path region.
What I want is just to revive any dead hero every 5 seconds. Because no matter what I do, I cannot just make any dead revive trigger. Every tutorial I follow just seems not to work.. I wonder if something is bugged in my Editor or smth.. It's just strange.
Or maybe I'm just too idiotic to the it right. Can't tell.
 
Level 8
Joined
Jun 13, 2010
Messages
344
You'll need to create the Group object before you can add any unit to it.
Gui does that automatic, if you use an "pick Units action"

Like i posted to this thread some posts above.

I did this and can see it counts the Unit Group = 0. So it should work now.

  • Hero Respawn Regions
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Player_Checkpoints[1] = Starting Spawn Point <gen>
      • Set Player_Checkpoints[2] = Area Vevarian City Revive <gen>
      • Set Player_Checkpoints[3] = Zeppelin Misty Isles Camp <gen>
      • Set Player_Checkpoints[4] = Area Alkarah Throne Room <gen>
      • Set Player_CheckpointsMax = 4
      • Custom script: set udg_Hero_RevivableHeroes= CreateGroup()
      • Wait 5.00 seconds
      • Game - Display to (All players) the text: (String((Number of units in Hero_RevivableHeroes)))
But my dead Hero still does not revive.
 
Level 8
Joined
Jun 13, 2010
Messages
344
Maybe your Saved Position in this case is 0 or greater then 4.

The default of the Player_CheckpointSavedInt?
I've tried to put it to 1 as default. But the save point system worked. Because when my Hero starts, it enters a region which puts it into Player_CheckpointSavedInt[Owner of Unit] = 1.
And it is confirmed by message..
But the Hero will still not revive.
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
Remove the wait time when you debug the group onInit.
Add debug on the loop or periodic trigger. ( If it doesnt show the msg then maybe it is disabled or initially off. )
Make sure the regions are initialized correctly.
Make sure the periodic trigger is not involved in other trigger stuffs.
Dead units still leave a shadow reference when removed on game but not in unit group.
The A_Counter is useless maybe remove it together with the turn off trigger.
Make sure that the hero revival group was not destroyed.
Global groups are initialized as empty group btw.
Try to revive the hero in the center of the map.
Debug all the counters you use especially those who are involved in conditions.
You can attach the map so we can internally fix the problem but its up to you.
 
Level 3
Joined
Jun 16, 2016
Messages
50
  • Hero Respawn Group
  • Events
  • Unit - A unit Dies
  • Conditions
  • ((dying) is A Hero) Equal to True
  • Actions
  • Unit Group - Add (dying unit) to Hero_RevivableHeroes
this might fix your problem , lol
 
Level 8
Joined
Jan 28, 2016
Messages
486
Okay so I tried your system with my own triggers.
But it does not work. And I just cannot seem to get it working.
The 5 seconds respawn trigger does not activate anything. Are you sure a dead unit can be added to a Unit Group and/or picked? Nothing happens, not even if I try to make a game message when it picks the dead unit in the Unit Group.

I replicated the triggers and everything worked as it should. I even split up the region trigger to separate the events to see if the hero would spawn at the other regions correctly, and it did. It seems there might be another trigger in your map that's somehow interfering with the revival system as JakeZinc touched on.

P.S.: The only key difference I had in my triggers was that I only checked if the unit entering any of the regions was a hero. I doubt this is the cause but who's knows; thought I'd better mention it anyway.
 
Last edited:
Status
Not open for further replies.
Top