WiseCrush: Crushing Gordon

From Valve Developer Community
Jump to: navigation, search


Before Gordon enters the room.
After Gordon is crushed.

This tutorial was originally created by wisemx. It was originally posted on SDKnuts.net.

In this project:

  1. Gordon opens a set of Double doors to enter a large room.
  2. Doors close behind Gordon once inside.
  3. Walls begin to move towards him.
  4. 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.

Tip.pngTip:If you’re still not sure, there’s an easy method you can use. Create several of them with different Move Directions and compile you map. One of them should be moving in the direction you need. (Porter's note: Most directional entities will show a little yellow line from their center pointing in the direction they will travel. You can also check the direction by looking at the little black circle in the Properties window, which shows the direction of travel that would be seen from the top (x/y) 2D view).
Note.pngNote:At times your 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.)
Tip.pngTip:To determine the needed Move Distance create a temporary brush the size of the distance you want your func_movelinear to move. Use this as a ruler by noting the unit dimensions; then delete this temporary brush. In this project there are 174 units from each wall to the center of the room. I don’t want the brushes to touch because it looks odd when Gordon dies between them, so I’ve allowed some space for the corpse by using a Move Direction (Pitch Yaw Roll) of 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
Io11.png OnTrigger double_doors Close 0.00 No
Io11.png OnTrigger double_doors Lock 0.00 No
Io11.png 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
Io11.png 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