Dear Hive,
I tried to produce a simple button-votting system for choosing a race in my map. There are 2 Teams a 5 Players. The first player of each team is the player who gets the starting units of the chosen race (so player 1 red and 6 orange). Now I need to know how to seperate the votes into the two teams, so that the trigger detects when a player of team 1 or team 2 casts a vote and adds this vote to the votes of the corresponding team and finally spawns the units of the voted race for the first player of each team (red and orange). I know its kinda convoluted, but maybe it gets clearer when I post the triggers down below. I had an first idea: Making a player group for each team and detecting in which of these groups the voting player is, tho I don't know if I did it the right way. Another question is, if I did the counting right. So if more than half of the team pick one race it gets picked and else a random race is chosen. (+ how could I add a timer to the voting process)
The Team Set Up:

I tried to produce a simple button-votting system for choosing a race in my map. There are 2 Teams a 5 Players. The first player of each team is the player who gets the starting units of the chosen race (so player 1 red and 6 orange). Now I need to know how to seperate the votes into the two teams, so that the trigger detects when a player of team 1 or team 2 casts a vote and adds this vote to the votes of the corresponding team and finally spawns the units of the voted race for the first player of each team (red and orange). I know its kinda convoluted, but maybe it gets clearer when I post the triggers down below. I had an first idea: Making a player group for each team and detecting in which of these groups the voting player is, tho I don't know if I did it the right way. Another question is, if I did the counting right. So if more than half of the team pick one race it gets picked and else a random race is chosen. (+ how could I add a timer to the voting process)
The Team Set Up:
-
Set Up Teams
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
Set VariableSet Team1[1] = Player Group - Player 1 (Red)
-
Set VariableSet Team1[2] = Player Group - Player 2 (Blue)
-
Set VariableSet Team1[3] = Player Group - Player 3 (Teal)
-
Set VariableSet Team1[4] = Player Group - Player 4 (Purple)
-
Set VariableSet Team1[5] = Player Group - Player 5 (Yellow)
-
Set VariableSet Team2[1] = Player Group - Player 6 (Orange)
-
Set VariableSet Team2[2] = Player Group - Player 7 (Green)
-
Set VariableSet Team2[3] = Player Group - Player 8 (Pink)
-
Set VariableSet Team2[4] = Player Group - Player 9 (Gray)
-
Set VariableSet Team2[5] = Player Group - Player 10 (Light Blue)
-
-
-
Set Up Races
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
Set VariableSet RaceSpawn[1] = Peasant
-
Set VariableSet RaceSpawn[2] = Peon
-
Set VariableSet RaceSpawn[3] = Acolyte
-
-
-
Set Up Vote
-
Events
-
Time - Elapsed game time is 2.00 seconds
-
-
Conditions
-
Actions
-
Dialog - Clear VoteOptions
-
Dialog - Change the title of VoteOptions to Choose your Race
-
Dialog - Create a dialog button for VoteOptions labelled Humans
-
Set VariableSet RaceOptions[1] = (Last created dialog Button)
-
Dialog - Create a dialog button for VoteOptions labelled Orcs
-
Set VariableSet RaceOptions[2] = (Last created dialog Button)
-
Dialog - Create a dialog button for VoteOptions labelled Undead
-
Set VariableSet RaceOptions[3] = (Last created dialog Button)
-
Player Group - Pick every player in (All players) and do (Actions)
-
Loop - Actions
-
Dialog - Show VoteOptions for (Picked player)
-
-
-
-
-
Do Vote Team 1
-
Events
-
Dialog - A dialog button is clicked for VoteOptions
-
-
Conditions
-
Actions
-
For each (Integer A) from 1 to 3, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Triggering player) is in Team1[(Integer A)].) Equal to True
-
(Clicked dialog button) Equal to RaceOptions[(Integer A)]
-
-
Then - Actions
-
Set VariableSet VoteCount_Team1[(Integer A)] = (VoteCount_Team1[(Integer A)] + 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
VoteCount_Team1[(Integer A)] Greater than 2
-
-
Then - Actions
-
Unit - Create 5 RaceSpawn[(Integer A)] for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
-
-
Else - Actions
-
Unit - Create 5 RaceSpawn[(Random integer number between 1 and 3)] for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
-
-
-
-
Else - Actions
-
-
-
-
-
-
Do Vote Team 2
-
Events
-
Dialog - A dialog button is clicked for VoteOptions
-
-
Conditions
-
Actions
-
For each (Integer A) from 1 to 3, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Triggering player) is in Team2[(Integer A)].) Equal to True
-
(Clicked dialog button) Equal to RaceOptions[(Integer A)]
-
-
Then - Actions
-
Set VariableSet VoteCount_Team2[(Integer A)] = (VoteCount_Team2[(Integer A)] + 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
VoteCount_Team2[(Integer A)] Greater than 2
-
-
Then - Actions
-
Unit - Create 5 RaceSpawn[(Integer A)] for Player 6 (Orange) at (Center of (Playable map area)) facing Default building facing degrees
-
-
Else - Actions
-
Unit - Create 5 RaceSpawn[(Random integer number between 1 and 3)] for Player 6 (Orange) at (Center of (Playable map area)) facing Default building facing degrees
-
-
-
-
Else - Actions
-
-
-
-
-
Last edited: