WiseLightShot: Light that can be shot out

From Valve Developer Community
Jump to: navigation, search


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

The first thing to consider is the prop you’re using. For this effect to work optimally the light prop should have more than one skin. Skins are used in props to change their appearance. Many light props have at least two skins, On and Off.

Skins in more detail.

For this project the HL2 Prop I’m using is models/props_c17/lamp_standard_off01.mdl. There are actually several methods you can use for this effect. For this project I’m using prop_physics for the lamp because we can add outputs to OnHealthChanged. When the lamp is shot the lights will now go out via our outputs but I’ve also added a bit extra with an env_shooter, which will toss some glass shards.

WiseLightShot setup.png

In the image above you can see:

  1. prop_physics with model models/props_c17/lamp_standard_off01.mdl
  2. env_shooter with model models/Gibs/Glass_shard.mdl
  3. light
  4. light_spot
  5. point_spotlight


Properties for the lamp (prop_physics):

  • Name: lamp01
  • World Model: models/props_c17/lamp_standard_off01.mdl
  • Skin: 1
  • Disable Shadows: Yes
  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnHealthChanged Shooter01 Shoot 0.00 No
Io11.png OnHealthChanged light01 TurnOff 0.25 No
Io11.png OnHealthChanged light02 TurnOff 0.25 No
Io11.png OnHealthChanged lamp01 Skin 0 0.75 No
Io11.png OnHealthChanged light03 LightOff 0.75 No


Glass shard effect (env_shooter):

  • Name: Shooter01
  • Parent: lamp01
  • Gib Direction: 0 0 0
  • Number of Gibs: 3
  • Gib Angle: 0 0 0
  • Gib Velocity: 50
  • Coarse Variance: 0.15
  • Gib Life: 4
  • Model: models/Gibs/Glass_shard.mdl
  • Material Sound: Glass
  • Simulate: Point
  • Gib Skin: 0

A point_spotlight, for the cosmetic glow effects around the lightbulb:

  • Name: light03
  • Parent: lamp01
  • Pitch: 90 0 0
  • Spotlight length: 256
  • Spotlight Width: 60
  • Color: 238 232 221
  • Flags: Start On, No Dynamic Light

Our light_spot, for directional light:

  • Name: light02
  • Pitch: 0 90 0
  • Brightness: 238 232 221 60
  • Appearance: Normal
  • Inner: 0
  • Outer: 54

Our light, for directional light:

  • Name: light01
  • Brightness: 238 232 221 60
  • Appearance: Normal

See also