- Joined
- Jun 17, 2010
- Messages
- 2,275
Hello, This is a tutorial to show You, the common man, how to understand and create your own triggers.
We will begin by going through the simplest Events, Conditions, and Actions.
1.0 Introduction
1.1 Re-spawn
Now the action is the most important of this trigger. Because you cant do anything with a event and a condition on their own. Now this is the part that can have alot of different choices. You could place a region beforehand and use it for the respawn, if this is the case then the action would look like this.
This states that the trigger will create 1 unit that is the same type of the unit that died. This is the 3rd bulletin from the top. The second part makes the unit for the person who owned the unit who died. This is also the 3rd bullet point under the arrow.
Now lets put it all together.
Now one of the most useful features of GUI, variables. Variables allow you to store data. Similar to hashtables, but somewhat simpler.
First we will cover how to make a variable. There are 2 ways but i will show you the way i prefer.
Start out by going to actions and set variables as shown in the picture.
Now click on the thing that says Variable And then click on Edit Variables as shown in the picture.
Now Click on the Green X to make a new variable.
Now Pick a name, then select the drop down arrow and choose integer. Then hit enter twice.
Now you will see this. Click on Value and find Arithmetic, it should be the fourth one down from the second drop down arrow. You will see Value + 1 Click on Value and choose the variable you just created.
Once you have done this, hit enter 3 times. Now you should see this
Now that we have this set up, Lets incorporate it into the previous trigger we made.
1.3 If, Then, Else
Now we will cover, If Then Else multiple functions, there is a if then else single function, but i personally thing its a waste, considering it requires a "Else" and using Do Nothing takes up memory. Choose a new action and go down a few in the drop arrow and you will see If Then Else, multiple functions, choose this and it will show up as:
We will take the trigger we made before, and change it up a little to show you how this works.
Now that we have learned how to use variables, lets learn about indexing. Indexing is basically, creating multiple versions of a single variable that have their own settings. In example:
Where it says [] Array, check mark that box. Now your indexing is turned on, and you will notice it wont allow you to accept the variable unless you have set an index to it. You will also see that the grayed out box that says Size and a number next to it becomes dark and changeable. Ignore it because that is saying, what size do you want the index to go to, leaving it as 1 lets the index hit max possible size. You don't want to do this that is why we are going to learn how to recycle indexes.
1.5 Player Association
Now that we have established a basic kill counting system, lets attach players to those kills.
First we will need to create a variable for the player. Head back to edit variables and create a new variable. Make that variable an integer and check the array box.
**This is incomplete, i ran out of time and couldnt finish the whole tutorial, I will add more onto it when i come back.***
We will begin by going through the simplest Events, Conditions, and Actions.
1.0 Introduction
GUI is split off into 3 sections:
|
These govern what the trigger does. An Event is the bases of the trigger. The event is what happens in the game, to activate 1 trigger loop. Once a trigger loop is started, it goes into Conditions to make sure the trigger loop meets the conditions before it can continue. Once the conditions, which are like a criteria for the trigger, are checked and they all match with the activation they move on to the actions. The actions can do many things. But we will stick to simple things. An action is the action of the loop. It tells the game what to do when the loop happens. |
1.1 Re-spawn
Now we will cover re-spawning as our first section. Re-spawning is when a unit is created to replace a unit that has died. |
|
The unit Generic event is maybe one of the most commonly used events. It holds a variety of variations to it. For now we will use |
|
When a unit dies. The loop for our trigger begins. We can add a condition. The simplest is Boolean. |
-
(Triggering unit) is a hero equal to true
Now the action is the most important of this trigger. Because you cant do anything with a event and a condition on their own. Now this is the part that can have alot of different choices. You could place a region beforehand and use it for the respawn, if this is the case then the action would look like this.
-
Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at (Center of (<Your region>)) facing Default building facing degrees
-
Hero - Revive hero instantly
This states that the trigger will create 1 unit that is the same type of the unit that died. This is the 3rd bulletin from the top. The second part makes the unit for the person who owned the unit who died. This is also the 3rd bullet point under the arrow.
Now lets put it all together.
-
Events
-
Unit - A unit Dies
-
Conditions
-
(Triggering Unit) is a Hero equal to True
-
-
Actions
-
Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at (Center of (Playable map area)) facing Default building facing degrees
-
-
Now one of the most useful features of GUI, variables. Variables allow you to store data. Similar to hashtables, but somewhat simpler.
First we will cover how to make a variable. There are 2 ways but i will show you the way i prefer.

Start out by going to actions and set variables as shown in the picture.

Now click on the thing that says Variable And then click on Edit Variables as shown in the picture.

Now Click on the Green X to make a new variable.

Now Pick a name, then select the drop down arrow and choose integer. Then hit enter twice.

Now you will see this. Click on Value and find Arithmetic, it should be the fourth one down from the second drop down arrow. You will see Value + 1 Click on Value and choose the variable you just created.
Once you have done this, hit enter 3 times. Now you should see this
-
Events
-
Conditions
-
Actions
-
Set My_Variable = (My Variable + 1)
-
Now that we have this set up, Lets incorporate it into the previous trigger we made.
-
Events
-
Unit - A unit Dies
-
-
Conditions
-
(triggering unit) is a hero equal to true
-
-
Actions
-
Set My_Variable = (My_Variable + 1)
-
Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at (Center of (Playable map area)) facing Default building facing degrees
-
1.3 If, Then, Else
Now we will cover, If Then Else multiple functions, there is a if then else single function, but i personally thing its a waste, considering it requires a "Else" and using Do Nothing takes up memory. Choose a new action and go down a few in the drop arrow and you will see If Then Else, multiple functions, choose this and it will show up as:
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Then - Actions
-
Else - Actions
-
-
We will take the trigger we made before, and change it up a little to show you how this works.
-
Events
-
Unit - A unit Dies
-
-
Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(triggering unit) is a hero equal to true
-
-
Then - Actions
-
Set My_Variable = (My_Variable + 1)
-
Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at (Center of (Playable map area)) facing Default building facing degrees
-
Else - Actions
-
-
-
-
Set My_Variable_2 = (My_Variable_2 + 1)
-
Events
-
Unit - A unit Dies
-
-
Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(triggering unit) is a hero equal to true
-
-
Then - Actions
-
Set My_Variable = (My_Variable + 1)
-
Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at (Center of (Playable map area)) facing Default building facing degrees
-
Else - Actions
-
Set My_Variable_2 = (My_Variable_2 + 1)
-
-
-
-
Now that we have learned how to use variables, lets learn about indexing. Indexing is basically, creating multiple versions of a single variable that have their own settings. In example:
-
Events
-
Unit - Unit Dies
-
-
Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Triggering unit) is a Hero equal to true
-
-
Then - Actions
-
Set My_Variable[0] = (My_Variable[0] + 1)
-
Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at (Center of (Playable map area)) facing Default building facing degrees
-
Else - Actions
-
Set My_Variable[1] = (My_Variable[1] + 1)
-
-
-
-

Where it says [] Array, check mark that box. Now your indexing is turned on, and you will notice it wont allow you to accept the variable unless you have set an index to it. You will also see that the grayed out box that says Size and a number next to it becomes dark and changeable. Ignore it because that is saying, what size do you want the index to go to, leaving it as 1 lets the index hit max possible size. You don't want to do this that is why we are going to learn how to recycle indexes.
1.5 Player Association
Now that we have established a basic kill counting system, lets attach players to those kills.
First we will need to create a variable for the player. Head back to edit variables and create a new variable. Make that variable an integer and check the array box.
-
Events
-
Unit - A unit Dies
-
-
Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(triggering unit) is a hero equal to true
-
-
Then - Actions
-
Set My_Variable = (My_Variable + 1)
-
Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at (Center of (Playable map area)) facing Default building facing degrees
-
Else - Actions
-
Set My_Variable_2 = (My_Variable_2 + 1)
-
-
-
-
**This is incomplete, i ran out of time and couldnt finish the whole tutorial, I will add more onto it when i come back.***
Last edited: