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

Removing units if no one takes the spot?

Status
Not open for further replies.
Level 9
Joined
Apr 23, 2010
Messages
312
This trigger will loop through every player in the game, check if the player slot is being used and if not, it will remove all units owned by that player.
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • 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 owned by (Picked player)) and do (Unit - Remove (Picked unit) from the game)
            • Else - Actions
      • Trigger - Turn off (This trigger)
 
Level 1
Joined
Aug 25, 2011
Messages
2
Thank you, I gave you a rep up, but it didn't end up working. I'm not sure why, but I spent like two hours on trying to get it work, it still doesn't work.
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,243
It won't work since there's no picked player.

Either pick all players in All players or convert the loop integer into a player.


  • Untitled Trigger 002
    • Events
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) slot status) Not equal to Is playing
            • Then - Actions
            • Else - Actions
      • Custom script: == OR ==
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) slot status) Not equal to Is playing
            • Then - Actions
            • Else - Actions
 
Level 9
Joined
Apr 23, 2010
Messages
312
Oops, you are so right Maker. Here I fixed it :)
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) slot status) Equal to Is unused
            • Then - Actions
              • Unit Group - Pick every unit in (Units owned by (Player((Integer A)))) and do (Unit - Remove (Picked unit) from the game)
            • Else - Actions
      • Trigger - Turn off (This trigger)
Thanks for the +rep Rated-Ownage, it did go through :)
 
I'm pretty sure that your trigger leaks group handle. Furthermore, I'd say that if trigger doesn't cointain any waits we can even use DestroyTrigger() function instead of DisableTrigger().

  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Player((Integer A))) slot status) Equal to Is unused
          • Then - Actions
            • Custom script: set bj_wantDestroyGroup = true
            • Unit Group - Pick every unit in (Units owned by (Player((Integer A)))) and do (Unit - Remove (Picked unit) from the game)
          • Else - Actions
        • Custom script: call DestroyTrigger(GetTriggeringTrigger())
 
Status
Not open for further replies.
Top