We are going to create a dialog similar to the one you can see above. A dialog requires two separate triggers, one for initializing (setting up variables, adding a title, showing it to the desired player, etc) and an other for handling clicks on our buttons (Event: Dialog Button is Clicked).
Lets start with variables! We will need an array of Dialog Buttons, I named it var_DialogButtonArray. We will also need a Dialog variable, let's call it var_Dialog. Of course you can use shorter variable names if you want. I for example always use one letter variables like b or d.
Now all there is left is creating two triggers. You can download the example map from here. (or RoC version)
The first trigger creates the dialog:
The second trigger handles the Dialog Button Click Events:
Replace the comments Easy, Medium and Hard with actual trigger functions, for example change Handicaps, Give extra gold, you name it.
This tutorial was written by 3ICE. http://www.3ice.hu/blog/diffdiag/
November 7th, 2008 at 8:29 pm
Updated!
I have added a RoC demo map.
–3ICE
June 3rd, 2009 at 9:16 pm
Thanks a lot! This helped me a lot with trigger variables in general.
Edited by 3ICE: Corrected spellings of "alot", removed "you", removed "out", added "with".
December 10th, 2009 at 5:10 pm
Nice :)
I will think about using this one day :)
December 10th, 2009 at 5:13 pm
Well, hurry up, because as soon as StarCraft 2 comes out, WarCraft 3 will receive a population drop of about 75%!
August 18th, 2010 at 3:37 pm
Does anyone know how to do this in the starcraft 2 editor?
Edited by 3ICE: Fixed capitalization ("does" -> "Does") and punctuation ("editor ??" -> "editor?").
August 18th, 2010 at 5:30 pm
Sure. Same principle, bit more complex triggering. Dialogs are more powerful in SC2, so they require a little more settings to be usable. (Like specifying height and position) Here are some screenshots and a downloadable demo map to get you started:
Variables:
http://img.3ice.hu/DiffdiagSC2_variables.png
Trigger 1:
http://img.3ice.hu/DiffdiagSC2_create.png
Trigger 2:
http://img.3ice.hu/DiffdiagSC2_click.png
Download demo map:
http://download.3ice.hu/Difficulty_Dialog_for_StarCraft_2.SC2Map
September 18th, 2010 at 4:39 pm
does that work in starcraft 2 too ?
September 18th, 2010 at 4:47 pm
Spammer down! Vince, I have removed your website, as it clearly isn't yours. As for your question, read the comment above yours for the answer.
September 29th, 2010 at 3:52 pm
Thanks for the tutorial man, I know it's a bit late to be starting on wc3 editing, but regardless, this probably saved me at least a few hours trying to figure this out. ^^
September 29th, 2010 at 4:34 pm
You are welcome.
It is never too late, in fact I just recently started working again on my Fastest Map Possible.
The rest of this comment was moved to my forum: forum.3ice.hu/viewtopic.php?t=727.
Edited by 3ICE: Fuck imageshack.us they deleted my pictures. Changing to my own host…
January 21st, 2012 at 3:47 am
Note: JASS is superior to GUI. It requires half as much work to create and store the button handles, because you can put the assign and create lines together:
call DialogSetMessage("Difficulty", var_Dialog)
set var_DialogButtonArray[0] = DialogAddButton("Easy", var_Dialog)
set var_DialogButtonArray[1] = DialogAddButton("Medium", var_Dialog)
set var_DialogButtonArray[2] = DialogAddButton("Hard", var_Dialog)
call DialogDisplay(Player(0), var_Dialog)
The above JASS code was not syntax checked, I probably got the number and order of parameters wrong. But it will do, for demonstration purposes only.
June 30th, 2012 at 11:26 pm
Very nice, is very helpful but i want to make a button clicked by more then 3 players like if 5 players from 9 click easy then go easy. Please help! Thanks again for tutorial!
July 1st, 2012 at 12:36 am
That's a vote system. On each click you increment the respective difficulty vote counter variable: easy_clicked, medium_clicked, or hard_clicked and also keep track of total_clicked. Once total_clicked equals the number of players in the game or 30 seconds have passed (protection from AFK players) you tally up the results, choosing the difficulty level that most players voted on.
July 16th, 2018 at 12:57 am
Old code:
Difficulty Dialog = No Dialog
Difficulty Buttons = No Dialog Item
Difficulty Dialog create and show
Events
Game - Map initialization
Local Variables
Conditions
Actions
Dialog - Create a Modal dialog of size (350, 300) at (0, 0) relative to Center of screen
——-
Dialog - Create a Button for dialog Difficulty Dialog
Variable - Set Difficulty Buttons[0] = (Last created dialog item)
Dialog - Set Difficulty Buttons[0] text to "Easy" for (Player group(1))
Dialog - Set Difficulty Buttons[0] size to (200, 50) for (Player group(1))
Dialog - Move Difficulty Buttons[0] to (150, 75) relative to Top Left of dialog for (Player group(1))
——-
Dialog - Create a Button for dialog Difficulty Dialog
Variable - Set Difficulty Buttons[1] = (Last created dialog item)
Dialog - Set Difficulty Buttons[1] text to "Medium" for (Player group(1))
Dialog - Set Difficulty Buttons[1] size to (200, 50) for (Player group(1))
Dialog - Move Difficulty Buttons[1] to (150, 175) relative to Top Left of dialog for (Player group(1))
——-
Dialog - Create a Button for dialog Difficulty Dialog
Variable - Set Difficulty Buttons[2] = (Last created dialog item)
Dialog - Set Difficulty Buttons[2] text to "Hard" for (Player group(1))
Dialog - Set Difficulty Buttons[2] size to (200, 50) for (Player group(1))
Dialog - Move Difficulty Buttons[2] to (150, 275) relative to Top Left of dialog for (Player group(1))
——-
Dialog - Show Difficulty Dialog for (Player group(1))
Difficulty Dialog handle clicks
Events
Dialog - Any Dialog Item is used by Player Any Player with event type Clicked
Local Variables
Conditions
Actions
——- First we hide it, to prevent multiple difficulties being selected
Dialog - Hide Difficulty Dialog for (Player group(1))
——- Then we find out which button they clicked on
General - If (Conditions) then do (Actions) else do (Actions)
If
(Used dialog item) == Difficulty Buttons[0]
Then
——- Do stuff that makes the game easy, like set enemy handicap to 50%
Debug - Display "Dialog button clicked: Easy" as debug output using Type 01, and Do display it in the game window
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Used dialog item) == Difficulty Buttons[1]
Then
——- Normal difficulty
Debug - Display "Dialog button clicked: Normal" as debug output using Type 01, and Do display it in the game window
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Used dialog item) == Difficulty Buttons[2]
Then
——- Do stuff that makes the game hard, like set enemy handicap to 200%
Debug - Display "Dialog button clicked: Hard" as debug output using Type 01, and Do display it in the game window
Else
October 12th, 2019 at 3:19 pm
Hello really good help but how to modify handicap im really bad for this can anyone help me :(
October 12th, 2019 at 4:09 pm
In warcraft 3:
Player - Set Player 1 (Red) handicap to 75.00%
(You search for handicap)
WC3 JASS (fastest):
call SetPlayerHandicap(Player(0), 0.75)
//Or BJ version:
call SetPlayerHandicapBJ( Player(0), 75 )
In starcraft 2 it's harder to find, but possible:
Player - Modify player 1 Handicap: Set To 75
(You have to search for "property", click `Modify Player Property (Integer)` and then change the property keyword from "minerals" to "handicap".)
SC2 Galaxy code:
PlayerModifyPropertyInt(1,c_playerPropHandicap,c_playerPropOperSetTo,75)
–3ICE