Basics of a Dialog

Level 5
Joined
Jan 5, 2007
Messages
40
Basics of a Dialog

by ragingspeedhorn & Orc_Tamer


Note: In this tutorial we will show you how you create a simple multiply choice dialog for 1 player. Keep in mind that this is directed towards the beginners within the Trigger Editor and is in no way meant to teach the experienced modders anything that they probably didn't knew already.

1) What is a dialog?

A "Dialog" is a litle window that pops up which contains some buttons that you can click. An example of what a Dialog can be used for is a simple thing like if you would like to have a 100 gold. Instead of having the choice based on chat commands where you write -yes or -no it is (and looks) better to have a Dialog window apearing asking you if you would like to have a 100 gold and then having 2 buttons which says "Yes" or "No". We will now show you how you make a Dialog like I just told you about in the simpliest way (that we know of).

2) Getting Started.

To get started you should (ofcourse) open up the World Editor and enter the Trigger Editor (Hotkey for it is F4), the icon for it is located inbetween the Terrain Editor & the Sound Editor.

1.jpg

3) Creating The Variables.

Once you entered the Trigger Editor the first thing to do is finding the Variable Editor (Hotkey for it is Ctrl+B), the icon for it is located to the left of the New Category icon.

4.jpg

When you are inside the Variable Editor you click on the green x with a + infront of it greenx5yy.jpg to create a new variable, then you make the two variables needed for the Dialog as shown below.

2.jpg


4) Creating The Dialog Window.

Once you made your two variables you can start with the actual triggers for getting the Dialog Window to apear.

First you create a new trigger and do as shown below.

  • The Dialog Window
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
      • None
    • Actions
      • Dialog - Clear MyDialog
      • Dialog - Change the title of MyDialog to Do you want a 100 gold?
      • Dialog - Create a dialog button for MyDialog labelled Yes
      • Set DialogButton[1] = (Last created dialog Button)
      • Dialog - Create a dialog button for MyDialog labelled No
      • Set DialogButton[2] = (Last created dialog Button)
      • Dialog - Show MyDialog for Player 1 (Red)
Once this is done the Dialog will apear perfectly but there will be no effect when clicking the buttons.


5) Creating The Buttons.

To make the buttons actually do something you create two triggers as shown below.

  • Yes Button
    • Events
      • Dialog - A dialog button is clicked for MyDialog
    • Conditions
      • (Clicked dialog button) Equal to DialogButton[1]
    • Actions
      • Player - Add 100 to Player 1 (Red) Current gold
      • Game - Display to Player Group - Player 1 (Red) the text: You have recieved 100 gold
  • No Button
    • Events
      • Dialog - A dialog button is clicked for MyDialog
    • Conditions
      • (Clicked dialog button) Equal to DialogButton[2]
    • Actions
      • Game - Display to Player Group - Player 1 (Red) the text: You didn't want any gold
Once these two triggers have been made your Dialog should work and look like shown below.

3.jpg
 
Last edited by a moderator:

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,328
Removing title and all buttons:
  • Dialog - Clear MyDialog
If you want to destroy it, use:
JASS:
call DialogDestroy(udg_MyDialog)
 
Top