SC2Mapster Forums

Development > Triggers

[Solved] Detecting how many players started the game ?

  • 4 posts
    #1 Nov 19, 2012 at 03:46 UTC - 0 likes

    Hey all, looking for a trigger to detect how many players are playing in a custom game at the start of a match (i.e how many were in the lobby) so I can set up buildings for each player playing and not just for every available player slot. Cheers

    #2 Nov 19, 2012 at 04:26 UTC - 0 likes

    @Skobe: Go

    the built in function "all players" returns a player group with all players. Run it on map initialization and store the result if you need to refer to it later.

    as an example usage:

    int i;
    for each i in player group (all players)
         create command centre for player i
    
    #3 Nov 19, 2012 at 05:11 UTC - 0 likes

    @finiteturtles: Go

    In addition to this:

    I suggest you use things like comparisons of the "player state" to see if it matches "human" and "active". There are other states too that you could use. This means that you would push a if-then-else action into the for-loop. The player number is given to the players according to the order in which they enter the game lobby. Its not according to how they appear in the player lobby list. To see which team a player belongs to you should use a switch statement and go through each player/team combination using the function... hm forgot its name.. but its something like comparison(gameLobbyTeamHasPlayer(1,2) = true) where 1 is the player number and 2 is the team.

    good luck!

    #4 Nov 25, 2012 at 02:40 UTC - 0 likes

    Thanks heaps guys, much appreciated

  • 4 posts

You must login to post a comment. Don't have an account? Register to get one!