WiseCollapse: HL2 Collapse

From Valve Developer Community
Jump to navigation Jump to search


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

Introduction

We all like blowing stuff up in HL2, right? :D

This tutorial is the result of multiple requests I’ve received. I’ve tried to tie several subjects of interest into this one tutorial.

There’s a lot to a project like this. Besides the objects mentioned I also experimented with the proper lighting in each area of this project, the exact placement of Mossman and the objects in her office so she and they will fly in the directions I wanted. There’s a lot more you can do with this. The floor can be damaged, part of the ceiling can fall in, one of the electrical panels outside the hidden office could catch on fire in the explosion, etc. Compile the project and run a few tests with changes to the entities I used, make changes to the broken wall sections, put a hole in the floor, just have some fun with it and learn in the process.

Let's begin.

Creation

In this project I recreated the vending machines entrance from HL2’s d1_trainstation_05. I’ve also recreated Dr. Mossman’s office and have blended it in, hidden behind a wall.

With that foundation we can experiment with:

  1. Triggering events
  2. Explosions
  3. Fire
  4. Smoke
  5. Wall destruction
  6. NPC death
  7. Blockades
  8. Rubble

The first thing I did was to create the building and all of the props. Then I chose the walls that would be destroyed. This may seem crazy but it can help, build your destroyed areas and then destroy them. In this project we’re going to destroy some sections later as well, with the help of a trigger.

You may want to check out Grouping and VisGrouping. It can be a tremendous help to temporarily hide certain objects. In this tutorial the only tool I used for the destruction is the Clipping tool. Check WiseClipPlane for usage.

These are the settings for the trigger_once:

  • Start Disabled: No
  • Flags: Clients

The settings for the breakable wall are important. In this project I’m breaking the wall with the explosions but you could also flag the wall to only break with a trigger, and in a trigger like this one you could set an event to break the wall, this will help to keep the wall from breaking at the wrong time.

The settings for the func_breakable wall:

  • Prop Data: None
  • Strength: 80
  • Material Type: CinderBlock
  • Gib Direction: Relative to Attack

Inside Mossman’s office I’ve placed a gib shooter. You could also use this same method to shoot body gibs, or more debris. The one I’ve used here will shoot a large concrete section across the room.

The gib shooter is called an env_shooter, and these are the properties:

  • Name: Shooter01
  • Gib Direction: 0 266 0 (Experiment with the direction the gibs will fly.)
  • Number of Gibs: 1
  • Gib velocity: 600
  • Gib Life: 300 (Seconds)
  • Model: models\props_debris\concrete_chunk06d.mdl
  • Material Sound: Concrete
  • Simulate: Physics

I’ve used two kinds of smoke for this project.

env_ar2explosion (AR2 explosion visual effect. Big, volume-filling brown cloud. Does not cause damage or emit sound.):

  • Name: ar2Exp01
  • Particle material: particle\particle_noisesphere

env_smokestack:

  • Name: rock_smoke
  • Initial State: Off
  • Spread at the base: 20
  • Spread speed: 30
  • Speed: 30
  • Particle start size: 15
  • Particle end size: 50
  • Emission rate: 20
  • Length of smoke trail: 180
  • Wind Speed: 20
  • Particle material: particle\SmokeStack.vmt
  • Base Color: 124 124 124
  • Translucency: 255

There are so many settings for env_smokestack you would do good to experiment with all of them. Used in conjunction with the env_ar2explosion entity it adds the effect needed for this project. Even if you only use one smoke effect I would stick with the env_ar2explosion.

I’ve used two types of explosions in this project, env_explosion and env_physexplosion. Both of these entities create explosions and when used together they provide a nice effect.

env_explosion

  • Name: Explosions01
  • Magnitude: 200
  • Flags: Random Orientation

env_physexplosion

  • Name: Explosions02
  • Magnitude: 200

The fire entities I used are only inside the one broken office wall. The explosions provided a lot of fire, these are the after effect.

Our env_fire, the standard fire-emitting entity.

  • Name: Fires01
  • Start Disabled: No
  • Duration: 25
  • Size: 44
  • Attack: 4
  • Type: Natural
  • Flags:Start Full, Delete when out

An ambient_generic for the sound of metal crashing:

  • Name: soundmetal
  • Sound name: d1_town.CarHit
  • Flags: Start Silent, Is Not Looped

On the ground in the office I’ve placed a prop_static that appears to be broken wall pieces.

  • World Model: models\props_debris\concrete_debris256Pile001a.mdl
  • Collisions: Use VPhysics
  • Disable Shadows: Yes

This won’t be seen until the wall is broken in the explosion.

See also