Creating a New Trigger Guide

I decided to take a step back for a second and go over how to create a basic trigger. For this example we will simply give player 1 100 minerals anytime he kills a unit.

If you haven’t already seen it, I recommend you check out “basic triggers overview” here: Basic Triggers Overview

1) With your trigger editor open, right click on the left pane, go to new and select trigger.

The first thing you are able to do is give your trigger a name.  In the future it is important to name them something meaningful so you can distinguish it from others.  You may have dozens if not hundreds of triggers when your map is complete.

2) For now I will simply name “Test Trigger” by typing when it is blinking, click off of it when finished.  You can right click on the trigger and rename if you want to change the name.

Creating an Event

The first thing you will want to do is add a new event.  As I said in the triggers overview, an event is used to tell a trigger when to fire.  We will set our first trigger to Any Unit Dies.

1) To do this, right click on Events on the right side pane.

The new event dialog box will appear.  There is a lot of stuff to choose from, and thankfully the map editor is well organized.  As you can see the events are organized in a meaningful way.  You can either navigate with the “Find” box in the top right, or you can select a category in the left, or even combine the two.  Just be careful you don’t accidently enter stuff in the text box as it will make some triggers not appear.

2) For now go to the unit category on the left:

3) On the right, select Unit Dies.

4) Press ok when you have it selected.
Now you can see that it takes you back to the previous screen and a new event appears under event.  Here you are given the option to further customize the event on the bottom pane, for example, if you click the green link you are able to select a specific unit or unit variable.  Right now the default is any unit.  We will leave it at that.

Creating a Condition

Now we are ready to set up a condition.  Much like you added an event, right click on the condition, go to new and select new condition.  The condition dialog box will show up.  Conditions are a little more complex than selecting events, as they have many values that can be filled in. By default it opens with a Comparison type condition selected, which is what we want.  At the bottom part of the window is where you select the type of comparison condition that you want.  It is kind of hard to see at first, but you need to double click where it says “Value 1: Owner of Unit” if you wish to change the condition.  For now, we will use this, but we need to change the unit that allows the condition to pass.

1) Double click where it says “Unit: Triggering Unit and change this to “Killing Unit.”

2) Press OK and OK again.

Giving the Trigger an Action

We now have a trigger than fires when a unit is killed and passes if the killing unit was owned by player 1.  But it doesn’t actually do anything at this point.  To make it do something, we need to add an action.

1) Right click on the Action much like you do condition and event above, and select New > Action.

2) Narrow the category by selecting player on the right.

3) Select Modify Player property and press OK.  We can see the action has been created with default settings.  It is close to what we want.

What we want to do is add 100 minerals to the players current mineral count, not set their minerals.

4) Click on where it says Set To and change this to add.

5) Click on 1000 and change this to 100.

You are finished with your first trigger!

To Test Your Map

1) Go back to the map, place a bunch of units for player one.

2) Place a bunch for player 2.

3) Go to File > Test Document to launch your map.

Everytime you kill a unit from player 2 you should get 100 minerals!

Related posts:

  1. Basic Triggers Overview Guide
  2. A Simple TD Part 7: Creating Waves and a Countdown Timer
  3. A Simple TD Part 4: Creating a Builder Unit and Data Editor Overview
  4. A Simple TD Part 3: Creating Waypoints for Enemy Units