HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Basics of a Dialog

06-24-2006, 10:57 AM#1
ragingspeedhorn
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.

Zoom (requires log in)


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.

Zoom (requires log in)

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

Zoom (requires log in)


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
Trigger:
Collapse Events
Time - Elapsed game time is 1.00 seconds
Collapse Conditions
None
Collapse 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
Trigger:
Collapse Events
Dialog - A dialog button is clicked for MyDialog
Collapse Conditions
(Clicked dialog button) Equal to DialogButton[1]
Collapse 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
Trigger:
Collapse Events
Dialog - A dialog button is clicked for MyDialog
Collapse Conditions
(Clicked dialog button) Equal to DialogButton[2]
Collapse 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.

Zoom (requires log in)
Attached Images
File type: jpg2 Variables.JPG (25.2 KB)
File type: jpgFinal Dialog.JPG (19.2 KB)
File type: jpggreen x.JPG (903 bytes)
File type: jpgTrigger Editor Pic.JPG (4.6 KB)
File type: jpgVariable Editor Pic.JPG (3.3 KB)
06-24-2006, 04:04 PM#2
Archian
useful for beginner i supose
06-24-2006, 04:22 PM#3
Tim.
You used Player 1 Red, for a tutorial it might be better to use the player who clicked on the button?
06-24-2006, 04:31 PM#4
ragingspeedhorn
Quote:
Originally Posted by Tim.
You used Player 1 Red, for a tutorial it might be better to use the player who clicked on the button?

I see your point, but as said it was just to show an example.
06-24-2006, 06:30 PM#5
GaDDeN
I agree with Tim, perhaps if you made the trigger more customizable by using (triggering player) the user could choose which player to show the dialog to by simply changing one field instead of multiple?
06-24-2006, 07:24 PM#6
ragingspeedhorn
Quote:
Originally Posted by GaDDeN
I agree with Tim, perhaps if you made the trigger more customizable by using (triggering player) the user could choose which player to show the dialog to by simply changing one field instead of multiple?

I tried changing it to "triggering player" and the dialog did not show up.
06-24-2006, 07:57 PM#7
GaDDeN
You, of course, have to create the dialog for a set player (in this case player 1). The (triggering player) can be used on the triggers where the event is "clicked dialog button".
06-24-2006, 08:22 PM#8
ragingspeedhorn
Quote:
Originally Posted by GaDDeN
You, of course, have to create the dialog for a set player (in this case player 1). The (triggering player) can be used on the triggers where the event is "clicked dialog button".

I see no meaning in doing this, the "player 1 red" stuff is just an example. No matter what I do not have any time to do it either since I will be away for the next 10 days and I will be leaving in 30 minutes.
06-24-2006, 10:57 PM#9
GaDDeN
Ok ^^ I guess people can advance and make the trigger better once they learn how it works, so the tutorial works as a base.

But really, dont you see the meaning of making a trigger more customizable? Now you have to change like 5 fields just to show it to a new player; using (triggering player) you would only have to edit 1.
06-26-2006, 05:34 AM#10
Orc_Tamer
Just to know I helped out to make all the triggers. So I want some loving too lol
06-28-2006, 07:21 PM#11
mikeb912
it all worked fine for me.
07-01-2006, 12:23 AM#12
darkwulfv
good job on the tutorial, using this is way better than my shitty race selection system... Probably wouldn't have worked anyways. Thanks for making it! +rep
07-12-2006, 04:23 PM#13
Electricall
Actually, I did this thing just a few hours ago, and I had some grief cuz it wouldn't work at first. The error was putting the dialog stuff in map init, when I put it in a 1 sec after trigger it worked fine. If only I would have had this tut then =) For me it works great though, I did a dialog which says "are you sure?" when you use your wisp to select a hero.
07-15-2006, 04:00 PM#14
Fallenzeca
I've been looking through many dialog tutorials or topics that was about dialogs and I'm trying to do a Dialog by myself, but it won't and I can't find the fault =/.
The idea of my dialog is that it will ask a player that owns a hero of lvl 8 when that hero enters a specific region.
Trigger1:
Trigger:
Collapse Events
Unit - A unit enters TeleRookToMainOracle <gen>
Collapse Conditions
(Max life of (Triggering unit)) Greater than or equal to 970.00
(Unit-type of (Triggering unit)) Equal to Adventurer
Collapse Actions
Dialog - Clear Dialog
Dialog - Change the title of Dialog to Ready For Main?
Dialog - Create a dialog button for Dialog labelled Yes
Set DialogButton[1] = (Last created dialog Button)
Dialog - Create a dialog button for Dialog labelled No!
Set DialogButton[2] = (Last created dialog Button)
Dialog - Show Dialog for (Owner of (Triggering unit))
This trigger works well but the problems begins on this trigger:
Trigger:
ClickingTestYes
Collapse Events
Dialog - A dialog button is clicked for Dialog
Collapse Conditions
(Clicked dialog button) Equal to DialogButton[1]
Collapse Actions
Unit - Move (Triggering unit) instantly to (Center of ArriveRookVocChoose <gen>)
Can anyone help me here, because this trigger makes sense to me but I'm prob to noob to see the fault
Thanks all, great tuts and great site =)
07-15-2006, 05:34 PM#15
ragingspeedhorn
I am not sure if it is the problem but shouldnt it be entering unit instead of triggering as it is triggered by a region?