WiseGibs: HL2 Prop control

From Valve Developer Community
Jump to: navigation, search

This tutorial was originally created by wisemx.

Ported from SDKnuts.net to VDC by: Pinsplash (talk) 05:01, 1 July 2018 (UTC)


In this tutorial control over props is explained, how to kill your prop and then spawn gibs for effect, plus a little dust puff just for that extra Source spice.

WiseGibs ingame.png

In the shot above the three trash cans are models\props_trainstation\trashcan_indoor001b.mdl. All three are prop_physics_respawnable but:

  • The one on the left can be thrown around and when it gets enough damage it will disappear.
  • The one in the middle will not move and does not take damage. (Porter's note: That's called prop_static.)
  • The one on the right will appear to break apart with the physics force direction and a puff of dust will appear.

Each of these has a specific purpose, allowing players to move props, making sure a prop stays put where it can be used as a stepping object or as an obstacle and the third example is for effect, which is one of the powers of the HL2 Source engine.

The flags for the left can are: Break on Pressure, Debris with trigger interaction

For the middle can:Don't take physics damage, Motion Disabled, Not affected by rotor wash, Prevent pickup, Debris with trigger interaction

The right-hand can:Prevent pickup, Debris with trigger interaction, Break on Pressure

One property is modified for the left can which will make it easier to control for this example. (Porter's note: Really not sure what he's talking about here cause I can't see his original images. Sorry!)

And we add one output to itself that will make it disappear when the health changes:

  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnHealthChanged TrashCan01 Kill 0.00 Yes

The center can does not get an output but we could still keep it in place and output events when it gets damaged.

The can on the right has multiple outputs:

  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnHealthChanged shooter1 Shoot 0.00 No
Io11.png OnHealthChanged TrashCan03 Kill 0.01 No
Io11.png OnHealthChanged TrashCan03Dust SpawnDust 0.02 No

The output for “shooter1” actually controls 8 env_shooter entities that all have the same name but different properties. All of them share the same Parent, the right-hand can. Each of them has a different model, which will be the pieces of our can. You have a lot of control with the env_shooter, sounds, force, direction, etc. Download the example below and look them over, it’s kinda fun to play with this entity. Our last effect when the right-hand can is damaged is our puff of smoke, thanks to the env_dustpuff which gets triggered by an output from this can.

  • Name: TrashCan03Dust
  • Parent: TrashCan03
  • Pitch Yaw Roll: -90 0 0
  • Scale: 8
  • Speed: 16
  • Dust color: 0 66 66

With these entities you can let your imagination go wild. The gibs can be a bit weird at times but with a little experimentation you can create some pretty slick effects. For example, imagine a crate that when broken will leave behind a bunch of bottles, giving the appearance that the crate was full of them. You could even throw in a few wood gibs around the bottles and make them disappear in 4 seconds but make the bottles remain for a few minutes. F.Y.I. players would be able to pick those bottles up with the Gravity gun and toss them around, a rather fun effect.

(Porter's note: prop_physics_respawnable is intended for Half-Life 2: Deathmatch only. It will work in Half-Life 2, but normally Hammer itself will not be configured to recognize the entity. You will be on your own for keyvalues, inputs, etc.)