[Log in / Register]
| News | Chat | Pastebin | Donations | Tutorials | Rules | Forums |
| Maps | Skins | Icons | Models | Spells | Tools | Jass | Packs | Hosted Projects | Starcraft II Modding | Starcraft II Resources | Galaxy Wiki |
(Keeps Hive Alive)
Go Back   The Hive Workshop > Warcraft III Modding > World Editor Help Zone


World Editor Help Zone Ask general questions about World Editor features and use in this forum. If you need help fixing a trigger, please post it in Triggers & Scripts. Please review the forum rules before posting.

Closed Thread
 
Thread Tools
Old 08-09-2012, 04:11 PM   #1 (permalink)
Registered User Erkki2
User
 
Join Date: Jun 2007
Posts: 163
Erkki2 has little to show at this moment (58)
Counting the number of human players

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.
Erkki2 is offline  
Old 08-09-2012, 04:48 PM   #2 (permalink)
Registered User rulerofiron99
Ideas & Systems
 
rulerofiron99's Avatar
 
Join Date: Jul 2006
Posts: 2,104
rulerofiron99 is a glorious beacon of light (496)rulerofiron99 is a glorious beacon of light (496)rulerofiron99 is a glorious beacon of light (496)rulerofiron99 is a glorious beacon of light (496)
At map start, do this:

For each integer a from 1 to 12
Loop actions -
If (player[integer a] is controlled by a human) AND (player[integer a] is playing) are true,
then - set NumberOfPlayers = NumberOfPlayers + 1
rulerofiron99 is offline  
Old 08-09-2012, 04:51 PM   #3 (permalink)
Registered User ap0calypse
User
 
ap0calypse's Avatar
 
Join Date: Jan 2007
Posts: 5,000
ap0calypse has a brilliant future (1367)ap0calypse has a brilliant future (1367)ap0calypse has a brilliant future (1367)
Former Staff Member: This user used to be on the Hive Workshop staff. 
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.
__________________
ap0calypse is offline  
Old 08-09-2012, 05:56 PM   #4 (permalink)
Registered User Erkki2
User
 
Join Date: Jun 2007
Posts: 163
Erkki2 has little to show at this moment (58)
That works, thanks and +rep to both!
Erkki2 is offline  
Closed Thread

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 11:04 PM.





Powered by vBulletin
Copyright 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.5.1 PL2
Copyright © Ralle