First you need to decide what
triggered effect you will use. It can be something like opening a door, turning on/off a
light, or turning on another trigger. We will use several examples in our tutorial. We
will start by making a room that, when entered, causes a red light to turn on (like an
alarm), and a sound to play. Here is the room I
made for this purpose:
The Room
In this room Ive made a little area with loot inside (a bunch
of dispersion pistol power ups). I added spiffy lights and decorated. Now, I added a light
texture inside room and then added a Triggerlight (the one without the star by it). This
can be found under the light group in the classes browser. I changed the color and sytle
of the light so that it will pulse red when the alarm goes off, and then made the light's
tag Alarm. Also, set the initialstate in the object section to TriggerTurnsOn.
The trigger tag connects
it to other events
Now I added a trigger (found as Trigger under the Triggers in
classes). I then set up the following properties: Collision radius of 64 (this specifies
how far from the trigger you can be before it will turn on); Event->alarm (this means
it will trigger anything with a tag name of alarm, for us, the light); and TriggerOnceOnly
(since it seems silly for the alarm to turn off if you steal twice <grin>.
Set the collision
distances for the trigger
(Note: at this point Unrealed crashed so I tried
to remake the map close to what it was hehe)
Next, We will add in an alarm sound to match the flashing red
light. Navigate into the trigger section under classes, then specialevent. Don't expand
this group. Add in a special event or two wherever you want the sound to come from. Open
up its properties and change the sound to what you want (I chose alarm3 from AmbModern).
Then change its tag to Alarm (or whatever the light's tag is), and its initialstate to
PlaySoundEffect.
Now rebuild and try her out!
Lastly, we will add little additions to the alarm system.
Let's say that it will only go off if a button somewhere else is pressed, arming the
alarm. Start by adding the button (a mover). For info on making a mover, see the Movers tutorial. After setting up the
keyframes, edit the properties. Change the initialstate to bumpbutton (this will make it
act as a trigger when you approach it). Change its event to alarmsensor. Now go over and
edit your trigger's tag to alarmsensor, and change its initialstate to
othertriggerturnson. Under triggers, change initiallyactive to false. Rebuild and try the
new alarm system out.
Now let's be evil. Suppose a giant meat cleaver of death will
swing down and smash the theif whenever he steals the loot. (The cleaver of death shall be
a mover)
Cleaver of DooM poised
to strike!
Anyway.... :D The mover has two keyframes, one up top and one
after it has smashed you. Set the tag to alarm and make it crush when encroach (under
mover). Then set it to triggertoggle (so it can never possibly return since the trigger
can only be pressed once). Now try to nab those powerups...:D
Check out the map Colin created for this tutorial: triggers.zip (20KB) |