- Joined
- Mar 10, 2005
- Messages
- 55
I read many threads from people complaining about dialog buttons and didn't use it proper myself before today. Even if it takes probably longer clicking the triggers in GUI this should be an easy example of how a dialog for multiple players in just GUI may work.
First of all you need some Variables. Ill explain them first.
Because I wanted just 1 decision running simultaneously but beeing able to repeat it, there's the boolean for the progress. So nobody can start another voting while the first is still running.
Then we have 3 button-arrays. Each has a length of 8 so that up to 8 players can vote (increase the size if you need more players). There are 3 because I want it to keep simple and have just 3 buttons for each player. We can vote for easy, normal or hard.
The dialog array keeps all those buttons and shows them to the players.
The integer counters are used to see how many votes were given to each decision.
The strings show us first the title of the board e.g. "which difficulty do you want?" and the buttons show us e.g. EASY, NORMAL and HARD.
The temporary integer will be used in registering who clicked a dialog button.
The timer and the timer window will show us how much time is left for voting.
Now that we declared our variables, well see that the voting is triggered via writing "dialog"
It doesnt matter which player triggers it.
The trigger checks if a vote is already in progress and runs only if there is no other vote.
Then it will be set to in progress to avoid another vote.
The text will be written into strings for easier change and not touching the buttons anymore.
The counters will be resetted.
A counter is started and gives every player 15 seconds to vote. It will be shown to every player.
We loop through 8 players and just create those dialog buttons for those players who are actually playing the game.
We create the corresponding dialog window and buttons for those players and show the completed dialog.
Now we register the clicked buttons:
The temporary int is set to the number of the player which clicked it and then we look which button was clicked.
We increase the amount of votes according to the button.
Now we wait for the timer to end.
We remove the timer window and hide the dialog for all players, in case somebody didn't vote (perhaps he was afk or sth.)
Then we show which vote got how many voters.
Because there are just 3 vote options and I prefer normal I made the voting result a little awkward.
In this case Im looking if normal has more votes than easy or hard.
If there as many easy as hard votes we get also normal.
In the end we check if there are more easy than hard votes and get either easy or hard.
We show the result via text but you're free to set some variables as you like.
Edited, because I forgot to attach the map.
First of all you need some Variables. Ill explain them first.
Because I wanted just 1 decision running simultaneously but beeing able to repeat it, there's the boolean for the progress. So nobody can start another voting while the first is still running.
Then we have 3 button-arrays. Each has a length of 8 so that up to 8 players can vote (increase the size if you need more players). There are 3 because I want it to keep simple and have just 3 buttons for each player. We can vote for easy, normal or hard.
The dialog array keeps all those buttons and shows them to the players.
The integer counters are used to see how many votes were given to each decision.
The strings show us first the title of the board e.g. "which difficulty do you want?" and the buttons show us e.g. EASY, NORMAL and HARD.
The temporary integer will be used in registering who clicked a dialog button.
The timer and the timer window will show us how much time is left for voting.
Now that we declared our variables, well see that the voting is triggered via writing "dialog"
It doesnt matter which player triggers it.
The trigger checks if a vote is already in progress and runs only if there is no other vote.
Then it will be set to in progress to avoid another vote.
The text will be written into strings for easier change and not touching the buttons anymore.
The counters will be resetted.
A counter is started and gives every player 15 seconds to vote. It will be shown to every player.
We loop through 8 players and just create those dialog buttons for those players who are actually playing the game.
We create the corresponding dialog window and buttons for those players and show the completed dialog.
Now we register the clicked buttons:
The temporary int is set to the number of the player which clicked it and then we look which button was clicked.
We increase the amount of votes according to the button.
Now we wait for the timer to end.
We remove the timer window and hide the dialog for all players, in case somebody didn't vote (perhaps he was afk or sth.)
Then we show which vote got how many voters.
Because there are just 3 vote options and I prefer normal I made the voting result a little awkward.
In this case Im looking if normal has more votes than easy or hard.
If there as many easy as hard votes we get also normal.
In the end we check if there are more easy than hard votes and get either easy or hard.
We show the result via text but you're free to set some variables as you like.
Edited, because I forgot to attach the map.
Attachments
Last edited: