• 🏆 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!

Respawn problem...

Status
Not open for further replies.
Level 10
Joined
Mar 17, 2012
Messages
579
Hi everyone! Could someone help me with a revive trigger?
In my map if a Hero dies - the grave appears on his place and expires in 30 seconds.
If hero is resurrected while the grave stands - he will not respawn on the start location, else he'll respawn on the start location)))

I have a problem triggering it... I used an Countdown timer but when my hero dies - the game crashes, so I removed them and made it with Wait 30 seconds and check conditions... but I know that it is not correct so I'm asking you for help! :ogre_rage:

Here is how my trigger looks now:
  • Grave
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) belongs to an enemy of Neutral Hostile) Equal to True
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Unit - Create 1 Death Dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
      • Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
      • Wait 30.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is alive) Equal to False
          • ((Triggering unit) belongs to an ally of Player 1 (Red)) Equal to True
        • Then - Actions
          • Hero - Instantly revive (Triggering unit) at (Player 1 (Red) start location), Show revival graphics
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) is alive) Equal to False
              • ((Triggering unit) belongs to an ally of Player 7 (Green)) Equal to True
            • Then - Actions
              • Hero - Instantly revive (Triggering unit) at (Player 7 (Green) start location), Show revival graphics
            • Else - Actions
 
Level 10
Joined
Mar 17, 2012
Messages
579
Alternatively, use 2 triggers, make this action on this trigger :
  • Trigger - Add Your Second Trigger the event Last Created Unit Dies
Before that, make a second trigger, copy and paste the ITE, and remove the wait and then add the event on that trigger.

Could you make an example please? Because I can hardly imagine how it will work...
P.S. Hero can be resurrected by Resurrestion spell that will be casted on him so it is not so easy)
 
Level 10
Joined
Mar 17, 2012
Messages
579
Nope nope nope. Do not put any conditions. Put everything into if/then/elses so you could check if it's the hero or the grave dying. That way, you could do without.. Waits.

Today I made some sketches while I was working :D
Take a look:

  • Hero Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) belongs to an enemy of Neutral Hostile) Equal to True
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Unit - Create 1 Death Dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
      • Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
      • Set Player_Number_int = (Player number of (Owner of (Triggering unit)))
      • Set Duying_Hero[Player_Number_int] = (Triggering unit)
      • Set Respawn_int[Player_Number_int] = 30
      • Trigger - Turn on Countdown <gen>
  • Countdown
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Duying_Hero[Player_Number_int] is alive) Equal to False
        • Then - Actions
          • Set Respawn_int[Player_Number_int] = (Respawn_int[Player_Number_int] - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Respawn_int[Player_Number_int] Less than 1
              • ((Triggering unit) belongs to an ally of Player 1 (Red)) Equal to True
            • Then - Actions
              • Hero - Instantly revive (Triggering unit) at (Player 1 (Red) start location), Show revival graphics
              • Selection - Select (Triggering unit) for (Owner of (Triggering unit))
              • Camera - Pan camera for (Owner of (Triggering unit)) to (Player 1 (Red) start location) over 0.00 seconds
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Respawn_int[Player_Number_int] Less than 1
                  • ((Triggering unit) belongs to an ally of Player 7 (Green)) Equal to True
                • Then - Actions
                  • Hero - Instantly revive (Triggering unit) at (Player 7 (Green) start location), Show revival graphics
                  • Selection - Select (Triggering unit) for (Owner of (Triggering unit))
                  • Camera - Pan camera for (Owner of (Triggering unit)) to (Player 7 (Green) start location) over 0.00 seconds
                • Else - Actions
        • Else - Actions
          • Set Respawn_int[Player_Number_int] = 0
          • Trigger - Turn off (This trigger)
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
This is not MUI or MPI.
Your player number is bein overwritten every time a new unit dies.

Your options are to index using indexed arrays.
Use timers for each units.
Use local variables with waits.

Indexing is your best option. Check out the chapter how to index in my tutorial things a GUIer should know.

When unit does equal to hero you index. Use counter integer to count time passed then revive unit. Then de-index.
 
^ He didn't have to .. index or periodic that.

Just use the instant trigger I mentioned.

  • Revive
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is A Hero) Equal to True
        • Then - Actions
          • Set TempPoint = (Position of (Triggering unit))
          • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
          • Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
          • Custom script: call RemoveLocation(udg_TempPoint)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) equal to Dummy
        • Then - Actions
          • Set TempPoint = (Center of TeamBase)
          • Hero - Instantly revive PlayerHero[TempInteger] at TempPoint, Show revival graphics
          • Custom script: call RemoveLocation(udg_TempPoint)
        • Else - Actions
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
You can make an array for gravestones.
Then when a hero dies you save the gravestone and link it to the hero.
Then, make the gravestone have negative life regeneration and low life(30 health and -1 reg = 30 seconds to revive)
When a gravestone dies you do whatever you want with the according hero.
 
Level 10
Joined
Mar 17, 2012
Messages
579
^ He didn't have to .. index or periodic that.

Just use the instant trigger I mentioned.

  • Revive
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is A Hero) Equal to True
        • Then - Actions
          • Set TempPoint = (Position of (Triggering unit))
          • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
          • Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
          • Custom script: call RemoveLocation(udg_TempPoint)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) equal to Dummy
        • Then - Actions
          • Set TempPoint = (Center of TeamBase)
          • Hero - Instantly revive PlayerHero[TempInteger] at TempPoint, Show revival graphics
          • Custom script: call RemoveLocation(udg_TempPoint)
        • Else - Actions

AND IF ALLIED HERO USES "RESURRECTION" SPELL - DUMMY DIES AND TRIGGER WORKS!!! GENIOUS!!!! :ogre_haosis::ogre_haosis::ogre_haosis:
 
The rest of the trigger will work, but your hero will not revive since he's already alive. If you want to pan camera and encounter unwanted panning, you can add a condition if the hero was alive when the dummy dies. Pretty simple from my point of view.
Let's try not to add sarcasm to our words, shall we not?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
The original trigger looked fine. Was there some problem? I modified it just a bit.
  • Grave
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) belongs to an enemy of Neutral Hostile) Equal to True
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Unit - Create 1 Death Dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
      • Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
      • Wait 30.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is alive) Equal to False
          • Then - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Triggering unit) belongs to an ally of Player 1 (Red)) Equal to True
                • Then - Actions
                  • Hero - Instantly revive (Triggering unit) at (Player 1 (Red) start location), Show revival graphics
                • Else - Actions
                  • Hero - Instantly revive (Triggering unit) at (Player 7 (Green) start location), Show revival graphics
            • Else - Actions

http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/
 
Level 10
Joined
Mar 17, 2012
Messages
579
The original trigger looked fine. Was there some problem? I modified it just a bit.

I'm lil bit shy to show, but here is how the revive system looks like now:

  • Heroes
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • -------- Heroes Defenders --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
        • Then - Actions
          • Set Hero_Blue = (Entering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 3 (Teal)
        • Then - Actions
          • Set Hero_Teal = (Entering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
        • Then - Actions
          • Set Hero_Purple = (Entering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
        • Then - Actions
          • Set Hero_Yellow = (Entering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 6 (Orange)
        • Then - Actions
          • Set Hero_Orange = (Entering unit)
        • Else - Actions
      • -------- Heroes Attackers --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 8 (Pink)
        • Then - Actions
          • Set Hero_Pink = (Entering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 9 (Gray)
        • Then - Actions
          • Set Hero_Gray = (Entering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 10 (Light Blue)
        • Then - Actions
          • Set Hero_LB = (Entering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 11 (Dark Green)
        • Then - Actions
          • Set Hero_DG = (Entering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 12 (Brown)
        • Then - Actions
          • Set Hero_Brown = (Entering unit)
        • Else - Actions
  • Hero Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) belongs to an enemy of Neutral Hostile) Equal to True
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Unit - Create 1 Death Dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
      • Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
  • Reviver
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Death Dummy
    • Actions
      • -------- ----- Defenders ------ --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
        • Then - Actions
          • Hero - Instantly revive Hero_Blue at (Player 1 (Red) start location), Show revival graphics
          • Selection - Select Hero_Blue for Player 2 (Blue)
          • Camera - Pan camera for Player 2 (Blue) to (Player 1 (Red) start location) over 0.00 seconds
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering unit)) Equal to Player 3 (Teal)
            • Then - Actions
              • Hero - Instantly revive Hero_Teal at (Player 1 (Red) start location), Show revival graphics
              • Selection - Select Hero_Teal for Player 3 (Teal)
              • Camera - Pan camera for Player 3 (Teal) to (Player 1 (Red) start location) over 0.00 seconds
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
                • Then - Actions
                  • Hero - Instantly revive Hero_Purple at (Player 1 (Red) start location), Show revival graphics
                  • Selection - Select Hero_Purple for Player 4 (Purple)
                  • Camera - Pan camera for Player 4 (Purple) to (Player 1 (Red) start location) over 0.00 seconds
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
                    • Then - Actions
                      • Hero - Instantly revive Hero_Yellow at (Player 1 (Red) start location), Show revival graphics
                      • Selection - Select Hero_Yellow for Player 5 (Yellow)
                      • Camera - Pan camera for Player 5 (Yellow) to (Player 1 (Red) start location) over 0.00 seconds
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Owner of (Triggering unit)) Equal to Player 6 (Orange)
                        • Then - Actions
                          • Hero - Instantly revive Hero_Orange at (Player 1 (Red) start location), Show revival graphics
                          • Selection - Select Hero_Orange for Player 6 (Orange)
                          • Camera - Pan camera for Player 6 (Orange) to (Player 1 (Red) start location) over 0.00 seconds
                        • Else - Actions
      • -------- ----- Attackers ------ --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 8 (Pink)
        • Then - Actions
          • Hero - Instantly revive Hero_Pink at (Player 7 (Green) start location), Show revival graphics
          • Selection - Select Hero_Pink for Player 8 (Pink)
          • Camera - Pan camera for Player 8 (Pink) to (Player 7 (Green) start location) over 0.00 seconds
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering unit)) Equal to Player 9 (Gray)
            • Then - Actions
              • Hero - Instantly revive Hero_Gray at (Player 7 (Green) start location), Show revival graphics
              • Selection - Select Hero_Gray for Player 9 (Gray)
              • Camera - Pan camera for Player 9 (Gray) to (Player 7 (Green) start location) over 0.00 seconds
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Owner of (Triggering unit)) Equal to Player 10 (Light Blue)
                • Then - Actions
                  • Hero - Instantly revive Hero_LB at (Player 7 (Green) start location), Show revival graphics
                  • Selection - Select Hero_LB for Player 10 (Light Blue)
                  • Camera - Pan camera for Player 10 (Light Blue) to (Player 7 (Green) start location) over 0.00 seconds
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Owner of (Triggering unit)) Equal to Player 11 (Dark Green)
                    • Then - Actions
                      • Hero - Instantly revive Hero_DG at (Player 7 (Green) start location), Show revival graphics
                      • Selection - Select Hero_DG for Player 11 (Dark Green)
                      • Camera - Pan camera for Player 11 (Dark Green) to (Player 7 (Green) start location) over 0.00 seconds
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Owner of (Triggering unit)) Equal to Player 12 (Brown)
                        • Then - Actions
                          • Hero - Instantly revive Hero_Brown at (Player 7 (Green) start location), Show revival graphics
                          • Selection - Select Hero_Brown for Player 12 (Brown)
                          • Camera - Pan camera for Player 12 (Brown) to (Player 7 (Green) start location) over 0.00 seconds
                        • Else - Actions
Is it normal?)))
 
Didn't you read DIMF's tutorial? There was a topic about nested ITEs.

Anyways, how do your heroes actually enter the map? Taverns? Hero Selection Area?
From Tavern, you could check Unit-Type of Sold Unit and do this;

Set Hero[Player Number of (Triggering Player)] = Sold Unit

From Hero Selection Area,

Unit - Create 1 Unit-Type of Sold Unit at Point
Set Hero[Player Number of (Triggering Player)] = Last Created Unit

  • Revive
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is A Hero) Equal to True
          • Hero[Player number of (Owner of Triggering Unit)] equal to (Triggering Unit)
        • Then - Actions
          • Custom script: set udg_TempPoint = GetUnitLoc(GetTriggerUnit)
          • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
          • Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
          • Custom script: call RemoveLocation(udg_TempPoint)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Dummy
          • (Hero[(Player number of (Owner of (Triggering unit)))] is alive) Equal to False
        • Then - Actions
          • Set TempPoint = ((Owner of (Triggering unit)) start location)
          • Hero - Instantly revive Hero[(Player number of (Owner of (Triggering unit)))] at TempPoint, Show revival graphics
          • Custom script: call RemoveLocation(udg_TempPoint)
        • Else - Actions
 
Level 10
Joined
Mar 17, 2012
Messages
579
Didn't you read DIMF's tutorial? There was a topic about nested ITEs.

Anyways, how do your heroes actually enter the map? Taverns? Hero Selection Area?

Not quite, there is a hero-dummy on the Tavern-shop that sells items-heroes. when hero-dummy buys an item-hero - hero-dummy removes from the game and creates the chosen hero at start location

Set Hero[Player Number of (Triggering Player)] = Last Created Unit

I'm not sure that it will store all needed information :( it have to store the information about the picked hero for all game time...

Here is how my pick system works (this is for 1 character):
  • Pick Demon Fighter
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • (Item-type of (Sold Item)) Equal to Demon Fighter
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Buying unit)) is an ally of Player 7 (Green)) Equal to True
        • Then - Actions
          • Unit - Remove (Buying unit) from the game
          • Unit - Create 1 Demon Fighter for (Owner of (Buying unit)) at (Player 7 (Green) start location) facing Default building facing degrees
          • Hero - Create War Pick and give it to (Last created unit)
          • Selection - Select (Last created unit) for (Owner of (Buying unit))
          • Camera - Pan camera for (Owner of (Buying unit)) to (Player 7 (Green) start location) over 0.00 seconds
        • Else - Actions
 
I'm not sure that it will store all needed information :( it have to store the information about the picked hero for all game time...

I know that.

You can actually make everything generic. Remove that condition in the ITE. Set the Owner of Buying Unit Start Location to a variable. It can run for every player now.
 
Status
Not open for further replies.
Top