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

Detecting unused slots

Status
Not open for further replies.
I have this trigger to kill all units of unused player slots, but it doesn't return 1. Why?
  • Kill Units
    • Events
      • Map initialization
    • 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
              • Game - Display to (All players) the text: 1
              • Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Actions)
                • Loop - Actions
                  • Unit - Kill (Picked unit)
            • Else - Actions
              • Game - Display to (All players) the text: 2
 
That's because the function (All Players) only contains playing user and computer players.
Since all the players in your loop is playing, the condition for your if-then-else can never be true.

Try this approach instead:
  • Kill Units
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer PlayerNumber) from 1 to ((Player number of Neutral Hostile) - 1), do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player(PlayerNumber)) slot status) Not equal to Is playing
            • Then - Actions
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units owned by (Player(PlayerNumber))) and do (Actions)
                • Loop - Actions
                  • Unit - Kill (Picked unit)
            • Else - Actions
 
How about you actually deep just a bit deeper and search for yourself instead of asking obvious questions which the answer is right in front of you? When you enconter an obstacle you should try to think it over for a while, not just instantly ask for help when you didn't even attempt to search.
  • (Player 1 (Red) slot status) Equal to Is unused
 
Thank you Illidan, I didn't know that about all players. :D


Wrda: I tried to used unused slots, it didn't work either. Maybe next time you should think over a while that I was thinking about it over a while and trying different things and none of them worked.
 
Wrda: I tried to used unused slots, it didn't work either. Maybe next time you should think over a while that I was thinking about it over a while and trying different things and none of them worked.
...What? It does work. Always post triggers of what you got from your attempts (or map if necessary) so that we have all relevant information to help, in this case you only posted one, so I clearly can't see "none of them worked" here, which was not enough.
 
Status
Not open for further replies.
Back
Top