HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

dialog triggers efficiency help

05-17-2008, 01:59 AM#1
Anopob
Hey all, so I'll just get straight to my problem.

Basically I'm creating a map in which there are 4 players, and each have a turn at choosing an element, or a hero, or basically an option which will vary on how they play the game. Obviously I'm doing this in dialog format so this is what confuses me.

I want no choice to be chosen twice. So basically when a dialog is chosen, I give the player that chose it their "option", and then it's the next player's turn to choose, but this is where the problem comes in. How can I create efficiently few triggers to remove dialog buttons that are already chosen? For example, if the choices were 1-8 (since I have eight buttons), and the first player chose #3, how can I make sure players 2-4 can't choose #3 without using tons of triggers? I do not want to create tons of triggers just to vary one option.

Please help as any advice is appreciated. Thanks in advance! And if you can suggest a different method of doing this, please post something. Thanks again!
05-17-2008, 02:56 AM#2
Zandose
You simply clear the dialog and add the buttons again, leaving out the ones you don't want.
05-17-2008, 03:55 AM#3
Anopob
Yes but as I said, I have 8 choices. Doing this for every choice I will have like ... way too many triggers at the end. Anyways thanks for helping; I guess I can use a Tavern for this problem then.
05-17-2008, 02:33 PM#4
TEC_Ghost
Pretty Easy Actually...

I assume you're using GUI. If not I can make it in jass :)
Trigger:
Initialization
Collapse Events
Time - Elapsed game time is 0.40 seconds
Conditions
Collapse Actions
Collapse Do Multiple ActionsFor each (Integer A) from 1 to 8, do (Actions)
Collapse Loop - Actions
Dialog - Create a dialog button for Choice_Dialog labelled (Choice + (String((Integer A))))
Set Button[(Integer A)] = (Last created dialog Button)
Set Button_Clickable[(Integer A)] = True
Dialog - Show Choice_Dialog for Player 1 (Red)
Dialog - Change the title of Choice_Dialog to Take your pick!


Trigger:
Remove Button
Collapse Events
Dialog - A dialog button is clicked for Choice_Dialog
Conditions
Collapse Actions
Collapse Do Multiple ActionsFor each (Integer A) from 1 to 8, do (Actions)
Collapse Loop - Actions
Collapse Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Clicked dialog button) Equal to (==) Button[(Integer A)]
Collapse Then - Actions
Set Button_Clickable[(Integer A)] = False
Else - Actions
Collapse Dialog - Clear Choice_Dialog
Collapse Do Multiple ActionsFor each (Integer A) from 1 to 8, do (Actions)
Collapse Loop - Actions
Collapse Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Button_Clickable[(Integer A)] Equal to (==) True
Collapse Then - Actions
Dialog - Create a dialog button for Choice_Dialog labelled (Choice + (String((Integer A))))
Set Button[(Integer A)] = (Last created dialog Button)
Else - Actions
Dialog - Show Choice_Dialog for Player 1 (Red)
05-17-2008, 09:27 PM#5
Anopob
I actually think that will work lol. Well I'm using a tavern now but thanks anyway +rep