| 01-02-2004, 10:31 AM | #1 |
I worked on a voting system for my map, and it is causing me trouble now. I set it up so there is a button for each player, but it will only appear when there is a player in that slot. When the button is pressed it adds to an interger array. Now the problem is that when the button is pressed, it adds one to ALL intergers in the array, not just the owner of the button that was pressed. I tried taking off the part that only created the button for players that were there and it would not add to any of the array at all. Below are the pertinant part of the triggers, please advise if you can. Code:
Actions
Dialog - Change the title of Kingdialog to Please choose a Kin...
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 1 (Red) slot status) Equal to Is playing
Then - Actions
Dialog - Create a dialog button for Kingdialog labelled (|cffff0000 + (Name of Player 1 (Red)))
Set DL1 = (Last created dialog Button)
Else - Actions
(and so on for all 11 players)
DL1
Events
Dialog - A dialog button is clicked for Kingdialog
Conditions
(Clicked dialog button) Equal to DL1
Actions
Set Voteking[1] = (Voteking[1] + 1)
For each (Integer A) from 1 to 11, do (If ((Voteking[(Integer A)] Greater than or equal to 1) and (Voteking[(Integer A)] Greater than Voteking[1])) then do (Set King = Player 1 (Red)) else do (Do nothing))
|
| 01-02-2004, 04:52 PM | #2 |
What you want is a dialog button array. In your show dialog action, set each member of the array to the button corresponding to that player index. Then, when the button is pressed on your dialog, check which button it was and give the vote to that player! |
