• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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