- Joined
- Nov 23, 2008
- Messages
- 18
This tutorial assumes that you have basic knowledge of the trigger editor, terrain editor, and regions.
This tutorial will guide you through the steps in making a double-click hero selection system with only three triggers needed in the trigger editor.
Step 1: Designate a section of our map to where the neutral player's heroes will be. We will use these as the selectable heroes. I suggest surrounding the area in either boundary or raised ground. This will properly isolate the area for easier gameplay.
Step 2: We need heroes for the players to select in order to play the game. Place heroes in the area you have just designated. It is optional that you create rings of power below each hero, but this does add some decoration to the area.
Step 3: Place a region around the area containing the heroes. We need this so we can differ between these heroes and other heroes on the map. I named my region HeroSelectRegion.
Step 4: Create a new area for spawning the selected hero to take place. Make sure that you make another region here, too. My region name is HeroSpawn.
The triggers aren't very complicated, so it shouldn't be very hard even if you are a newbie. We need three separate triggers: one for the first selection event (click), another for the second, and the final is to time out the triggers so that both events must occur within a certain timeslot.
We will need one variable for these triggers. I like to use integers because they are the easiest to change. My variable's name is ClickCounter and it is an integer.
Our first trigger will look something like this:
Here would be the second trigger:
Our third trigger, the timeout trigger, would look like this:
Here is a map of the completed system, feel free to test it out, copy, or edit it. To modify it to accommodate multiple users, simply change the variable to an array and add the other player's events to the triggers.
This tutorial will guide you through the steps in making a double-click hero selection system with only three triggers needed in the trigger editor.
Step 1: Designate a section of our map to where the neutral player's heroes will be. We will use these as the selectable heroes. I suggest surrounding the area in either boundary or raised ground. This will properly isolate the area for easier gameplay.
Step 2: We need heroes for the players to select in order to play the game. Place heroes in the area you have just designated. It is optional that you create rings of power below each hero, but this does add some decoration to the area.
Step 3: Place a region around the area containing the heroes. We need this so we can differ between these heroes and other heroes on the map. I named my region HeroSelectRegion.

Step 4: Create a new area for spawning the selected hero to take place. Make sure that you make another region here, too. My region name is HeroSpawn.
The triggers aren't very complicated, so it shouldn't be very hard even if you are a newbie. We need three separate triggers: one for the first selection event (click), another for the second, and the final is to time out the triggers so that both events must occur within a certain timeslot.
We will need one variable for these triggers. I like to use integers because they are the easiest to change. My variable's name is ClickCounter and it is an integer.
Our first trigger will look something like this:
-
DoubleClickFirst
-
Events
-
Player - Player 1 (Red) Selects a unit
-
-
Conditions
-
((Triggering Unit) is A Hero) Equal to True
-
(Owner of (Triggering Unit)) Equal to Neutral Passive
-
ClickCounter Equal to 0
-
-
Actions
-
Set ClickCounter = 1
-
Trigger - Run Timeout <gen> (Checking conditions)
-
-
Here would be the second trigger:
-
DoubleClickSecond
-
Events
-
Player - Player 1 (Red) Selects a unit
-
-
Conditions
-
((Triggering Unit) is A Hero) Equal to True
-
(Owner of (Triggering Unit)) Equal to Neutral Passive
-
ClickCounter Equal to 1
-
-
Actions
-
Set ClickCounter = 2
-
Unit - Create 1 (Unit-type of (Triggering Unit)) for (Triggering Player) at (Center of HeroSpawn <gen>) facing Default building facing degrees
-
-
Our third trigger, the timeout trigger, would look like this:
-
Timeout
-
Events
-
Conditions
-
Actions
-
Wait (0.50) seconds
-
If (ClickCounter Equal to 1) then do (Set ClickCounter = 0) else do (Do nothing)
-
-
Here is a map of the completed system, feel free to test it out, copy, or edit it. To modify it to accommodate multiple users, simply change the variable to an array and add the other player's events to the triggers.