• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Removing units if no one takes the spot?

Status
Not open for further replies.

Rated-Ownage

R

Rated-Ownage

Hi, I'd like to know how to make a trigger to remove a colour's units if someone doesn't take the spot in the game lobby, Thankss.
 
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)
 
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 by a moderator:
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
 
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.
Back
Top