• 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] Checking for condition if all players are dead?

Status
Not open for further replies.
Level 5
Joined
Jan 25, 2006
Messages
103
Hi there.
So I have set up some triggers so that a unit destroys objectx, all players heroes are moved to positionx and all units in map owned by enemy player are paused.
Now if players kill unitx, they are transfered to center of map, enemy player units unpaused and I got it all done and working good.

The problem i have is how to make it so that if all players heroes are killed by the unitx, so that all players heroes are revived to positionx2 and enemy player units unpaused?
I can't seem to think of a way or find a way to check if all players heroes are killed by unitx and when that happens to revive them at positionx2.

Any help or example on what triggers and/or variable to use would be very apreciated! Thanks in advance!
 
Level 11
Joined
May 31, 2008
Messages
698
Just add all of your heroes into a unit group, variable of course so you can remove it, then do a trigger - a unit owned by ally of player 1 dies - if number of units in group *heroes* is equal to 0 - pick all units in *heroes* and revive picked unit at point.
I think it should work. Remember to reset the group.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
  • Deadcheck
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to (==) True
      • ((Triggering unit) belongs to an ally of Player 1 (Red)) Equal to (==) True
      • (Number of units in (Units in (Playable map area) matching ((((Matching unit) is alive) Equal to (==) True) and ((((Matching unit) is A Hero) Equal to (==) True) and (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to (==) True))))) Equal to (==) 0
    • Actions
If this trigger Runs than it means there are no heroes alive allied with Player 1
(I thought player 1 is one of players and others are its allies so if not you can change it)
 
Level 11
Joined
May 31, 2008
Messages
698
Wouldnt you only need the third condition?

EDIT:
Well i guess you do need other two cuz then if an enemy hero or unit died before
the players heroes revived then it could run the trigger twice. Answered my own
question i guess :O
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
Wouldnt you only need the third condition?

EDIT:
Well i guess you do need other two cuz then if an enemy hero or unit died before
the players heroes revived then it could run the trigger twice. Answered my own
question i guess :O

Well only third one is enough but I have a reason for that
You see if first condition fails it wont check for others
I wanted it like that because 3rd condition has many operations inside it so in this way 3rd condition wont run everytime a unit dies (creeps etc) because of first two
 
Level 5
Joined
Jan 25, 2006
Messages
103
It didn't work, though thanks for replies.
I actually found a different way to make it work.
I actually check the region where the unitx is spawned every 5 seconds, if there are 1 or less units the actions are made and it works great the few times i tested.
 
Status
Not open for further replies.
Top