Hi, I am currently working on a project with Ice4smaster, but I ran into a problem: I cannot create a working voting system.
I've got all the dialog stuff down, but what I need to do is make a voting system that displays the vote and that will make sure players cannot vote on the same dialog item. If you are going to say "go try it out yourself," I have. I can post screenshots if wanted on what my system is and maybe you guys could help me fix the problems? Or maybe just explain to me a working one.
RaceSelectionButtonInteractionEventsDialog-AnyDialogItemisusedbyPlayerAnyPlayerwitheventtypeClickedDialog-AnyDialogItemisusedbyPlayerAnyPlayerwitheventtypeMouseEnterDialog-AnyDialogItemisusedbyPlayerAnyPlayerwitheventtypeMouseExitLocalVariablesx=0<Integer>y=0<Integer>selected=NoDialogItem<DialogItem>EffectedBorder=NoDialogItem<DialogItem>EffectedImage=NoDialogItem<DialogItem>ConditionsActionsVariable-Setp=(Triggeringplayer)Variable-Setselected=(Useddialogitem)Dialog-SetselectedcolortoYellowfor(Allplayers)General-Foreachintegerxfrom0to1withincrement1,do(Actions)ActionsGeneral-Foreachintegeryfrom0to0withincrement1,do(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)Ifselected==SelectionButton[x][y]ThenVariable-SetEffectedBorder=SelectionBorder[x][y]Variable-SetEffectedImage=SelectionImage[x][y]ElseGeneral-Switch(Actions)dependingon(Dialogitemeventtype)CasesGeneral-If(Clicked)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfPlayerSelected[x][p]==1ThenDialog-SetSelectionBorder[0][0]colortoWhitefor(Playergroup(p))Dialog-SetSelectionBorder[1][0]colortoWhitefor(Playergroup(p))Dialog-SetEffectedBordercolortoGreenfor(Playergroup(p))Dialog-SetSelectionImage[0][0]DesaturatedflagtoTruefor(Playergroup(p))Dialog-SetSelectionImage[1][0]DesaturatedflagtoTruefor(Playergroup(p))Dialog-SetEffectedImageDesaturatedflagtoFalsefor(Playergroup(p))Variable-SetPlayerSelection[p]=EffectedImageVariable-SetPlayerSelected[(Abs((x-1)))][p]=1General-If(Conditions)thendo(Actions)elsedo(Actions)Ifp<=6ThenVariable-ModifyVoteTallyTeam1[x][y]:+(PlayerSelected[x][p]*1)ElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)Ifp>=7ThenVariable-ModifyVoteTallyTeam2[x][y]:+(PlayerSelected[x][p]*1)ElseElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfPlayerSelected[x][p]==0ThenUI-Display"YOU HAVE ALREADY VOTED FOR THIS RAC..."andplayUI_BnetErrorfor(Playergroup(p))ElseGeneral-If(MouseEnter)ActionsDialog-SetEffectedImageDesaturatedflagtoFalsefor(Playergroup(p))General-If(MouseExit)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfEffectedImage!=PlayerSelection[p]ThenDialog-SetEffectedImageDesaturatedflagtoTruefor(Playergroup(p))ElseDefaultGeneral-Foreachintegerxfrom0to1withincrement1,do(Actions)ActionsGeneral-Foreachintegeryfrom0to0withincrement1,do(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)Ifselected==SelectionButton[x][y]ThenVariable-SetEffectedBorder=SelectionBorder[x][y]Variable-SetEffectedImage=SelectionImage[x][y]Else
Actually just don't bother to say what is wrong with my trigger, it would take too much time.
Just please post the simplest way to a voting system that allows players to revote! This is what I am trying to do: Have a voting system where players can revote, and when they try to vote for a thing that you have already voted for, you will be displayed an error message.
I created a voting system like what you are asking about in two of my games: Malum Ruina and Xeno Crisis. The system in both games works flawlessly. It's actually quite simple.
Before I continue, you may find it easier to install a library to handle voting. Check out the Libraries & Scripts forum - there's a topic there listing all libraries by category. There should be a sub-category specifically for voting systems. If one of these works for you, that would certainly be the easiest solution.
If you'd prefer to make the system yourself (perfectly understandable) then read on.
The first thing you need to do is consider what variables you need. Based on what you're asking for, I can already name several:
ItemXPass - Boolean - This variable handles one of the things players can vote over. So if enough people vote for this, set it to True. Or whatever you want to do with it. I don't know.
ItemXVoted[array] - Boolean - This variable tracks whether a player has voted on a particular thing. I always set arrays based on the number of players in a game to 16. Coders will probably freak out about this but whatever, it lets me avoid errors.
ItemXVotes - Integer - This variable will track the number of votes cast on item X. I don't know what item X is. That's up to you.
These three variables (the one in the middle is actually 16 variables in an array...) you can create a basic voting system. So if a player clicks on the "VOTE FOR X" button and ItemXVoted[triggering player] == false, then set ItemXVoted[triggering player] = true and add 1 to ItemXVotes, then compare ItemXVotes to whatever threshold you have for a vote to pass such that if ItemXVotes > Threshold, set ItemXPass = true.
If the player tries to vote again (player clicks and ItemXVoted[triggering player] == true,) scream at them for being dum n tryn 2 voet agen lol
Hi, I am currently working on a project with Ice4smaster, but I ran into a problem: I cannot create a working voting system.
I've got all the dialog stuff down, but what I need to do is make a voting system that displays the vote and that will make sure players cannot vote on the same dialog item. If you are going to say "go try it out yourself," I have. I can post screenshots if wanted on what my system is and maybe you guys could help me fix the problems? Or maybe just explain to me a working one.
Thanks in advance!
@MoDTassadar: Go
your screenshots are broken, highlight the text of your triggers if you want and right click copy as text then use pastebin.com
Please help, this is very troubling.
Actually just don't bother to say what is wrong with my trigger, it would take too much time.
Just please post the simplest way to a voting system that allows players to revote! This is what I am trying to do: Have a voting system where players can revote, and when they try to vote for a thing that you have already voted for, you will be displayed an error message.
Thanks in advance!
I created a voting system like what you are asking about in two of my games: Malum Ruina and Xeno Crisis. The system in both games works flawlessly. It's actually quite simple.
Before I continue, you may find it easier to install a library to handle voting. Check out the Libraries & Scripts forum - there's a topic there listing all libraries by category. There should be a sub-category specifically for voting systems. If one of these works for you, that would certainly be the easiest solution.
If you'd prefer to make the system yourself (perfectly understandable) then read on.
The first thing you need to do is consider what variables you need. Based on what you're asking for, I can already name several:
These three variables (the one in the middle is actually 16 variables in an array...) you can create a basic voting system. So if a player clicks on the "VOTE FOR X" button and ItemXVoted[triggering player] == false, then set ItemXVoted[triggering player] = true and add 1 to ItemXVotes, then compare ItemXVotes to whatever threshold you have for a vote to pass such that if ItemXVotes > Threshold, set ItemXPass = true.
If the player tries to vote again (player clicks and ItemXVoted[triggering player] == true,) scream at them for being dum n tryn 2 voet agen lol
Hope that helps.
Okay, I will try this out!
Thank you very much!