Help with Trigger, removing units owned by unused slot playe
I'm trying to remove hero and barrack if they are not filled in from Map Initalization.
I'm still newb in this thing, what I have is here.
Map Init
Events
Map initialization
Conditions
Actions
Player Group - Pick every player in (All players) and do (Actions)
Loop - Actions
Player - Set (Picked player) Current gold to 350
Player - Turn Gives bounty On for (Picked player)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked player) slot status) Equal to Is unused
Then - Actions
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Unit - Remove (Picked unit) from the game)
Else - Actions
Do nothing
Then I test the map, every players units are still in there. I tried vary ways to do this, none of them work. Can any of you show the correct way to do this?
Eh...You used picked player for the removal, all of the players have to be not playing which is impossible... You have to do it seperately for each player, and as $h@dow said, use a periodic timer.
Thanks for suggestion, but I prefer that leavers unit remains in game.
Let say, there's slot with 3v3 and people only fill up 2v2.. I want to delete the other 1v1 slot units from start of game.
I tried do your suggestion, do each player (I only did 1 to see if it work, it doesn't)
Actions
If ((Player 2 (Blue) slot status) Not equal to Is playing) then do (Unit Group - Remove all units from (Units owned by Player 2 (Blue))) else do (Do nothing)
Player Group - Pick every player in (All players) and do (Actions)
Loop - Actions
Player - Set (Picked player) Current gold to 350
Player - Turn Gives bounty On for (Picked player)
I've tried it like you put it and it doesn't work for some reason, despite the fact that it should. Some methods I've tried have somehow actually removed only MY guys. I think what the problem is is that it's not recognizing these people as not in the game for some reason, not when you do it like that.
What I've managed is a trigger that selects players based on units. This sounds like a melee map, so you'll need four triggers like this:
Unit Group - Pick every unit in (Units of type Peasant) and do (Actions)
Loop - Actions
Unit Group - Pick every unit in (Units owned by (Owner of (Picked unit)) matching ((((Owner of (Picked unit)) slot status) Equal to Is unused) or (((Owner of (Picked unit)) slot status) Equal to Has left the game))) and do (Actions)
Loop - Actions
Unit - Remove (Picked unit) from the game
Unit Group - Pick every unit in (Units of type Peon) and do (Actions)
Loop - Actions
Unit Group - Pick every unit in (Units owned by (Owner of (Picked unit)) matching ((((Owner of (Picked unit)) slot status) Equal to Is unused) or (((Owner of (Picked unit)) slot status) Equal to Has left the game))) and do (Actions)
Loop - Actions
Unit - Remove (Picked unit) from the game
Unit Group - Pick every unit in (Units of type Acolyte) and do (Actions)
Loop - Actions
Unit Group - Pick every unit in (Units owned by (Owner of (Picked unit)) matching ((((Owner of (Picked unit)) slot status) Equal to Is unused) or (((Owner of (Picked unit)) slot status) Equal to Has left the game))) and do (Actions)
Loop - Actions
Unit - Remove (Picked unit) from the game
Unit Group - Pick every unit in (Units of type Wisp) and do (Actions)
Loop - Actions
Unit Group - Pick every unit in (Units owned by (Owner of (Picked unit)) matching ((((Owner of (Picked unit)) slot status) Equal to Is unused) or (((Owner of (Picked unit)) slot status) Equal to Has left the game))) and do (Actions)
Loop - Actions
Unit - Remove (Picked unit) from the game
If you're using your own races, then just set the unit that those pertain to to whatever the builder is of each race, and that should remove your units properly. I know it may seem redundant, that you shouldn't need to pick players based on units, but I spent several hours trying to get it to work for my map, and that's the only thing I found that worked.
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
Loop - Actions
If (((Owner of (Picked unit)) slot status) Not equal to Is playing) then do (Unit - Remove (Picked unit) from the game) else do (Do nothing)