• 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.

Remove units

Status
Not open for further replies.
Level 4
Joined
Oct 9, 2016
Messages
49
Hey guys,i have made a map that players fight zombies,the problem is when the players dies the zombies will keep spawning and lags the whole so i decide to make a trigger that remove the player's enemy after he is defeated,but it aint working,can someone show me how to make correct triggers?
 

Attachments

  • 无标题.png
    无标题.png
    20.5 KB · Views: 20
Level 45
Joined
Feb 27, 2007
Messages
5,578
There are probably some player-owned invisible dummy units somewhere on the map that's causing it to fail the "units owned by player X == 0" check. Does each player have a base/townhall/some main hero unit? If so, you could try checking if those specific units are all dead for each player instead of checking if all of his units are.

Generally speaking "it isn't working" is not helpful enough to diagnose a problem. Also you can copy triggers by right-click >> copy as text, then past here between [trigger][/trigger] tags.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
You should remove the condition and make it an if statement in the actions.
Pick all units owned by player red, teal and green and print their names.
(Do not only print their names, but something like: Unit: "" in that case, you will also be able to spot units without a name.)

Also remember that dead units are also in these groups, so it also counts the dead units.
And as a unit owned by those players has just died, I assume he is still in those groups.
 
Level 4
Joined
Oct 9, 2016
Messages
49
Thank you guy i manage to get work,here is the trigger i used,altho i really i can hope lost all units as their lost conditions but this will work just fine

  • Events
    • Unit - A unit owned by Player 4 (Purple) Dies
    • Unit - A unit owned by Player 2 (Blue) Dies
    • Unit - A unit owned by Player 8 (Pink) Dies
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ((Main Hall Level 1 0015 <gen> is dead) Equal to True) and (((Main Hall Level 1 0022 <gen> is dead) Equal to True) and ((Main Hall Level 1 0028 <gen> is dead) Equal to True))
      • Then - Actions
        • Game - Display to (All players) the text: Team Blue has Fallen
        • Wait 10.00 seconds
        • Unit Group - Pick every unit in (Units owned by Player 10 (Light Blue)) and do (Actions)
          • Loop - Actions
            • Unit - Remove (Picked unit) from the game
      • Else - Actions
 
Status
Not open for further replies.
Top