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: 56
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.
 
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.
 
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.
Back
Top