Hi ,
First, i've used the search option of the forum and i found a couple of answer but unfortunately, i couldn't get them to work, most of them are from the beta so something could have changed :/
I would like to know how i can check the number of player currently in a game, by playergroup. I would use that for autobalancing teams and display a message when someone leaves.
I've tryed "for each player in player group blablabal with conditions used and playing" and i keep getting 15 as an anwser even if the player is 8 player max and im alone in the game.
I'm not sure @ Active PLayers, I don't trust it. But if it does what my code does, then great, use that.
I would say, write a function. But if you're only checking this once,
numPlayers
Events
Local Variables
PlayerIndex = 0 <Integer>
numPlayers = 0 <Integer>
Conditions
Actions
Player Group - For each player PlayerIndex in (All players) do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Status of player PlayerIndex) != Unused
Then
Variable - Modify numPlayers: + 1
Else
numPlayers after this will hold number of players.
This would include players who left the game. Use ((Status of player PlayerIndex) == Playing) to only get players playing the game.
To see if a player is AI controlled or neutral, use Controller of Player checks).
Also, instead of having it check each to minutes, rather set a trigger to modify the numPlayers each time someone leaves.
Of course, that makes numPlayers needing to be a global.
Maybe not necessary, but I try to keep triggers to fire as rarely as often, since suddenly you have 30 triggers, and it's never good to have them constantly annoy the game.
In case you're a complete beginner like me, here's a part of my trigger :
QUITTER!
Events
Player - Player Any Player leaves the game with Any
Actions
Variable - Modify %numplayers%: - 1
( why do I use the un-needed % ? because I like it that way xD )
Hi , First, i've used the search option of the forum and i found a couple of answer but unfortunately, i couldn't get them to work, most of them are from the beta so something could have changed :/
I would like to know how i can check the number of player currently in a game, by playergroup. I would use that for autobalancing teams and display a message when someone leaves.
I've tryed "for each player in player group blablabal with conditions used and playing" and i keep getting 15 as an anwser even if the player is 8 player max and im alone in the game.
Anyone could write me a little action for that ?
thank a alot.
use the function number of players in playergroup, and then choose active players.
@Gaurus: Go
what determine if a player is active ? my player doesn't have any units yet
I'm not sure @ Active PLayers, I don't trust it. But if it does what my code does, then great, use that.
I would say, write a function. But if you're only checking this once,
numPlayers
Events
Local Variables
PlayerIndex = 0 <Integer>
numPlayers = 0 <Integer>
Conditions
Actions
Player Group - For each player PlayerIndex in (All players) do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Status of player PlayerIndex) != Unused
Then
Variable - Modify numPlayers: + 1
Else
numPlayers after this will hold number of players.
This would include players who left the game. Use ((Status of player PlayerIndex) == Playing) to only get players playing the game.
To see if a player is AI controlled or neutral, use Controller of Player checks).
Also, instead of having it check each to minutes, rather set a trigger to modify the numPlayers each time someone leaves. Of course, that makes numPlayers needing to be a global. Maybe not necessary, but I try to keep triggers to fire as rarely as often, since suddenly you have 30 triggers, and it's never good to have them constantly annoy the game. In case you're a complete beginner like me, here's a part of my trigger :
QUITTER!
Events
Player - Player Any Player leaves the game with Any
Actions
Variable - Modify %numplayers%: - 1
( why do I use the un-needed % ? because I like it that way xD )