Suspended Object Trap

From Valve Developer Community
Revision as of 10:46, 12 September 2006 by Andreasen (talk | contribs) (Improved article. (Mostly templated it.))
Jump to navigation Jump to search

Introduction

An example of what this tutorial will accomplish.

This tutorial explains the process of creating a trap consisting of a heavy object suspended by a dynamic rope which can then be triggered to fall with devastating effect. This is an advanced tutorial covering entity creation, parenting, I/O configuration, keyframe editing, and flag manipulation. Overall completion time is estimated at 45 minutes to 1 hour.

The Source Hammer editor does not allow a user to directly attach an object to a rope. However, there is a workaround. The basic idea involves parenting the end of a rope to a secondary entity. This secondary entity is then used in conjunction with a few physics entities that measure the movement of the secondary entity and translate its movements back to the rope. We'll also be creating a trigger that will break the rope when it gets damaged causing the previously suspended object to crash down! Sounds complicated but don't worry, it'll make sense once it's done. Let's get started!

Entity Creation

Create the following entities:

Entity Placement

Place the following entities or brushes:


Entity Properties Configuration

Naming

Naming your entities is arbitrary - you can choose what names you want. For the purposes of this tutorial the nomenclature is:

As you can see, each entity has the prefix dynamicXX, followed by a descriptive suffix. This is a useful naming system when you have several dynamic systems and need to keep them separate.

Keyvalues for Rope Workaround

Here comes the tricky part where most errors are made. Set the keyvalues of the entities like this:


Class: move_rope
Keyvalues Comments
Name dynamic01_move_rope The name of the move_rope entity in this tutorial.
Next KeyFrame dynamic01_keyframe_rope
Slack 0 No slack.


Class: keyframe_rope
Keyvalues Comments
Name dynamic01_keyframe_rope The name of the keyframe_rope entity in this tutorial.
Slack 0 No slack here either.


Class: env_spark
Keyvalues Comments
Name dynamic01_env_spark The name of the env_spark entity in this tutorial.
Parent dynamic01_prop_physics_override Tie the spark effect to the prop_physics_override entity.


Class: phys_lengthconstraint
Keyvalues Comments
Name dynamic01_phys_lengthconstraint The name of the phys_lengthconstraint entity in this tutorial.
Entity1 dynamic01_prop_physics_override Tie the lengthconstraint to the prop_physics_override entity too.


Class: logic_measure_movement
Keyvalues Comments
Name dynamic01_logic_measuremovement The name of the logic_measure_movement entity in this tutorial.
Entity to Measure dynamic01_env_spark
Measure Reference dynamic01_move_rope
Entity to Move dynamic01_keyframe_rope
Movement Reference dynamic01_move_rope


Trap Trigger Creation

Time to change the func_button. First change its keyvalues like this:

Class: func_button
Keyvalues Comments
Name dynamic01_func_button The name of the func_button entity in this tutorial.
Parent dynamic01_prop_physics_override' Tie this entity to the prop_physics_override.
Disable Receiving Shadows Yes
Move Direction (Pitch Yaw Roll) 0 0 0
Speed 0
Lip 0


Now change its flags like this:

Flag
Checkbox-off.png Don't move
Checkbox-off.png Toggle
Checkbox-off.png Touch Activates
Checkbox-on.png Damage Activates
Checkbox-off.png Use Activates
Checkbox-off.png Starts locked
Checkbox-off.png Sparks


...and finally give it the following outputs:

My output Target entity Target input Parameter Delay Only once Comments
Entity-output-icon.png OnDamaged dynamic05_logic_measure_movement Disable 0.00 No
Entity-output-icon.png OnDamaged dynamic05_keyframe_rope1 Break 0.00 No
Entity-output-icon.png OnDamaged dynamic05_phys_lengthconstraint Break 0.00 No
Entity-output-icon.png OnDamaged dynamic05_env_spark Kill 0.00 No
Entity-output-icon.png OnDamaged dynamic05_func_button Kill 0.00 No