WiseExplosion: Explosions

From Valve Developer Community
Jump to: navigation, search


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

This tutorial is not meant to be used as is, although it could be. What I’ve tried to do is create a small example for more than one request I received.

Here’s the effect we’re going to create:

  1. Voice in background yells “Ah crap, Incoming!”
  2. Sound of incoming Mortar fire.
  3. Large explosion with ground shake and player damage.
  4. Resulting fire and smoke, fire will eventually go out.

To trigger this series of events I’m going to use a trigger_multiple placed in front of where the player will start. This part could be done with a switch or any other method with outputs. I’ve placed a brush on the ground in front of the player to indicate where the trigger is once the map loads.

These are the outputs for the trigger_multiple:(Porter's note: The vmf doesn't have any trigger in it...?)

You are probably aware that we could use this same method and our trigger could be a trigger_once plus our trigger_multiple has a very useful property Delay Before Reset that could be set to any convenient number.

Lets add our ground shake (env_shake):

  • Amplitude: 14
  • Effect Radius: 500
  • Duration: 1
  • Frequency: 1
  • Flags: Global Shake, Physics

Our explosion in this example is a quick group of 5 explosions, 4 of which are env_explosion and 1 is an env_physexplosion. The combination of these makes our mortar landing very realistic.

For the 4 env_explosions:

  • Name: Explode1 (All 4)
  • Magnitude: 100
  • Render: Additive
  • Flags: No Damage, Repeatable, Random Orientation

The one env_physexplosion:

  • Name: Explosion01
  • Magnitude: 500

This is a shot form Hammer of our trigger_hurt and you can see the layout of the explosions and fire.(Porter's note: Again, no triggers inside the VMF for some reason.)

Our trigger_hurt:

  • Start Disabled: Yes
  • Damage: 80
  • Damage cap: 20
  • Damage Type: Blast
  • Damage Model: Normal
  • Flags: Clients only

Our trigger_hurt is used for the proximity of the Mortar blast and we’re using outputs in our initial trigger to turn this damage on and off for a half second, just long enough to catch a player standing in the wrong place.

The 5 fire balls are not needed, our explosions will have a lot of fire in them but I’m using them in this tutorial to show how they can be triggered.

  • Class: env_fire
  • Name: Fire01
  • Start Disabled: No
  • Duration: 30
  • Size: I varied these, 55-65
  • Attack: Varied, .05-3
  • Type: Natural
  • Ignition Point: 10 (Not needed for this)
  • Damage Scale: 1.0

I’ve used three ambient_generic sounds for this, the explosions have their own sounds.

Download the vmf file for this tutorial, below, and play with these settings. There are other effects you could add to this such as a dust ball but with the 5 explosions used in this example the smoke, embers, sparks and sounds are all there. Places this could be used in a map are open to your imagination but you could create both serious and humorous effects. For example, download my Vending Console example and change it so each time the Saw blades come out they are launched with a big boom, kinda like in the cartoons.

See also