#Need help with a 3 choice voteing system

9 messages · Page 1 of 1 (latest)

dark ruin
#

So I recently made a vote system for 6 choices but this system would work for you as well. Not sure if anyone has a better method.

I used seperate shared ints for each choice, from there each vote will be cast once only adding 1 to the int.

I then put each into a list. Use max value of the list and I then compare that max value back to the int chips of each one. Using if statements and equals.

errant edge
#

Are you using beta chips

stuck heart
#

This is irrelevant but what's the color aura when you get things wrong and right in the video?

pine steppe
#

Heres how I would do it, kinda using @dark ruin 's method

Assuming you know how many players you can vote for, (Say, 3)
And, assuming you want to use Instant Run-off voting (Bad idea like, always, but, hey, its how the US election works)

Create an int variable for the max number of candidates
Name them Candidate [Number] Votes, for example, for the first candidate, Candidate 1 Votes

Create a role an call it Voter

Now, create an event definition and name it Start Vote
When you want to start a vote, have the local player send the event Start Vote to All

Create an event definition and name it CandidateChoices, add a List<Player> type to this, I'll call this CandidatePlayers, and a List<String> to it, I'll call this CandidateNames, and a List<Player>, I'll call this PlayersOnVote

When the event Start Vote is received, check if the local player has the role Candidate
If they do have the role, dont let them vote, it would be unfair letting candidates votes

If they dont have the role, send the event CandidateChoices to local, with CandidatePlayers being Get All Players With Role (Candidate), Candidate Names being a blank List Create, and PlayersOnVote being Get All Players

When the event Candidate Choices is received, run a For Each on the received CandidatePlayers
For each item, add their name To String to CandidateNames

When the For Each is done, run a Prompt Multiple Choice Player on CandidateNames

When the prompt is complete, use an Execution Integer Switch on Choice Index

If the result is -1, Set PlayersAnswered to PlayersAnswered + 1
If the result is 1, set the variable Candidate 1 Votes to Candidate 1 Votes + 1, Set PlayersAnswered to PlayersAnswered + 1
If the result is N, set the variable Candidate N Votes to Candidate N Votes + 1, Set PlayersAnswered to PlayersAnswered + 1

This is message (1/2), running out of space

#

Create an event definition and name it End Vote
Create an event definition and name it Vote Winner

After setting PlayersAnswered to PlayersAnswered + 1, check if PlayersAnswered is greater or equal to the number of players in PlayersOnVote subtracted by the number of players with the role Candidate, send the event End Vote to All

You may want another system to end the vote early for people who crash and literally don't vote at all

When the event End Vote is received, check if the local player is the room authority
You need to check which candidate index won

You can do this by adding each Candidate X Votes variable into a list, and then taking the max of that list using List Max, and then finding which index is the max by using List Get First Index Of
After seeing which index won:

Send the event Vote Winner to All, the player that won should be the List Get Element of Get All With Role (Candidate), with the index being the index of who won

#

and thats how you do multi-candidate voting

#

@stuck heart @wicked wagon @errant edge @stuck heart

wicked wagon
#

thanks

graceful lion
#

Beta tools has that (multiple choice input I think it's called)