Hello this is my first tutorial and I'm going to cover how to make a dialog box with clickable buttons for race selection that works only for the player using them.
1st. Your going to need to make global variables for each dialog and dialog button you want to have.
2nd. Make a trigger that has the event "Game - Map Initialization". Once that's done your going to need to create some actions the first of which is a dialog. Right click on actions and select new element then search for create dialog. Leave it as a modal dialog and edit the size and position as you see fit. After you've done that your going to need to set the global variable for the dialog you just made, again just right click on actions and make a new element and search for set variable and set it to w/e you named the variable and == (last created dialog).
Still within the same trigger your going to need to make a dialog button just like how you made your dialog but now search for dialog item (button). Click on the (last created dialog) part then click the radial for variable and select your dialog. Change the size, position and name to w/e you want and leave the "" blank. Now just like when making the dialog set the variable for the button to w/e you named it and == (last created dialog item). Repeat this step if you want to add more buttons to the dialog.
If you want to add a title to the dialog box just create a dialog item (label), again in the (last created dialog) change it to the dialog we made earlier. Change the size, position, text, and color to w/e you want and since we are using this as a title keep the text write out set to false.
To make all this work show up right click on actions and search for show/hide dialog then pick your dialog change hide to show for all players.
3rd. Make a new trigger with the event "any dialog item is clicked by player (triggering player)". Once you've done that your going to make a if then else action to do this just search for If then else in the actions window. Once you've done that right click on if and select new element and pick comparison. Click on the green "(" and change the function to used dialog item == (w/e button you want used). For the then part, again right click and select new element and search for create units facing point and change the number of and type of unit to w/e you want and the player to (triggering player) the point to the function (start location of player (triggering player) and the rest as the default settings. Leave the else blank. Repeat this for each button you want.
To make the dialog close after its used right click on actions and search for show/hide dialog then pick your dialog and keep it as hide and change it to function (player group (triggering player). This will also hide the buttons ^^
Congratulations you should now have a working dialog with clickable buttons that hides its self after use. Feel free to share this with anyone just please give me credit thank you. Vox
I don't see the difference between using "Any Player" and "Triggering Player" in Events. Won't Actions pick up the appropriate Triggering Player anyway?
Could you also explain more about showing/hiding/changing buttons inside a dialog that is seen by multiple players? The Galaxy Editor tooltips mention something about different players having the same Dialogs set up differently...
and on single dialogs working for multiple people yeah....
create dialog (that says yes/ no with buttons for a shit example)
set last created dialog = 'YESNODIALOG' (your custom global variable you made and now assigned the dialog to)
then you have to decide who to SHOW the dialog for, just one player? all players???
show YESNODIALOG for (player 1) or show YESNODIALOG for ALLPLAYERS
so you show that SPECIFIC dialog for as many players as you want
then when some1 clicks the dialog you hide the dialog for that specific player (triggering player buddy!!! :) ) haha and the other players if you so chose to show it for all players to start with can still click yes/no to make their own personal choice.
Rollback Post to RevisionRollBack
If life's a bitch, better make everyday your wife!!
It seems that the default return value for EventPlayer() ("Triggering Player" in GUI) is 1, which is what allows this to work in single player. I bet this would break if used in multiplayer (it would only register the event for Player 1).
Triggering Player in the Event should be changed to Any Player.
If you want real race selection you should look into the "game attributes stuff" so players select race in lobby. I do believe you can do custom race stuff from there?
I might be wrong but if you create a new 'Race' object in the Data Editor you are unable to publish your map.
Not sure if that is what you were getting at. But yes, it is possible to - for example - choose a Starting Hero in the Game Lobby. But, thanks to Blizzard, the GUI is messy and I don't think it would be nice to have a player choose from a long list of Hero's. I think between 3 and 5 is ideal.
Back to the topic.
It is a nice tutorial and clears up a lot of stuff which beginners might get confused about. I wish there was something around like this when I spent about a day learning all I could about Dialogs :)
Maybe I'm just being dumb but when I select the variable there is no option to for "last created dialogue" there is just...
Count of list items
Dialogue item hight
Dialogue item offset X/Y
Dialogue Item width
Dialogue Offset X/Y
Selected list item
where am I going wrong here ?