• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Solved] Counting the number of human players

Status
Not open for further replies.
Level 10
Joined
Jun 6, 2007
Messages
392
I'm working on a hero siege, and I'm going to make a different number of creatures to spawn per wave depending on the number of players. How can I check how many human players there are? CheckPlayersByMapControl() also counts players that aren't actually playing, so It can't be used for this.
 
GUI:
  • Set PlayerAmount = (Number of players in (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing))))
JASS:
JASS:
loop
    exitwhen i == 16
    
    if GetPlayerController( Player(i) ) == MAP_CONTROL_USER and GetPlayerSlotState( Player(i)_) == PLAYER_SLOT_STATE_PLAYING then
        set playerAmount = playerAmount + 1
    endif
    set i = i + 1
endloop

Probably could've been done in a different way. Those should work though.

Edit: You shouldn't mind the player group in the GUI-form all that much. Yes, it's better to clean player groups, but 1 instance won't change anything.
 
Status
Not open for further replies.
Top