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

[General] Empty Player Group check

Status
Not open for further replies.
Level 26
Joined
Aug 18, 2009
Messages
4,097
Set a boolean variable to false, iterate over the group of players, in the loop the boolean is set to true. After that ask for the state of the variable.

Of course, there are already functions. Integer function "Player - Count Players In Player Group" for example would give you the amount that you only need to compare to zero. It works the same way though, iterates over the force and increments an integer instead.
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
Make a loop trigger, in this trigger, u can set a variable to number of player in player group and make an if then else action with the condition is the above variable equal to zero. Like this:
  • Untitled Trigger 001
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set PlayerCount = (Number of players in tempPGroup)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PlayerCount Equal to 0
        • Then - Actions
          • ------Ur action here-------
        • Else - Actions
          • ------If the player group isnt empty, do these actions.
Note that the tempPgroup variable must be set before this trigger, which means u must create another trigger.
This is a easiest way but if u want, u can do WaterKnight way.
 

sentrywiz

S

sentrywiz

  • Untitled Trigger 001
    • Events
      • some random event
    • Conditions
      • (Number of players in (your_player_group_name)) Equal to 0
    • Actions
      • Do something
 
Status
Not open for further replies.
Top