Hi,
I want to make an event which does something for each player. Well there is "for each player in player group" and "pick each player group" or more general "for each integer". But how do I get the total number of players who are playing?
I am not sure, but probably not. You could count up the number of human players at the start and save that to a variable.
Events
Game - Map initialization
Local Variables
currentPlayer = 0 <Integer>
Conditions
Actions
Variable - Set PlayerCount = (Number of players in (All players))
Player Group - For each player currentPlayer in (All players) do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
(Controller of player (Picked player)) == User
(Status of player (Picked player)) == Playing
Then
Variable - Modify PlayerCount: + 1
Else
You would also need to create a trigger to decrement the PlayerCount when a player leaves the game.
Hi, I want to make an event which does something for each player. Well there is "for each player in player group" and "pick each player group" or more general "for each integer". But how do I get the total number of players who are playing?
thank you
Under player group there is a function "Number of Players in Player Group" use that and set the group to be All Players or Active Players.
@SirLyrrad: Go
Does All Players or Active Players exclude CPU players?
I am not sure, but probably not. You could count up the number of human players at the start and save that to a variable.
Events
Game - Map initialization
Local Variables
currentPlayer = 0 <Integer>
Conditions
Actions
Variable - Set PlayerCount = (Number of players in (All players))
Player Group - For each player currentPlayer in (All players) do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
(Controller of player (Picked player)) == User
(Status of player (Picked player)) == Playing
Then
Variable - Modify PlayerCount: + 1
Else
You would also need to create a trigger to decrement the PlayerCount when a player leaves the game.
i beleive active players still incorporates computer players. but his trigger should work just fine. just answering the question from above.
Thanks a lot!