Voting help

Stryke

New Member
Reaction score
6
I made a Dialog-system voting system where you can vote for the players in-game. How would I check which player has the most votes? Thanks!

The vote points are integer.
 
I know I only looked for this a couple of days ago, and I found the answer here on the forums.

Code:
Make Dialog
    Events
        Time - Elapsed game time is 1.00 seconds
    Conditions
    Actions
        Dialog - Change the title of VotePlayer to Vote on player to...
        Dialog - Create a dialog button for VoteScore labelled Player 1
        Set VotePlayerButton[1] = (Last created dialog Button)
        Dialog - Create a dialog button for VoteScore labelled Player 2
        Set VotePlayerButton[2] = (Last created dialog Button)
               Player Group - Pick every player in (All players) and do (Dialog - Show VotePlayer for (Picked player))

Code:
Vote Player 1
    Events
        Dialog - A dialog button is clicked for VotePlayer
    Conditions
        (Clicked dialog button) Equal to VotePlayerButton[1]
    Actions
        Set VotePlayerResult[1] = (VotePlayerResult[1] + 1)
Make 1 for each button

Code:
Result Player 1
    Events
    Conditions
        VotePlayerResult[1] Greater than VotePlayerResult[2]
    Actions
        Game - Display to (All players) for 10.00 seconds the text: Player 1 has won...

Make 1 for each option

Anyway...something like that :) There is a probably a much easier way to do it, but that is basically what I came across and so it's what I used.
 
Thanks for the reply, but I'm trying to get this to work with MORE than 2 Players. A vote with 2 Players isn't much of a voting system.
 
I know, and this does work with more than 2 players...simply add more buttons. My one that I'm using has 5 options, but you could easily make it 10
 
In the first trigger add
Dialog - Create a dialog button for VoteScore labelled Player 3
Set VotePlayerButton[3] = (Last created dialog Button)

and so on for each player.

Then create a duplicate of the second two triggers but make it for each player.
Eg. If you had 4 players you would have 4 triggers:

Vote Player 1
Vote Player 2
Vote Player 3
Vote Player 4

All you need to do with them is change the array number to the player number.

Then for the final trigger you would have another 4:

Result Player 1
Result Player 2
Result Player 3
Result Player 4

and the Result Player 1 would read:

Code:
Result Player 1
    Events
    Conditions
        VotePlayerResult[1] Greater than VotePlayerResult[2]
        VotePlayerResult[1] Greater than VotePlayerResult[3]
        VotePlayerResult[1] Greater than VotePlayerResult[4]
    Actions
        Game - Display to (All players) for 10.00 seconds the text: Player 1 has won...

Then surely using some common sense you could make the other triggers on your own, or you could look around the forums for the tutorial which might explain things better.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top