As you might know im part of the team that developes Starcaft Universe and im responsible for most of the trigger work. Since SCU is a real big RPG and alot of people try to build smaller RPG projects i decided to share some of our knowledge with the community, however some things will for sure be kept secret for now.
In this tutorial i want to show you how to create an universal multiple choice dialog, that can be used for all kinds of input the player needs to make. Instead of having to create a new dialog for each simple yes/no choice that you want to implement, you can always use the same dialog, saving alot of time and work and reduceing code length.
It can also be used as a simple message dialog, just displaying information.
Difficulty: Medium (You need some basic trigger knowledge for this tutorial!)
The result will look like this:
Or maybe like this, yes its flexible...
1. First steps
Create a new library and create the following folders.
2. Setting up the record and variables
Create a new record containing the following content, then link it to a variable. (Make sure to use an array right here, each player needs his own instance of the choice dialog!)
Also create a new variable that stores the maximum button count, this makes your script a little bit more flexible, however you will still need some changes when changing the max. number of choices since galaxy isnt flexible enough...
3. Initializing the dialogs
Create a new trigger and fill it will the following content:
Please note that this is just a suggestion and you might want to change everything to your needs, like background image and button style. Good looks is not part of this tutorial.
Keep in mind that it doesnt matter what values you use for size and position here, since this will be done within another action later.
4. Making it work I
Now its time to bring this to live.
Create a new custom action and fill it with the following content:
Sadly we need some copy paste here since GUI doesnt support arrays in parameters. Feel free to change everything to your needs.
Basically how this works is, if a button doesnt have a text its not shown up and also there wont be any trigger attached to it.
If the button has any text, the button will show up and it will be linked to the trigger entered in the parameters. This trigger will then be executed when the button is pressed by the player. Like this you have full control over your choice dialogs and you can use them for nearly everything you can imagine.
5. Making it work II
Right now, nothing would happen when pressing a button of the choice dialog.
To change this, create a new trigger and fill it with the following lines:
Basically this just hides the dialog containing the used button (Since its always hidden no matter what option the player chooses) and then it executes the trigger linked to the pressed button. Pretty simple!
6. Example
In this example we want to create a simple welcome dialog. When the OK button is pressed, a new dialog will show up for the triggering player asking him if he wants to quit the game. If he confirms, the triggering player will return to the SC2 login screen, if not nothing will happen. The example will work in mutliplayer aswell.
At first we need to create the trigger that actually kicks the triggering player out of the game. We dont need any event since the trigger will be executed by the choice dialog later.
Now we need to create the trigger that shows the second dialog (that asks if the player wants to quit) and link it to the trigger we just created.
Again, we dont need any event since this dialog will show up once the player presses "OK" on the welcome dialog.
Now its time to create the welcome dialog itself. This time we need an event since this is the first dialog showing up.
This is how it will look ingame:
For sure this is just a very simple example of what you can do with this. Basically you can do nearly everything you want with this system.
7. A few words on libraries
If you create libraries like this one, make sure to make all functions, trigger, actions and variables internal, except for the ones that should be accessable by the user later. For the choice dialog, everything except the show action should be internal to keep the function lists clean and making the system a little bit more fail save (since the user cant access stuff that he shouldnt modify).
PS: Yes i know i forgot it myself in this one, but im to lazy to reupload all the screens just for a few different text colors. Please excuse me.
Hey guys!
As you might know im part of the team that developes Starcaft Universe and im responsible for most of the trigger work. Since SCU is a real big RPG and alot of people try to build smaller RPG projects i decided to share some of our knowledge with the community, however some things will for sure be kept secret for now.
In this tutorial i want to show you how to create an universal multiple choice dialog, that can be used for all kinds of input the player needs to make. Instead of having to create a new dialog for each simple yes/no choice that you want to implement, you can always use the same dialog, saving alot of time and work and reduceing code length.
It can also be used as a simple message dialog, just displaying information.
Difficulty: Medium (You need some basic trigger knowledge for this tutorial!)
The result will look like this:
Or maybe like this, yes its flexible...
1. First steps
Create a new library and create the following folders.
2. Setting up the record and variables
Create a new record containing the following content, then link it to a variable. (Make sure to use an array right here, each player needs his own instance of the choice dialog!)
Also create a new variable that stores the maximum button count, this makes your script a little bit more flexible, however you will still need some changes when changing the max. number of choices since galaxy isnt flexible enough...
3. Initializing the dialogs
Create a new trigger and fill it will the following content:
Please note that this is just a suggestion and you might want to change everything to your needs, like background image and button style. Good looks is not part of this tutorial.
Keep in mind that it doesnt matter what values you use for size and position here, since this will be done within another action later.
4. Making it work I
Now its time to bring this to live.
Create a new custom action and fill it with the following content:
Sadly we need some copy paste here since GUI doesnt support arrays in parameters. Feel free to change everything to your needs.
Basically how this works is, if a button doesnt have a text its not shown up and also there wont be any trigger attached to it.
If the button has any text, the button will show up and it will be linked to the trigger entered in the parameters. This trigger will then be executed when the button is pressed by the player. Like this you have full control over your choice dialogs and you can use them for nearly everything you can imagine.
5. Making it work II
Right now, nothing would happen when pressing a button of the choice dialog.
To change this, create a new trigger and fill it with the following lines:
Basically this just hides the dialog containing the used button (Since its always hidden no matter what option the player chooses) and then it executes the trigger linked to the pressed button. Pretty simple!
6. Example
In this example we want to create a simple welcome dialog. When the OK button is pressed, a new dialog will show up for the triggering player asking him if he wants to quit the game. If he confirms, the triggering player will return to the SC2 login screen, if not nothing will happen. The example will work in mutliplayer aswell.
At first we need to create the trigger that actually kicks the triggering player out of the game. We dont need any event since the trigger will be executed by the choice dialog later.
Now we need to create the trigger that shows the second dialog (that asks if the player wants to quit) and link it to the trigger we just created.
Again, we dont need any event since this dialog will show up once the player presses "OK" on the welcome dialog.
Now its time to create the welcome dialog itself. This time we need an event since this is the first dialog showing up.
This is how it will look ingame:
For sure this is just a very simple example of what you can do with this. Basically you can do nearly everything you want with this system.
7. A few words on libraries
If you create libraries like this one, make sure to make all functions, trigger, actions and variables internal, except for the ones that should be accessable by the user later. For the choice dialog, everything except the show action should be internal to keep the function lists clean and making the system a little bit more fail save (since the user cant access stuff that he shouldnt modify).
PS: Yes i know i forgot it myself in this one, but im to lazy to reupload all the screens just for a few different text colors. Please excuse me.
16.03.2012 - Added an example of how to use this.