Tutorials

Explosive Mines



In this tutorial I will tell you how to add an explosive, invisible, underground mine to your map. This tutorial can be very customizable so you can change some settings to your liking.

Our mine will be underground, and when the or a player steps on it, it will explode. According to your settings it can automatically kill the player or weaken their health.

First we need to make a skybox room, creat a sand, dirt, or rock floor, and put in an info_player_start, ONLY at one of the corners of our floor.

news post image

So we made our setting, now we need to make the actual mine. Create a 48x48x80 box in the CENTER of the floor. Select it and cover it with our trigger texture. Then CTRL-T and make it a trigger_multiple, NOT a trigger_once or any other type of trigger.

Keyvalues:

Name: explosion_trigger1 (not necassary)
Delay Before Reset: 3 seconds is resonable if you ONLY WANT IT TO BE CONTINUOS

Flags to check:

Clients should be checked, but it can be unchecked if you want it to.

You can check anything else if you want to.

We then want to create the explosion entity. In the CENTER of your trigger_multiple make an env_explosion. ALT-ENTER and place the following keyvalues:

Keyvalues:

Name: explosion1
Magnitude: (The amount of damage you want the mine to do do the player, mine will be 150)

Flags:

Repeatable if you want the mine to be continuous.

All the other flags can be checked or unchecked to your liking.

news post image

Now the triggering.

Go back to the trigger_multiple and ALT-ENTER. Go to Outputs, click "Add" and type in the following:

My output named: OnEndTouch
Targets entities named: explosion1
Via this input: Explode

(Delay seconds can be added but not recommended)

NOTE: If the explosion is repeatable the trigger output "Fire once only" must NOT be checked.

Press apply and exit.

news post image

Now we want to add some realism. When a person gets off a mine there is a "tick" noise. Right after that tick the explosion happens.

Let's create an ambient_generic. Place it a few units above our env_explosion. ALT-ENTER and apply these Keyvalues:

Keyvalues:

Name: ambient_generic_tick1
Soundname: buttons/lightswitch2.wav
Volume: 10 (It's not a loud sound)
Max Audible Distance: 150

Flags to be checked:

Start Silent
Is NOT Looped

Press apply then exit.Now we have to trigger our ambient_generic.

Go back to our trigger_multiple, go to Outputs, click "Add" and insert the following:

My output named: OnStartTouch
Targets entities named: ambient_generic_tick1
Via this input: PlaySound

(There should be no delay seconds)

Under your trigger_multiple you should place a scorch decal so you know where the trigger you made is. Decals/scorch1 is good to use.

So there you have it! A fully exploding, ticking, and invisible mine. When the player enters the trigger_multiple the ticking sound will play, when the player leaves the trigger_multiple the explosion will go off, just like a real mine. Heres what it should look like in the end:

news post image

Of course some settings can be changed. This is good for open fields for a player or players to walk upon. This tut is very customizable so if you want to add more like displacements, change the trigger box to a cyclinder, or add an extra explosion sound it can all be done.

Save, compile, and have fun blowing your self up.

Spas12

View comments ( 2 )

Back to top