Basics of a Dialog

ragingspeedhorn

New Member
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.
triggereditorpic9kp.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.
variableeditorpic2rn.jpg

When you are inside the Variable Editor you click on the green x with a + infront of it
greenx5yy.png
to create a new variable, then you make the two variables needed for the Dialog as shown below.
2variables3zt.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
Code:
    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
Code:
    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
Code:
    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.
100goldfh6.png
http://img178.imageshack.us/img178/1443/100goldfh6.png
 
Werbung:

Fladian

New Member
Hmm... now I read through it, it reminds me of how bad I used to be with triggers. Despite being a one-man-team in my modding days, I always had some trouble with triggers - but never understood variables, 'till the day of today. It's nice to be reminded to something like that. =)
 

Fladian

New Member
Hey, if someone who stopped modding for so long, like me, could find it useful, then that might mean some things too. ;) (though in my case it doesn't. :p)
 
Werbung:
Top