Car Explosions

From Valve Developer Community
Revision as of 20:23, 22 February 2006 by Ts2do (talk | contribs)
Jump to navigation Jump to search
Broom icon.png
This article or section should be converted to third person to conform to wiki standards.

Introduction

In this tutorial, I will explain how to blow up cars with smoke, explosions and nice effects. You need to have the basic knowledge of the Hammer Editor. This tutorial is not hard to follow, it is so easy that I figured it out as soon as I discovered the trigger_push.

The Car

To start, create a prop_physics_override

  • Name: Car1
  • World Model: (In the prop_vehicles folder, choose a car with a physic model.)
  • MinDamageToHurt: 90 (I'll explain later)

There, you have your car; put it ABOVE the ground.

To do more realism and more fun, we are going to put a fuel tank that blows the car if we shoot it.

Create a brush on the car where you want the fuel tank, choose a good texture for a fuel tank and make the fuel tank func_breakable.

  • Name: FuelTankCar1
  • Parent: Car1
  • MaterialType: Metal

You may want to make it circular or something.

The Effects

Now the explosions and smoke.

Create 5 env_explosion and put them at the 5 points of the car, like on a die. (Sides, front, back, and bottom.)

  • Name: ExplosionCar1
  • Parent: Car1
  • Magnitude: 100

Then create an env_physexplosion at the center of the car.

  • Name: PhysExplosionCar1
  • Parent: Car1
  • Magnitude: 500

Now, create an env_smokestack where you want the smoke to be, the engine is the better place :)

  • Name: SmokeCar1
  • Parent: Car1
  • Color: Choose it :P

The Thrust

We got explosions and physexplosions, but not enough to make a car fly! It's too heavy! So, create a brush at the center of your car, make it big enough to cover all the top of it, and it must start from the bottom of the car. Make it the trigger texture and TieToEntity trigger_push. Now make the trigger go as high as you want your car to fly.

  • Name: PushCar1
  • Parent: Car1
  • PushDirection: Up
  • StartDisabled: Yes
  • Speed: 1500
  • Flags: OnlyOnce, Physics, Pushables

Okay thats it for the trigger push, check that the Client flag is NOT enabled.

The Outputs

Okay, we got this mess, but nothing works! We must create the outputs!

First, go in the car's properties.

Remember the MinDamageToHurt? It makes the car ignore all damage less than 90. And 90 is the perfect amout for grenades, rocket but no other gun!

So, in the Outputs of the car, put:

Car outputs
My Output Target Entity Target Input Parameter Delay Only Once
Entity-output-icon.png OnHealthChanged ExplosionCar1 Explode <none> 0.00 Yes
Entity-output-icon.png OnHealthChanged PhysExplosionCar1 Explode <none> 0.00 Yes
Entity-output-icon.png OnHealthChanged PushCar1 ClearParent <none> 0.00 Yes
Entity-output-icon.png OnHealthChanged PushCar1 Enable <none> 0.00 Yes
Entity-output-icon.png OnHealthChanged SmokeCar1 TurnOn <none> 0.00 Yes
Entity-output-icon.png OnHealthChanged FuelTankCar1 Break <none> 0.00 Yes

Okay, I'll explain what we just did. We made that the car ignore damage less than 90, so if a damage ABOVE 90 is applied to the car, the explosions blow, the smoke starts, the fuel tank gets destroyed and the trigger push forgets his parents (if we leave him parented to car1, the trigger would follow the car as long as it goes up and it would never end).


Now the car is done, what about the Fuel Tank? Well just copy the outputs of the car and change the OnHealthChanged to OnBreak, like this:

Fuel tank outputs
My Output Target Entity Target Input Parameter Delay Only Once
Entity-output-icon.png OnBreak ExplosionCar1 Explode <none> 0.00 Yes
Entity-output-icon.png OnBreak PhysExplosionCar1 Explode <none> 0.00 Yes
Entity-output-icon.png OnBreak PushCar1 ClearParent <none> 0.00 Yes
Entity-output-icon.png OnBreak PushCar1 Enable <none> 0.00 Yes
Entity-output-icon.png OnBreak SmokeCar1 TurnOn <none> 0.00 Yes


You may wonder why I didn't put an output to disable the car outputs in case the fuel tank blows! Because the explosions inflict the damage to the car, so it happens TWICE :-D Now compile the map and test it, watchout where the car falls :P