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

Help with Trigger, removing units owned by unused slot playe

Status
Not open for further replies.
Level 5
Joined
Nov 14, 2004
Messages
159
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.


Code:
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?
 
Level 3
Joined
Jul 23, 2004
Messages
58
Better use "Is not playing" and include it in a periodic timer so also leavers-units are being removed
 
Level 4
Joined
Feb 12, 2006
Messages
99
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.
 
Level 5
Joined
Nov 14, 2004
Messages
159
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)

Code:
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 still do it wrong? Help please.
 
Level 3
Joined
Jul 23, 2004
Messages
58
Have you set player 2 as Computer or not? If player is computer this means that its a playing player.
 
Level 6
Joined
Aug 25, 2004
Messages
336
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:
Code:
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

Code:
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

Code:
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

Code:
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.
 
Level 5
Joined
Nov 14, 2004
Messages
159
I got it working! I did this way.

Code:
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)

Thanks everyone for trying helping me!
 
Status
Not open for further replies.
Top