• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Game Mode Voting System (+Rep)

Status
Not open for further replies.
Level 7
Joined
Jun 8, 2010
Messages
283
In my map, the host is allowed to select the type of game mode through a dialog window and from there the game is selected.

I would like to provide fail-safe triggers for the game type selection system. If the host does not select a game mode within 10 seconds, then the system will automatically run the trigger to allow All players to vote for a game type within a given 10 seconds. The most votes selected for one particular mode will run that game mode. If no votes are accounted for within the allotted 10 seconds for the "All Player" voting interval, then the game will randomly select a mode.

Here is my triggers that I currently have. Its a rough set of triggers however. itd be best if you just create a voting game mode dialog system in a map and upload it so i can adjust accordingly:
  • create dialog
    • Events
      • Time - Elapsed game time is 6.50 seconds
    • Conditions
    • Actions
      • Dialog - Change the title of dialogwindow to Please Select a Gam...
      • Dialog - Create a dialog button for dialogwindow labelled Squad
      • Set dialogbutton[1] = (Last created dialog Button)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in team_human) Greater than 1
        • Then - Actions
          • Dialog - Create a dialog button for dialogwindow labelled Infection
          • Set dialogbutton[2] = (Last created dialog Button)
        • Else - Actions
      • -------- Survival of the Fittest Button [3] --------
      • Dialog - Create a dialog button for dialogwindow labelled Allow Player Voting
      • Set dialogbutton[4] = (Last created dialog Button)
      • Game - Display to (All players) for 10.00 seconds the text: (Your Host for today is + (Name of Host))
  • load map
    • Events
      • Time - Elapsed game time is 10.00 seconds
    • Conditions
    • Actions
      • Game - Display to (All players) for 5.00 seconds the text: (Please wait 10 seconds while + ((Name of Host) + selects the game mode...))
      • Cinematic - Enable user control for (All players)
      • Dialog - Show dialogwindow for Host
  • squadron game mode 1
    • Events
      • Dialog - A dialog button is clicked for dialogwindow
    • Conditions
      • (Clicked dialog button) Equal to dialogbutton[1]
    • Actions
      • Game - Display to (All players) for 10.00 seconds the text: ((Name of Host) + has selected Squad Mode)
      • Unit Group - Pick every unit in team_human and do (Actions)
        • Loop - Actions
          • Unit - Move (Picked unit) instantly to (Random point in start squad mode 1 <gen>), facing Default building facing degrees
      • Game - Display to (All players) the text: (Humans: + (String((Number of players in playergroup_hu))))
      • Game - Display to (All players) the text: (Zombies: + (String((Number of players in playergroup_zo))))
      • Cinematic - Fade in over 5.00 seconds using texture Black Mask and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Camera - Lock camera target for (Player((Player number of (Picked player)))) to PlayersHero[(Player number of (Picked player))], offset by (0.00, 0.00) using Default rotation
          • Set CurrentCamera[(Player number of (Picked player))] = 2
  • infection game mode window 2 squad
    • Events
      • Dialog - A dialog button is clicked for dialogwindow
    • Conditions
      • (Clicked dialog button) Equal to dialogbutton[2]
    • Actions
      • Dialog - Hide dialogwindow for Host
      • Dialog - Clear dialogwindow
      • Dialog - Change the title of dialogwindow to Infection: Please S...
      • Dialog - Create a dialog button for dialogwindow labelled One Zombie
      • Set dialogbutton[5] = (Last created dialog Button)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in team_human) Greater than 3
        • Then - Actions
          • Dialog - Create a dialog button for dialogwindow labelled Two Zombies
          • Set dialogbutton[6] = (Last created dialog Button)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in team_human) Greater than 4
        • Then - Actions
          • Dialog - Create a dialog button for dialogwindow labelled Three Zombies
          • Set dialogbutton[7] = (Last created dialog Button)
        • Else - Actions
      • Dialog - Show dialogwindow for Host
  • infection one zombie
    • Events
      • Dialog - A dialog button is clicked for dialogwindow
    • Conditions
      • (Clicked dialog button) Equal to dialogbutton[5]
    • Actions
      • Game - Display to (All players) for 10.00 seconds the text: ((Name of Host) + has selected Infection Mode beginning with One Player Zombie)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • Set zombie_num = (Player number of (Random player from playergroup_hu))
          • Unit Group - Remove PlayersHero[zombie_num] from team_human
          • Unit - Remove PlayersHero[zombie_num] from the game
          • Unit - Create 1 Zombie (Hooked Flesh) for (Player(zombie_num)) at (Center of start squad mode 1 <gen>) facing Default building facing degrees
          • Set zombie_tselect[zombie_num] = (Last created unit)
          • Set PlayersHero[zombie_num] = zombie_tselect[zombie_num]
          • Camera - Lock camera target for (Player(zombie_num)) to PlayersHero[zombie_num], offset by (0.00, 0.00) using Default rotation
          • Unit Group - Add zombie_tselect[zombie_num] to team_zombie
          • Player Group - Remove (Owner of zombie_tselect[zombie_num]) from playergroup_hu
          • Player Group - Add (Owner of zombie_tselect[zombie_num]) to playergroup_zo
          • Player Group - Make playergroup_hu treat playergroup_zo as an Enemy
          • Player Group - Make playergroup_zo treat playergroup_hu as an Enemy
          • Player Group - Make playergroup_zo treat Player Group - Neutral Hostile as an Ally
          • Player Group - Make Player Group - Neutral Hostile treat playergroup_zo as an Ally
        • Else - Actions
      • Unit Group - Pick every unit in team_human and do (Actions)
        • Loop - Actions
          • Unit - Move (Picked unit) instantly to (Random point in start squad mode 1 <gen>), facing Default building facing degrees
      • Cinematic - Fade in over 5.00 seconds using texture Black Mask and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
      • Game - Display to (All players) the text: (Humans: + (String((Number of players in playergroup_hu))))
      • Game - Display to (All players) the text: (Zombies: + (String((Number of players in playergroup_zo))))
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Camera - Lock camera target for (Player((Player number of (Picked player)))) to PlayersHero[(Player number of (Picked player))], offset by (0.00, 0.00) using Default rotation
          • Set CurrentCamera[(Player number of (Picked player))] = 2
  • allow player voting 4
    • Events
      • Dialog - A dialog button is clicked for dialogwindow
    • Conditions
      • (Clicked dialog button) Equal to dialogbutton[4]
    • Actions
      • Game - Display to (All players) for 10.00 seconds the text: ((Name of Host) + has enabled player voting for a game mode.)
      • Dialog - Clear dialogwindow
      • Dialog - Change the title of dialogwindow to Vote for a Game Mod...
      • Dialog - Create a dialog button for dialogwindow labelled Squad
      • Set dialogbutton[1] = (Last created dialog Button)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in team_human) Greater than 1
        • Then - Actions
          • Dialog - Create a dialog button for dialogwindow labelled Infection
          • Set dialogbutton[2] = (Last created dialog Button)
        • Else - Actions
      • -------- Survival of the Fittest Button [3] --------
      • Dialog - Show dialogwindow for Player 1 (Red)
      • Dialog - Show dialogwindow for Player 2 (Blue)
      • Dialog - Show dialogwindow for Player 3 (Teal)
      • Dialog - Show dialogwindow for Player 4 (Purple)
      • Dialog - Show dialogwindow for Player 5 (Yellow)
      • Dialog - Show dialogwindow for Player 6 (Orange)
      • Dialog - Show dialogwindow for Player 7 (Green)
      • Dialog - Show dialogwindow for Player 8 (Pink)
      • Dialog - Show dialogwindow for Player 9 (Gray)
      • Dialog - Show dialogwindow for Player 10 (Light Blue)
      • Dialog - Show dialogwindow for Player 11 (Dark Green)
      • Dialog - Show dialogwindow for Player 12 (Brown)
      • Trigger - Turn on player vote count <gen>
      • Cinematic - Fade in over 5.00 seconds using texture Black Mask and color (100.00%, 100.00%, 100.00%) with 0.00% transparency
  • player vote count
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • vA[1] Equal to (Number of players in (All players controlled by a User player))
              • vA[2] Equal to (Number of players in (All players controlled by a User player))
        • Then - Actions
          • Trigger - Turn on vote count <gen>
          • Trigger - Turn off player vote count <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to dialogbutton[1]
        • Then - Actions
          • Set vA[1] = (vA[1] + 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to dialogbutton[2]
        • Then - Actions
          • Set vA[2] = (vA[2] + 1)
        • Else - Actions
  • vote count
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • vA[1] Greater than vA[2]
        • Then - Actions
          • Set game_mode = Squadron
        • Else - Actions
          • Set game_mode = Infection
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • vA[1] Greater than vA[2]
        • Then - Actions
          • Set game_mode = Squadron
        • Else - Actions
          • Set game_mode = Infection
      • Game - Display to (All players) for 10.00 seconds the text: (Majority of player votes have selected + game_mode)
Reward: +Rep
 
Level 7
Joined
Jun 8, 2010
Messages
283
Working on it right now. Im almost done but with your example, it is only a 2 option voting system: Yes or No.

The voting system I need displays game modes in one window and needs to calculate which one had the most votes via
  • set integer x = [(integer x) + 1]
How do I setup a condition like this but instead checks if let say One option is greater than any of the other options?
  • vk_yes Greater than vk_no
 
Level 5
Joined
Jan 4, 2007
Messages
103
Try this, a bit comlicated if it is what you want:

First Trigger
  • Events
    • Time - Elapsed game time is 10.00 seconds
  • Conditions
  • Actions
    • Set IntegerH(Main Integer) = Integer9(The Last Integer of yours)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • IntegerH Greater than or Equal to Integer8
      • Then - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • IntegerH Greater than or Equal to Integer7
          • Then - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • IntegerH Greater than or Equal to Integer6
              • Then - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • IntegerH Greater than or Equal to Integer5
                  • Then - Actions
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • IntegerH Greater than or Equal to Integer4
                      • Then - Actions
                      • ect.
                      • Else - Actions
                        • Set IntegerH = Integer4
                        • Trigger - Run Trigger 2
                  • Else - Actions
                    • Set IntegerH = Integer5
                    • Trigger - Run Trigger 2
              • Else - Actions
                • Set IntegerH = Integer6
                • Trigger - Run Trigger 2
          • Else - Actions
            • Set IntegerH = Integer7
            • Trigger - Run Trigger 2
      • Else - Actions
        • Set IntegerH = Integer8
        • Trigger - Run Trigger 2
The Second Trigger is like the First one just has no event or the first Set Variable:
  • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IntegerH Greater than or Equal to Integer8
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IntegerH Greater than or Equal to Integer7
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IntegerH Greater than or Equal to Integer6
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • IntegerH Greater than or Equal to Integer5
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • IntegerH Greater than or Equal to Integer4
                        • Then - Actions
                        • ect.
                        • Else - Actions
                          • Set IntegerH = Integer4
                          • Trigger - Run Trigger 2
                    • Else - Actions
                      • Set IntegerH = Integer5
                      • Trigger - Run Trigger 2
                • Else - Actions
                  • Set IntegerH = Integer6
                  • Trigger - Run Trigger 2
            • Else - Actions
              • Set IntegerH = Integer7
              • Trigger - Run Trigger 2
        • Else - Actions
          • Set IntegerH = Integer8
          • Trigger - Run Trigger 2
The IntegerH is the Integer which is the highest, your last at the begining, while Integer1-9 or how many do you have are your Integers for the votes. Hope it helps:)
 
Level 13
Joined
Mar 24, 2010
Messages
950
oh u can do a loop check

try this out
  • Take Vote Tally 5
    • Events
    • Conditions
    • Actions
      • Trigger - Turn off Play CTF <gen>
      • Set CTF_Points_Cap = 0
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Vote_Count[(Integer A)] Greater than CTF_Points_Cap
            • Then - Actions
              • Set CTF_Points_Cap = Vote_Count[(Integer A)]
              • Set Temp_Integer = (Integer A)
            • Else - Actions
      • Set CTF_Points_Cap = Vote_Count[(Temp_Integer + 5)]
      • Game - Display to (All players) for 20.00 seconds the text: (|c00FF0000Majority Voted|r |c00FFCC00 + ((String(CTF_Points_Cap)) + |r |c00FF0000points for the Win!|r))
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • Set Vote_Count[(Integer A)] = 0
      • Game - Display to (All players) for 25.00 seconds the text: |cffFF1100*********...
also a lot of your other triggers could be cleaned up a bit and shrunk down for example where u have show next thing to player and again for 2 and 3 etc.
just make a loop 1-12 and show it to player intA :)
 
Level 7
Joined
Jun 8, 2010
Messages
283
Alright, implementing them. The triggers posted are several hours old and Ive completely revampled it. Im planning on creating a voting dialog system with an implementation of a leader board to display tallys.

@Bond009 Im not sure how that would help me check for the conditions of multiple options in a vote.
@The_DooM thats something relatively close to what I was looking for in the conditionals. That helped a bit though. Is there a way to loop checks like what Bond009 has claimed?

Here is the new vote checks trigger adapting to both posted examples.

In this example there are 5 polls. We will have 4 main triggers. One in Map Initiation where the game modes are set, another where the polls are voted and accounted for, another to check votes and another to trigger the game mode.

This is a generic example that has been simplified and fully recreated. What do you guys think?
  • Initiate Timer and leader board
    • Events
      • Time - Elapsed game time is 2.00 seconds
    • Conditions
    • Actions
      • Countdown Timer - Start mode_timer as a One-shot timer that will expire in 10.00 seconds
      • Game - Display to (All players) for 10.00 seconds the text: (Players have 10 seconds to vote for a game mode)
      • Trigger - Turn on add Game Mode 1 vote <gen>
      • Trigger - Turn on Kick <gen>
      • Leaderboard - Create a leaderboard for (All players) titled (Game Mode Votes:)
      • Set game_lb = (Last created leaderboard)
      • Leaderboard - Show (Last created leaderboard)
      • For each (Integer gamemode_int) from 1 to 5, do (Actions)
        • Loop - Actions
          • Leaderboard - Add (Player(gamemode_int)) to (Last created leaderboard) with label (Game Mode (gamemode_int): + (String(vote_count[gamemode_int]))) and value 0
          • Leaderboard - Change the color of the label for (Player(gamemode_int)) in (Last created leaderboard) to (100.00%, 100.00%, 100.00%) with 0.00% transparency
          • Leaderboard - Change the display style for (Player(gamemode_int)) in (Last created leaderboard) to Show the label, Hide the value, and Hide the icon
      • Trigger - Turn on add Game Mode 1 vote <gen>
      • Trigger - Turn on add Game Mode 2 vote <gen>
      • Trigger - Turn on add Game Mode 3 vote <gen>
      • Trigger - Turn on add Game Mode 4 vote <gen>
      • Trigger - Turn on add Game Mode 5 vote <gen>
  • add Game Mode 1 vote
    • Events
      • Dialog - A dialog button is clicked for dialogwindow
    • Conditions
      • (Clicked dialog button) Equal to dialogbutton[1]
    • Actions
      • Set vote_count[1] = (vote_count[1] + 1)
  • check votes
    • Events
      • Time - mode_timer expires
    • Conditions
    • Actions
      • For each (Integer poll_num) from 1 to 5, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • vote_count[1] Greater than vote_count[poll_num]
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                • Then - Actions
                  • Game - Display to (All players) for 10.00 seconds the text: Game Mode 1 Selected
                • Else - Actions
                  • Set gamemode_int = 1
                  • Trigger - Turn on Game Mode 1 <gen>
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • vote_count[1] Equal to vote_count[poll_num]
                • Then - Actions
                  • Set gamemode_int = (Random integer number between 1 and 5)
                • Else - Actions
 
Last edited:
Level 13
Joined
Mar 24, 2010
Messages
950
lol dude trust me, this is exactly what you need.

ill help you more and even take it a step further for you :)

in your "Initiate Timer and leader board" do not turn on those 5 trig's at the bottom just have it all be 1, this is what it will look like:
  • CTF Button Points
    • Events
      • Dialog - A dialog button is clicked for Dialog_CTF
    • Conditions
    • Actions
      • Dialog - Hide Dialog_CTF for (Triggering player)
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to dialogbutton[(Integer A)]
            • Then - Actions
              • Game - Display to (All players) for 7.00 seconds the text: (Voted + Dialog_CTF_Strings[(Integer A)])
              • Set Vote_Count[(Integer A)] = (Vote_Count[(Integer A)] + 1)
            • Else - Actions
You can take out that game display message to all if you dont need/want that part.


btw you dont have a condition in your check votes trigger in your 2nd if-then-else

  • Take Vote Tally 5
    • Events
    • Conditions
    • Actions
      • Trigger - Turn off Play CTF <gen>
      • Set temp_Points = 0
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Vote_Count[(Integer A)] Greater than temp_Points
            • Then - Actions
              • Set temp_Points = Vote_Count[(Integer A)]
              • Set Temp_Integer = (Integer A)
            • Else - Actions
      • Set temp_Points = Vote_Count[(Temp_Integer + 5)]
      • Game - Display to (All players) for 20.00 seconds the text: (|c00FF0000Majority Voted|r |c00FFCC00 + ((String(CTF_Points_Cap)) + |r |c00FF0000points for the Win!|r))
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Set Vote_Count[(Integer A)] = 0
      • Game - Display to (All players) for 25.00 seconds the text: |cffFF1100*********...
now let me explain why i do some of these things and show u how to edit and change them to fit you.

i have kill/points required to end the game and i set that number in Vote_Count[6-10] thats why i add 5 to Vote_Count[1-5] when i store it to Temp_integer so when im showing Temp_integer +5 thats taking the array value of 1 lets say and adding 5 to give 6 which has my kills required for that game mode. If you dont need that part you can just leave that out.

temp_Points is the thing you are interested in to tell you what number 1-5 got the most votes and what that value of votes is.
Temp_Integer is what is storing that array value so this way you know both the highest votes gotten And you know what array value it was.

so if you want to do
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Temp_Integer Equal to 1
    • Then - Actions
      • Trigger - Run (your trigger) (checking conditions)
    • Else - Actions
and so on for each int array, you see now?

If you wanted to be even More efficient you can use a variable to store those 5 different Mode triggers so then you can do another loop like this.

  • For each (Integer A) from 1 to 5, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Temp_Integer Equal [(Integer A)]
        • Then - Actions
          • Trigger - Run (Your trigger Variable[(Integer A)]) (checking conditions)
        • Else - Actions
 
Last edited:
Level 5
Joined
Jan 4, 2007
Messages
103
@The_DooM thats something relatively close to what I was looking for in the conditionals. That helped a bit though. Is there a way to loop checks like what Bond009 has claimed?

Hm...try this:

  • Events
    • Time - Elapsed game time is 10.00 seconds
  • Conditions
  • Actions
    • Set IntegerH = Integer9
    • For each (Integer A) from 8 to 1, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • IntegerH Greater than or equal to Integer[Integer A]
          • Then - Actions
            • Set IntegerH = Integer9
          • Else - Actions
            • Set IntegerH = Integer[Integer A]
            • Trigger - Run Trigger 2
            • Skip remaining actions
Then the second one without the Set Variable and Event:

  • Events
  • Conditions
  • Actions
    • For each (Integer A) from 8 to 1, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • IntegerH Greater than or equal to Integer[Integer A]
          • Then - Actions
            • Set IntegerH = Integer9
          • Else - Actions
            • Set IntegerH = Integer[Integer A]
            • Trigger - Run Trigger 2
            • Skip remaining actions
If the Integer A from 8 to 1 doesn't work, put from 2 to 9(or to how many Integers you have) and put Set IntegerH=Integer1 in the first trigger. Hope it helps:)
 
Level 7
Joined
Jun 8, 2010
Messages
283
Okay well most are done. I still dont get how to check for multiple vote tallys. Also how do I add things to the leaderboard without it needing to add a particular player. I cant seem to add a player on there more than once which is a pain for both single and multiplayer maps.

Right now in my example I have 4 options: Easy Medium Hard or Random
  • For each (Integer gamemode_num) from 1 to 4, do (Actions)
    • Loop - Actions
      • Leaderboard - Add (Player(player_num)) to mode_lb with label ((string_label[gamemode_num] + :) + (String(vote_count[gamemode_num]))) and value 0
Lets say if Player 1 (Red) is use, then Option 1 (Easy) will show up on the leader board however if Player 2 (Blue) Slot is not in use then Option 2 (Medium) does not show up and so forth.
 
Level 13
Joined
Mar 24, 2010
Messages
950
So my vote tally trigger above there is how you check for multiple vote tallys.
Are you talking about having 1 option where ppl take a vote on 5 things and then a new one comes right after and vote again on 5 things? what do you mean by multiple vote tallys.

also is this a 4 player map becuz your only adding 4 players to that leaderboard, and your only allowed to show 1 leaderboard at a time in a game.

i think i'd have to see your whole picture here of what your trying to do now with this.
 
Level 5
Joined
Jan 4, 2007
Messages
103
Okay well most are done. I still dont get how to check for multiple vote tallys. Also how do I add things to the leaderboard without it needing to add a particular player. I cant seem to add a player on there more than once which is a pain for both single and multiplayer maps.

Right now in my example I have 4 options: Easy Medium Hard or Random
  • For each (Integer gamemode_num) from 1 to 4, do (Actions)
    • Loop - Actions
      • Leaderboard - Add (Player(player_num)) to mode_lb with label ((string_label[gamemode_num] + :) + (String(vote_count[gamemode_num]))) and value 0
Lets say if Player 1 (Red) is use, then Option 1 (Easy) will show up on the leader board however if Player 2 (Blue) Slot is not in use then Option 2 (Medium) does not show up and so forth.

Well if you only use 4 player then you can duplicate it. A leaderboard can have 1 position per player and the max of 12 Players. You could either change the label of the player when he chooses a mode, Player1(Easy) or add duplicate player, add Player 1 to Player 1, add Player 2 to Player 2 ect. and then add Player1Mode to Player6, add Player2Mode to Player7 ect. Hope it helps:)
 
Level 7
Joined
Jun 8, 2010
Messages
283
Well I fixed the problem, instead of a Leaderboard I adapted to a Multiboard and it made things much easier.

As for the tallys what I mean is that lets say we have 3 different modes:

1. Easy
2. Medium
3. Hard

If 2 people vote for Medium and 1 person votes for Easy and 1 for Hard, then the game will run on the Setting Medium since it has the highest vote.

If there is a tie such as 2 for Medium and 2 for Easy, then then we would run a trigger than would randomly select one of the two and run on that setting.

For my map I have something like a zombie survival thing. Here is an example for 3 modes:

1. Normal (Every player is human)
2. Infection (A Number of Players start as a zombie)
3. Random (Randomly selects options 1 or 2)

If normal is the highest tally count, then the game will automatically begin with triggers that run with the Normal Settings.
If Infection is the highest tally count, then the game will run the second set of dialog triggers asking for how many players begin as zombies resting tally counts again as well as multiboard with the options of:
1. One Zombie
2. Two Zombies
3. Three Zombies
4. Random

Then we would do the voting system again.
Highest = game will run on that setting
Tie = randomly select the tied selections
Random - randomly selects one of the first 3 selections

***If no one votes during the 10 second vote timers, then we would run a trigger that would randomly select the entire game.

I hope this clears everything up. Im almost done with the system Im just making it universal for everyone (single and multiplayer) as well as providing flexibility to it for people like me and Bond009,
 
Level 13
Joined
Mar 24, 2010
Messages
950
lol dude trust me, this is exactly what you need.

ill help you more and even take it a step further for you :)

in your "Initiate Timer and leader board" do not turn on those 5 trig's at the bottom just have it all be 1, this is what it will look like:
  • CTF Button Points
    • Events
      • Dialog - A dialog button is clicked for Dialog_CTF
    • Conditions
    • Actions
      • Dialog - Hide Dialog_CTF for (Triggering player)
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to dialogbutton[(Integer A)]
            • Then - Actions
              • Game - Display to (All players) for 7.00 seconds the text: (Voted + Dialog_CTF_Strings[(Integer A)])
              • Set Vote_Count[(Integer A)] = (Vote_Count[(Integer A)] + 1)
            • Else - Actions
You can take out that game display message to all if you dont need/want that part.


btw you dont have a condition in your check votes trigger in your 2nd if-then-else

  • Take Vote Tally 5
    • Events
    • Conditions
    • Actions
      • Trigger - Turn off Play CTF <gen>
      • Set temp_Points = 0
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Vote_Count[(Integer A)] Greater than temp_Points
            • Then - Actions
              • Set temp_Points = Vote_Count[(Integer A)]
              • Set Temp_Integer = (Integer A)
            • Else - Actions
      • Set temp_Points = Vote_Count[(Temp_Integer + 5)]
      • Game - Display to (All players) for 20.00 seconds the text: (|c00FF0000Majority Voted|r |c00FFCC00 + ((String(CTF_Points_Cap)) + |r |c00FF0000points for the Win!|r))
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Set Vote_Count[(Integer A)] = 0
      • Game - Display to (All players) for 25.00 seconds the text: |cffFF1100*********...
now let me explain why i do some of these things and show u how to edit and change them to fit you.

i have kill/points required to end the game and i set that number in Vote_Count[6-10] thats why i add 5 to Vote_Count[1-5] when i store it to Temp_integer so when im showing Temp_integer +5 thats taking the array value of 1 lets say and adding 5 to give 6 which has my kills required for that game mode. If you dont need that part you can just leave that out.

temp_Points is the thing you are interested in to tell you what number 1-5 got the most votes and what that value of votes is.
Temp_Integer is what is storing that array value so this way you know both the highest votes gotten And you know what array value it was.

so if you want to do
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Temp_Integer Equal to 1
    • Then - Actions
      • Trigger - Run (your trigger) (checking conditions)
    • Else - Actions
and so on for each int array, you see now?

If you wanted to be even More efficient you can use a variable to store those 5 different Mode triggers so then you can do another loop like this.

  • For each (Integer A) from 1 to 5, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Temp_Integer Equal [(Integer A)]
        • Then - Actions
          • Trigger - Run (Your trigger Variable[(Integer A)]) (checking conditions)
        • Else - Actions

Just follow that it will work for what you want but instead of 1-5 use 1-3 vote options. If i have to make u a demo map i can but i dont really have time :/

  • CTF Button Points
    • Events
      • Dialog - A dialog button is clicked for Dialog_CTF
    • Conditions
    • Actions
      • Dialog - Hide Dialog_CTF for (Triggering player)
      • 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
              • (Clicked dialog button) Equal to dialogbutton[(Integer A)]
            • Then - Actions
              • Game - Display to (All players) for 7.00 seconds the text: (Voted + Dialog_CTF_Strings[(Integer A)])
              • Set Vote_Count[(Integer A)] = (Vote_Count[(Integer A)] + 1)
            • Else - Actions
for this just set up each button as dialogbutton[1] for easy and next dialogbutton[2] for medium etc.. in the initialization.
Set Dialog_CTF_Strings[1] = Easy and Dialog_CTF_Strings[2] = Medium etc...



  • Take Vote Tally 5
    • Events
    • Conditions
    • Actions
      • Trigger - Turn off Play CTF <gen>
      • Set temp_Points = 0
      • 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
              • Vote_Count[(Integer A)] Greater than temp_Points
            • Then - Actions
              • Set temp_Points = Vote_Count[(Integer A)]
              • Set Temp_Integer = (Integer A)
            • Else - 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
              • Temp_Integer Equal [(Integer A)]
            • Then - Actions
              • Trigger - Run (TriggerVariable[(Integer A)]) (checking conditions)
            • Else - Actions
And your set :D trust me..

Just set your 3 triggers that run each mode "easy" "Med" and "hard" as:
TriggerVariable[1]= Easy trigger
TriggerVariable[2]= Med trigger
TriggerVariable[3]= Hard trigger

this will then run the correct trigger mode you want :thumbs_up:
 
Level 7
Joined
Jun 8, 2010
Messages
283
True but im on my iphone and i dont think i can upload the map hah, also I havent had the chance to chabge my website settings to allow guests to download and comment, ill change that though when i do grt the time, just notify me when you find the issue so i can update the system and make some final changes.
 
Level 7
Joined
Jun 8, 2010
Messages
283
I forgot exactly where it glitches... but have you stress tested it and also used the debug using Esc?

I believe if you input something like a values on every mode except one and a tie between two.. itll take the one with the zero rather than randomly selected the tied tally votes.

ex.
easy - 1 vote
medium -1 vote
hard - 0vote

itll select hard when its supposed to randomly select easy or medium
 
Level 13
Joined
Mar 24, 2010
Messages
950
i checked it, it seems fine to me. Also it doesnt randomly pick one if theres a tie it will always pick the lowest one aka easiest which i think is probably a good thing if theres a tie.
or you can make it random if ya want..
 
Level 13
Joined
Mar 24, 2010
Messages
950
it would be easy just compare that highest value with the other ones again in a loop like i showed you before and then if temp_int = intA store intA to another var and do a random math function or something to give each of them a 50% chance,
 
Level 13
Joined
Mar 24, 2010
Messages
950
after the first loop add this
  • 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
          • Vote_Count[(Integer A)] equal to temp_Points
        • Then - Actions
          • Set Temp_Int = (Random integer number between 1 and 2)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Temp_Int Equal to 1
          • Then - Actions
            • Set temp_Points = Vote_Count[(Integer A)]
          • Else - Actions
        • Else - Actions
somethin like that will make it 50% chance for ya
 
Level 7
Joined
Jun 8, 2010
Messages
283
When I set that up, yours only seemed to select only the highest tied option.

Easy 1
Medium 1
Hard 0
In this case your trigger would select Easy as it is at the top of the tied options.


easy 0
Medium 1
Hard 1
In this case your trigger would select Medium as it is at the top of the tied options.


I have tried to create my own trigger, except this one selects the Bottom of the Tied Options. The below trigger is added right after the first loop as you have said in your previous post:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • vote_count[gamemode_num] Equal to temp_count
    • Then - Actions
      • Set temp_tie[1] = temp_count
      • Set temp_tie[2] = vote_count[gamemode_num]
      • Set tie = (Random integer number between 1 and 2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • tie Equal to 1
        • Then - Actions
          • Set temp_count = temp_tie[1]
        • Else - Actions
          • Set temp_count = temp_tie[2]
          • Set temp_int = gamemode_num
    • Else - Actions

Easy 1
Medium 1
hard 0
My trigger would select Medium.


Easy 0
Medium 1
Hard 1
My trigger would select Hard.
 
Level 13
Joined
Mar 24, 2010
Messages
950
after the first loop add this
  • 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
          • Vote_Count[(Integer A)] equal to temp_Points
        • Then - Actions
          • Set Temp_Int = (Random integer number between 1 and 2)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Temp_Int Equal to 1
          • Then - Actions
            • Set temp_Points = Vote_Count[(Integer A)]
            • Set Temp_Integer = (Integer A)
          • Else - Actions
        • Else - Actions
somethin like that will make it 50% chance for ya

Ok i fixed it ^ try that.
 
Status
Not open for further replies.
Top