WiseCrush: Crushing Gordon
This tutorial was originally created by wisemx. It was originally posted on SDKnuts.net.
In this project:
- Gordon opens a set of Double doors to enter a large room.
- Doors close behind Gordon once inside.
- Walls begin to move towards him.
- Gordon gets squashed.
To create the moving walls that squash Gordon I’ve used func_movelinear
. This is a versatile entity which can be made to move in any direction. It can be used for elevators, lifts, doors and compactor walls like this.
One thing that causes a problem for many mappers is Move Direction (Pitch Yaw Roll). If you’re not sure about Pitch Yaw and Roll, (Y Z and X), take a look at this tutorial.
func_movelinear
brushes map spawn facing the wrong direction. When this happens press Alt+P in Hammer to check for errors. Typically if you do this and use the Fix option it will repair your brush.To create a func_movelinear
simply create a brush the size required, press Ctrl+T and choose func_movelinear
from the entity list then click Apply.
Both of the walls have the same name so we can easily trigger them together. Notice that half of the wall, the upper half, is textured with tools/toolsinvisible
. This creates an invisible part of the wall. I’ve done this to illustrate how you can give your func_movelinear
the appearance of a smaller size. In this project the walls doing the work appear to be much shorter than they are.
The properties for the func_movelinear
:
- Name: wall01
- Move Direction (Pitch Yaw Roll): 0 270 0 for left wall. 0 90 0 for right wall.
- Start Position: 0
- Speed: 12
- Move Distance: 160
- Block Damage: 40
- Sound played when the brush starts moving.: ambient/machines/wall_move1.wav (Only set this for one wall, or the sound will be twice as loud.)
160
.In this project I’ve used a trigger_once
to determine when the walls reach the center area. You can also use the output OnFullyOpen
from func_movelinear
. You decide what’s best for your needs, the outcome is the same.
To make sure only the walls can trigger that trigger_once
I’ve applied a filter. The entity filter_activator_name
is really simple to use and comes in very handy. This one has the name of the walls, wall01
, as its Filter Name keyvalue. The Filter Mode is Allow entities that match criteria.
Inside the large room is another kind of trigger, trigger_hurt
. When the walls reach the trigger_once
it will activate the trigger_hurt
. This is what will kill Gordon with a Damage Type of CRUSH.
The properties for the trigger_hurt
are:
- Start Disabled: Yes
- Damage: 999
- Damage Cap: 100
- Damage Type: CRUSH
- Damage Model: Normal
- Flags: Clients
When Gordon steps into this room I’m using a trigger_once to close the doors behind him and start the walls moving:
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
OnTrigger | double_doors | Close | 0.00 | No | ||
OnTrigger | double_doors | Lock | 0.00 | No | ||
OnTrigger | wall01 | Open | 1.00 | No |
Notice that I’m allowing enough time for the doors to close and lock before starting the walls a second later. Also notice the position of this trigger_once
, it is far enough away from the doors that Gordon doesn’t have time to jump back through the doors once it’s triggered.
I’ve placed some prop_physics
objects, pallets and crates, in the crushing area to illustrate they can also be squashed, and to offer a tip about in-game performance. I’ve given all of these props the same name with an output back to themselves so they all break at the same time:
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
OnHealthChanged | phys_objects | Break | 0.00 | No |
I’ve also applied the same wall filter so only the walls can damage them. The physics objects aren’t needed for the overall effect but if you do use breakable objects do be aware of the performance hit. Keep in mind that if you run this project but allow the crates/pallets to break independently you will experience a penalty on performance. (Porter's note: With current tech, this should be extremely marginal. This tutorial must have been made WAY back in the day.)
See also
- Example VMF It appears that the player doesn't actually die, and still has a little wiggle room.
- Example VMF backup