Tutorial: More Complex Triggers Last edited 1 year ago2022-09-01 11:47:23 UTC

✔️ Download example map

The Scene

You start the level with the elevator sitting where it is in the image. You move onto the elevator and press the button. The elevator moves upwards until it reaches the top of the rails, where it stops. There is a pause of a few seconds, then a groaning noise and the elevator begins to fall slowly back down. A few seconds later, an explosion occurs down below, which shakes the area. Suddenly, the elevator drops, at high speed, and hits the bottom. This causes another explosion, which kills anyone on the elevator.

So, how does it all work?

The Relay

Well, the map is basically made up of trigger_relay entities. These entities can be used as a link between something and the thing that the something is meant to cause. This is useful because you can add a delay value, meaning that there can be a pause between events. As well as that, these entities can all have the same name, so one object can trigger lots of others at different times. I could probably have replaced all the relays with one multi_manager, but I didn't.

Setting up the Elevator

So anyway, this is how the sequence of events works: The elevator is a func_train. Its name is elev and its first stop target is elev1, which is a path_corner entity. The center of the elevator will always start off at the beginning of the level at the center of the first stop target, not at the point where you create the brush. This means that the elevator brush could be floating in the air, but it would be on the floor at the beginning of the level (I will explain why this is useful later). The func_button entity doesn't need a name in this map, but its target is elev (the func_train). The flags and other values of the button entity are quite straight-forward, and I think they were covered in the WorldCraft tutorials. So, when you press the button, the elevator starts. The path_corner that is called elev1 had elev2 as its next stop target. The path_corner that I named elev2 is at the top of the rails. Now this is where it gets more tricky. The elev2 entity has an important flag, wait for retrigger. This must be active in this map for it to work properly. The target name for it is sparks (I was originally going to use sparks).

The Action Part 1

All the trigger_relay entities have the name, sparks so they therefore all get triggered at the same time by the elevator. The important values that they have are their delay before trigger values. The first two have the same delay: 4 seconds. One of those targets the elev and the other triggers sound. Because the path_corner named elev2 had a new train speed value of 12, the elevator, once retriggered, would move slowly down to the next target - elev3b (named b to easily identify that it stops first). So as the train begins to move downwards, after a 4-second delay, we hear a sound. The only way to find out which sound to use is by looking into the Half-Life PAK . The ambient_generic entity (sound) has a lot of weird looking attributes that can just be ignored. Make sure in the flag is NOT looped is ticked and you can play around with the radius.

OK, we're half-way.

The Action Part 2

The other trigger_relay has explo as its target and a delay of 10 seconds. There are two entities named explo. One is an env_explosion and the other is an env_shake. They are both quite simple to set up. Play around with the env_shake attributes to get the best effect. (env_shake causes the screen to shake for the specified amount of time and at the specified frequency, creating a pretty cool effect.) The next trigger_relay which comes into action is the one with the delay of 15 seconds which reactivates the elevator again. This time, because of the high new train speed value of the elev3b entity, the train shoots down. When it reaches its target (elev4b) it stops because elev4b has no target. The value in elev4b for fire on pass is blow. This means that when the func_train gets to this path_corner, it will trigger another event. This one is another explosion, with a larger magnitude, placed just above the starting point for the elevator, ready to kill anyone in the area!
And that's it!
A more complex setupA more complex setup


You must log in to post a comment. You can login or register a new account.