Quake - Lesson 6 - More Triggers
Note: if you've never used BSP before, I suggest
that you review some of my
General BSP tutorials to get a feel for using the
editor. These tutorials for Quake-specific items will be geared to people who are already comfortable
with BSP.
In earlier lessons we've used triggers without
really explaining much about them. So I thought I'd take this lesson
and delve deeper into the trigger entity and show you some different
uses that can be applied to triggers. Download
this map
and load it into BSP and we'll get going.
Basically, a trigger is an invisible brush which
interacts with other entities (doors, lifts, even monsters!) to make
things happen in the Quake world. The list of things you can do with
triggers would fill several lessons, so I'll just focus on a few
things here. All triggers work pretty much the same way: when a player
touches the trigger, the target of the trigger activates. Now one
thing you might notice (you might have already noticed this). When you
make triggers in your level, you don't have to assign a texture to
them, since they're invisible. However, when QBSP runs, you might see
an error message complaining that 'ENTITY is not a texture' or
something similar. This is caused by having no texture assigned to a
trigger brush. If you want you can assign a 'TRIGGER' texture to your
trigger brush, but it's not required. As far as I know, Quake runs
fine without it, despite the error. 'Nuff said, let's make some
triggers...
In this lesson, we're going to make a secret room,
hidden by a secret door (duh). Let's start off by making the room.
Draw a 128x128 brush in the Top view, centered on (-640, -392). In a
side view drag the ceiling of this brush to 128 and make sure the
floor is at 0. Now make this brush into a room, with wall thickness of
8. (Remember you can edit the BSP.INI file to use the grid size as the
default wall thickness).
While all the brushes of this new room are still
selected, apply a texture of 'BRICKA2_2' to them. Switch to the Right
View and select only the floor brush. We need to drag the right hand
side of this brush over 8 units, to fill the space under the door
we're going to make. This is just like we did when we made our other
door in
BSP General lesson 4. With the floor brush
still selected, apply the 'FLOOR01_5' texture to it, so it will blend
in with our other floor.
Now we're ready to make our door. Select the wall
brush from our new room which is inside the wall brush of the room we
originally made. When you get the proper brush selected, subtract it
from the map, but don't delete it. This will make a hole in the wall,
but leave the brush in place so we can make it into a door. Now since
we want this to be a secret door, we don't want the player to know
it's there, so we need to change the texture to match the surrounding
wall. If you followed my suggestions in earlier lessons, the
surrounding wall has a 'TECH03_1' texture which is stretched to 2.0 in
the vertical direction (an SY value of 2.0). Go ahead and give your
new door brush this same texture (or whatever texture you used on your
wall). That way it will blend in and be invisible to the player.
With this door still selected, we might as well
make our door entity, so switch over to the entity window and make
this brush into a 'func_door_secret' entity with an angle of 180.
Let's also assign a key/value pair of 'wait' '-1'. That way the door
will stay open once it's triggered. Now if you want, you can switch
over to Quake and try out your level. The secret door works, but you
have to shoot it to open it. We'll fix that next by adding triggers,
hence the name of this lesson :-)
Let's make it so the player has to shoot two
buttons in order for the door to open. That way we can use the
'trigger_counter' entity. In order to do this, we'll need to make two
buttons, so let's draw a 48x48 brush in the Right View, centered on
(-120, 120). Assign this brush the 'SLIPTOPSD' texture. Now select the
side of the brush which faces out into the room and assign it the
'+2SHOOT' texture.
Switch to the Top View and draw your brush so that
the top left corner sits on (-912, -96). Before we make this into a
trigger, go ahead and copy the brush. Paste a copy and move it so that
it is centered on (120, 120) in the Right View and the top left corner
sits on (-912, 144) in the Top View. That should make our two buttons,
so now let's make them into triggers. Select one of the brushes (it
doesn't matter which one) and make it into a 'func_button' entity.
Assign a key/value pair of 'health' '1' and another key/value pair of
'wait' '-1'. This tells Quake that the button must be shot in order to
work and it will only be triggered once. When you get that button
configured, select the other 'button' brush and do the same settings
for it also.
Now, instead of linking these buttons to the door,
we want to make an intermediate trigger to use instead. If we linked
them to the door now, either one of them will open the door by itself.
This isn't what we want. Since we want the player to have to shoot
both of them, we need to make a 'trigger_counter'. Draw a new brush
somewhere inside the room. It really doesn't matter where, since it's
invisible, so just draw it somewhere out of the way, but make sure
it's inside the room. If it's out in the void, we'll have a leak to
fix!
Make this new brush into a 'trigger_counter' entity
and assign a key/value of 'count' '2'. This tells Quake that there are
2 separate triggers which must be activated. The 2 is the default
value and you really don't have to do this step, but I wanted you to
see how it worked.
Okay, we've got our door, our two buttons and the
counter; now let's link them together. To make this work properly, you
must link all these entities together in the proper order. Any trigger
that is improperly linked will not work. First, we need to connect our
buttons to the counter, so select one of the brushes and then
CTRL-CLICK on the 'trigger_counter' brush. This will link them
together. Now select the other button and link it to the
'trigger_counter'. That has completed the first step in making our
door work. We've linked the two buttons into one entity and made it so
that they both must be activated for the trigger to fire. Now we need
to link that to the door. To do this, select the 'trigger_counter'
brush and then CTRL-CLICK on the secret door brush. Voila! That's all
there is to it.
Now if you look in the top view, you should see
purple lines leading from each button to the trigger counter and
another purple line leading from the trigger counter to the door.
Here's what mine looks like. Your map may vary slightly depending on
where you drew your trigger counter brush.
Click to Enlarge
The yellow brush in the center of the screen is my
trigger counter. Notice how the purple lines lead from the two buttons
to this brush and then a single line leads from there to the door.
Okay, now run your map in Quake and play around
with your new buttons. Shoot one of them and you'll see a message
appear telling you that there's one more. Shoot the second one and the
message 'Sequence Complete' appears and the door opens. It doesn't
matter which button you shoot first, the result is the same. You might
be wondering how Quake knew to display these messages. That's because
they are built into the trigger counter entity. You can override them
by assigning a message key/value of your own, but it's not necessary.
Well, since this is a secret room, let's give the
player credit for entering it. Let's also move the grenade launcher we
drew earlier into this room so that it's hidden from the player at
first. It's usually a good idea to hide the better weapons and
artifacts from your player at the beginning of the game. This makes
the game more challenging as they search for bigger and better
weapons. Go ahead and select the grenade launcher entity and drag it
into the secret room, making sure that it remains sitting on the
floor.
Now, let's have Quake grant a 'secret' credit for
the player entering the room. Switch to the Top View and draw a brush
from (-704, -328) to (-576, -352). Switch to the side view and set the
top of this brush at 128 and the bottom at 0. Now switch over to the
entity window and make this brush into a 'trigger_secret' entity.
Assign two key/value pairs: 'sounds' '1' (makes a quick beep) and
'message' 'You have discovered a secret area!' (shows a message to the
player). Now when this trigger is activated, the player is granted
credit for discovering a secret and a message is displayed. Re-run
your level now and notice that the secret section of the status bar
shows you have discovered 0 out of 1. Enter the secret room and the
counter changes to 1 out of 1. Cool, huh?
Our secret room is cool, but it's
pretty dark. Let's put a light in this room, but have it turned off
until the player enters the room. To do this, we'll need to make a
light attached to a trigger. Make a light entity in the normal way. I
assigned a key/value of 'light' '150' to mine. Put this new light in
the center of your secret room, centered vertically and horizontally.
That way it provides light for the entire secret room. It's not too
bright, but provides enough light for the player to see the grenade
launcher sitting in the room. Once you've got the light created, click
the 'START_OFF' flag in the entity window. This will make the light
dark until it's triggered.
To trigger our light, let's make a trigger the same
size and location as the one we just made (the secret trigger). Make
this new trigger into a 'trigger_once' entity. With this new entity
selected, link it to the light you just created. Now when the player
enters the room, the light will come on at the same time the player
sees the message. Try it out and see for yourself. Pretty slick!
Now let's put an exit trigger at the back of our secret room. If you moved the grenade
launcher into this room earlier, make sure to move it near the
door, so it will allow the player to grab the weapon without exiting
the level. When you've got plenty of space near the back wall of this
secret room, switch to the Top View and draw a brush from (-704, -432)
to (-576, -456). In a side view, set the top of this brush at 128 and
the bottom at 0. That makes the brush fill the entire back wall of the
secret room.
Switch over to the entity window and make this new
brush into a 'trigger_changelevel' entity. Since we don't have a map
of our own to link to, let's go ahead and link this map to E1M1
(Slipgate Complex). Add the key/value pair 'map' 'e1m1' to this
entity. You could leave this key/value pair off if you want and the
current map will restart. If you want to link to some other map, enter
its name instead of 'e1m1'. Just enter the filename of the map, with
no extension.
You'll notice that there is a 'no_intermission'
flag available on this entity. If you set this, there will be no
intermission screen displayed when the player exits the map. I kind of
prefer seeing an intermission screen myself, so let's leave this flag
cleared. Now, we'll need to add an intermission spot. Quake uses the
player start location for an intermission spot if you don't enter one
of your own.
To add an intermission spot, switch to the Top view
and draw a 32x32 brush centered on (-464, 176). Make this into an
'info_intermission' entity and add a key/value pair of 'mangle' '25
-135 0'. Notice you don't have to set an angle flag. You use mangle
instead for this entity. If you understand roll, pitch and yaw, you'll
have no problem figuring out the x,y,z numbers for the 'value' portion
of this key/value pair, but it may take some trial and error to get it
just right. When you've got it set, switch to a side view and drag
this brush up until the bottom sits on 184 on the z-axis. Now, when
the player exits the level, he'll see a view of the second room. Of
course, you can have multiple intermission spots in your map; if you
do, Quake will pick a random spot to display. Cool, heh? Here's our
intermission screen:
Okay, now let's talk about some of the other
triggers available in Quake. We won't actually draw anything in this
part of the lesson, but there's a lot of important information. I
don't profess to know everything about all the triggers, but I'll help
you out with what I know. In addition to the triggers we've already
covered in earlier lessons, Quake makes available the following
triggers:
trigger_setskill
This trigger can be used to set the skill level of
your map. Remember in
BSP General lesson 3 I showed
you how to make different monsters appear at different skill levels?
Well, here's how you can let the player set the skill level for
themselves. You can set up a teleport-type brush (like in the Quake
start map), or you can attach this trigger to a switch or button; it's
really up to you. In order to set the skill level, add a key/value
pair to the trigger. The key is 'message' and the value is '0' (easy),
'1' (medium), '2' (hard), and '3' (nightmare!). That's all there is to
it! The level setting will take effect at the start of the next map,
so it's usually handy to make a start map before getting into your
main map.
trigger_relay
This trigger is fired by other triggers (it can't
be touched by the player). It allows you to have multiple actions take
place when the player trips a single trigger. In order to have it
fire, make it the target of another trigger. For instance, when a
player enters a room, you could have the lights go out, a crusher
activate and a door open, all in sequence rather than at the same
time. You can set a delay value for each trigger so that they will
fire in sequence. Each trigger can have it's own message if you want
and as far as I know, there's no limit to the number of relays you can
string together. Just remember you don't want your player standing
there watching stuff happen for 20 minutes :-)
trigger_monsterjump
This trigger can be used to ambush unsuspecting
players. When triggered, the monster touching it will jump in the
direction set by its angle flag. You can use this to have monsters
jump off ledges to surprise players. If you've ever played the
Critters map by Jim Lowell you know this can be used quite effectively
to scare the hell out of a player! You can also set the height the
monster jumps with a key/value pair.
trigger_hurt
This trigger can be used to damage a player. Used
in conjunction with a trap, you can inflict the amount of damage set
by the 'dmg' key/value pair. You can set doors and lifts to provide
damage of their own, but this trigger can be used in instances where
there is no damage flag available on an entity.
trigger_onlyregistered
This trigger will fire only if the player is
playing the registered version of Quake. I'm not sure why this is
here, because you can't play custom levels with the shareware version
anyway, but here it is. If the player doesn't have the registered
version, you can have a message displayed here, admonishing him to
upgrade, naturally ;-)
Well, over the course of this lesson and the ones
prior to it, we have covered every type of trigger entity available in
Quake. By now you should have a strong grasp on how to use BSP and
have enough tools available to make a complete map on your own. Since
we're done with our tutorial map now, we won't be using it again. In
future lessons I'll be demonstrating techniques in a more detailed
fashion, but we won't actually be drawing a map per se.
One more thing before we leave this map. We haven't
given it a name! Make sure no brushes are selected and switch over to
the entity window. Since no brush is selected, you should see the
Worldspawn entity displayed in the middle of the entity window. Add a
key/value pair of 'message' 'Tutorial Map'. This will now display a
title on the status bar of our map. While you're at it you can set the
world type: 0 for medieval, 1 for metal, and 2 for base. This must be
set if you want to use keys in your map (it controls whether you see a
key or a keycard, for example). You can set which CD track to play
here too if you want.
Well, that should give you an overview of triggers.
Hope you found it useful.
This site is designed for 800x600 resolution, and is best
viewed in Netscape 4.0 or above with 16bit color or higher.
BSP is the sole creation of
Yahn Bernier. I am only a
dedicated user, reporting news and making tutorials so Yahn can spend more
time enhancing BSP.
This web page was created and is being
maintained by me (DeadMeat). Unless otherwise noted, all content appearing on this site
was written by me. Also, 'DeadMeat's BSP Tutorials' were created entirely by me. All unauthorized use is
prohibited. (c) 1997. So there :-P