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

Player Count

Status
Not open for further replies.
Level 11
Joined
Sep 12, 2008
Messages
657
2 options - 1 = gui, 2 = vjass.

gui:

  • Count Players
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • 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) controller) Equal to User) and (((Picked player) slot status) Equal to Is playing)
            • Then - Actions
              • Set AmountOfPlayers = (AmountOfPlayers + 1)
            • Else - Actions
vjass:

JASS:
function PlayerCount takes nothing returns nothing
    local integer AmountOfPlayers = 0
    local integer i = 0
    
    loop
    
    if GetPlayerSlotState(ConvertedPlayer((i))) == PLAYER_SLOT_STATE_PLAYING and ConvertedPlayer((i)) == MAP_CONTROL_USER then
        
        set AmountOfPlayers = AmountOfPlayers + 1
        
    endif
    
    set i = i + 1
    exitwhen i >= 11
    endloop
endfunction

edit:

  • Player Group - Pick every player in (All players matching (((Matching player) controller) Equal to User)) and do (Actions)
    • Loop - Actions
      • Set PlayerCount = ((PlayerCount)+1)
Hope it helps:)

that leaks.. sry.. ALL PLAYERS dont leak, but other then that.. its like a unit group, it leaks.
 
Level 7
Joined
Jun 8, 2010
Messages
283
How about the submenu? Go into the integer submenu you should scroll down on the functions list until you find something that says:

Game - Number of players

Not sure if this leaks though, havent tried it I just recently discovered it.
 
Status
Not open for further replies.
Top