Overview:
Triggers are one of the more common and useful things to use in a map, so I'll
try to cover the basics. While this *is* a pretty basic tutorial,
I find it's best to start with "baby steps" and go from there.
First I'll cover the absolute basics, and then start to get more in depth.
Example map:
Intro to triggers (8K)
A trigger is something you put into a map that can respond to some event (usually the result of something the player or an NPC has done) and cause something to happen. Some common examples are a light switch for turning lights on and off, a button that opens and closes a door, and invisible areas that can "trigger" InfoLink messages, award skill points, and cause various types of damage.
Many triggers can be set up to respond to the player walking within a certain distance of the trigger, but some must be triggered by other triggers.
In this tutorial, we'll add a simple generic trigger that will cause an alarm panel to sound the alarm. The alarm unit and alarm light make interesting examples, since they will stop when the player steps outside of the trigger's radius.
Create a basic room, add a light and a PlayerStart, and rebuild. Now add an AlarmUnit to your map and set its Events -> Tag value to alarm1.
Now add a basic trigger. First select Trigger under Actor -> Triggers in the Class browser:
Then point to the floor of your room and hit the "A" key.
Next we want to set up two things on the trigger: what to trigger and the collision radius.
Right-click on your trigger and pull up its properties. Set Events -> Event to alarm1. Since that was the tag value of the AlarmUnit, you should now see a red line connecting your trigger with your alarm unit. At this point, your trigger will cause the alarm to sound when the player walks into it.
Often you will want to adjust the size of the trigger's detection range. But first, you'll want to enable Radii View in the overhead 2D window. Do that by pulling down the 2D window menu and selecting Actors -> Radii View.
Now when you select your trigger, you'll be able to see its collision radius as a red circle around the trigger in the overhead 2D view.
To adjust the radius, pull up the trigger's properties and set Collision -> CollisionRadius to some value. In the example map, I set it to 32 to match a circle on the ground. This value is in Unreal units.
You can also set the CollisionHeight value. In this example, you don't really need to, but there are times when it's handy. This time, enable Radii View in one of the other 2D views (a side view, not the overhead view). You'll see a side view of the collision cylinder, which shows up as a box rather than a circle. This will show you the collision height. I've altered this screen shot a bit so that the collision cylinder is more visible. It's pretty faint otherwise:
NOTE: The collision cylinder is not visible in the 3D window.
Run your map and step into your trigger's radius. The alarm should sound as long as you're standing within the radius value. That's it for the basics. I'll continue on just a bit more with some more detail.
In the example map, I added an alarm light and set its Tag value to alarm1, just to illustrate that you can trigger multiple actions with one trigger.
I also added a mover and set its Tag to alarm1 and its Object -> InitialState value to TriggerControl. This is kind of an unusual setting, as you would normally use TriggerToggle and use a "switch" type of trigger like Button1, Switch1, or Switch2 to allow a door to open and close. TriggerControl will leave the door open only when you're standing in the trigger's radius.
It's important to realize that not all triggers are listed under "Triggers" in the class browser and that they don't all act the same. Some of them are more suitable for toggling things on and off, some can't be activated by running into them (they must be triggered by another trigger), and some can *only* be activated by running into them.
Some examples of actors that can act as triggers:
Button1, LightSwitch, Switch1, Switch2, Trigger, Dispatcher, BeamTrigger
Some special purpose triggers (these are self-contained and trigger some action
by themselves):
GoalCompleteTrigger, DataLinkTrigger (NOTE: the term "InfoLink" is
used in the game), Teleporter, AllianceTrigger
Some actors that respond to triggers:
Movers, TriggerLight, most types of triggers
NOTE: In some cases, an actor has to be set up to respond to a trigger.
For example, you must set the Object -> InitialState property
of a TriggerLight to something for it to work.