Originally posted here: www.planetavp.com/modmaker/
Created by: William "modmaker" Bostjan
Mirrored here for archival purposes
The basic Trigger
- Player touch triggerable
- Remote trigger
Triggers are great but they need a random component. You bought this great game, and there's stuff you liked and elements you hated, and you heard people are making custom maps, and you want to do it too; besides, how hard can it be? You have got these great ideas, and you're going to show the pros that making a game is actually easy. Theres's a tendency to want to jump into the complicated stuff, but trust me, take the time and understand the basics. Yes, its boring! but if you learn the basics now, you wont be spending 2 weeks in about a month fixing all the mistakes you will inevitably make.
Triggers help involve the player with interaction.
Adding triggers is simple enough, messaging them to do interesting things is the real challenge. First thing you do is start up Dedit. Double click on the Dedit.exe. At this point you just have a map editor. Click, file, and open a world using the WORLDS TAB. Go to World, and click on the menu item ADD an OBJECT,
As you scroll through the list, you will come across Trigger, select it. A trigger object will be placed at the triple mark cursor. This trigger object default to a dimension of 16 16 16 dedit unit. While still highlighted if you click on properties, you can change the dimensions or dims, simply click on the field and change the numbers. Triggers will be invisible in game, they merely define an area where they trigger events when the bounding box of the player, or the bounding box of the AI make contact with that area.
So say you wanted to have a door open when you approach it. First off you have to create the door. (check the other tutorial) What is important is the name of the door. Let's assume you will create a sliding door, and it will be called Door27. Now you place a trigger object directly in front of
the door, with a dimension of 64 64 64. Triggers default to being PLAYER triggerable. The other important thing to set is the "number of activations". If you set this number to "0" there will be infinite triggers.
So far this is the basic set up, now we need to set the target. So in the propeties tab, find the target button and click. You'll see that there are multiple fields for multiple targets, and the developers have already graciously typed TRIGGER into the first one. We'll start with a simple message.
Ignore the other ones for now.
When the players bounding box intersects with the trigger area the door will open. You should place a 5 second delay on the trigger object before it can be activated again. Otherwise the message will keep being sent and cause jittering effects. Always take advantages of the question marks in the properties tab. Right Click and you'll get a description of what that property can do.
Let change it a bit.
Triggers default to being PLAYER triggerable. But in our case now we would probably want AI to be able to open the door as well, so if we look at the properties tab we'll set AI triggerable TRUE as well.
Now when the AI run to the door to chase the player, the door would open. You could also give the AI a script at the door so it looks like he pushed the switch for the door to make it open.
You have additional options. The trigger can be set; LOCKED=TRUE
When you LOCK a trigger, you can then send a UNLOCK message to it once an event happens.
The Trigger Object has various subsets. I'll discuss the EXIT trigger in the Single Player Tutorial. And the Laser trigger is a left over from NOLF's infrared sunglasses that can work but really isn't supported the way it was in nolf, in that you could see them in game with the special sunglasses gadget.
- Wall switches
- Light Switches
A subset of the Door object, switches contain many of the same properties. Yah, not really complicated stuff, but trust me, take the time and understand the basics. Yes, its boring! but if you learn the basics now, you wont be spending 2 weeks in about a month fixing all the mistakes you will inevitably make.
Remote switches can add significant variety to map design.
A SWITCH (subset of a door) can also behave as a remote trigger. Simplest way to do a switch break it into two parts, what you see on the wall, and what you activate. make a keypad brush texture it. in front of it, create an invisible brush and bind it to a switch(subset of the door object).
Link it to the door you want to open. done. (You should cancel the activation trigger on the door, so the only activation that can work is from the switch) Now switches in the actual game are more complicated, they send messages and change the textures that you see on the keypad. That's more advanced stuff. If you deconstruct one of the switches from the samples you can figure it out.
msg door34 trigger;
As you may imagine there is alot more to this topic.
This is classic TOMBRAIDER, pull the lever over here, opens the door over there.
Except these days, we as gamers expect a little more sensibility to our puzzles. They can't be haphazard, they should be believable within the context of the level.