Mortar Field

From Valve Developer Community
Jump to: navigation, search

A mortar field is an invisible platform which moves around the map, combined with random explosions on the area of the platform and a sound effect of an incoming mortar strike just before it hits.

Making the platform

The invisible platform must be a func_tracktrain. Create a thin 128 × 128 unit nodraw brush and tie it to func_tracktrain.

Name : MortarTrain
DisableShadow : yes
DisableReceivingShadows : yes
FirstStopTarget : MortarTrack1
StartSpeed : 500
MaxSpeed : 500

Go in flags, and check :

  • No Pitch (X-rot)
  • No User Control
  • Passable

Then place various path_track entities around the map (wherever you want your mortar to blow randomly). Their path must finally come back to its starting position.

Name the first path_track MortarTrack1.

Rigging the explosion

Above the platform, place various env_explosion entities. Make it so that there are three at the base placed diagonally, then up and up until there is only one env_explosion on the top of the stack. In other words, make it look like a pyramid of entities. However, leave some space between the env_explosions so it wont be too concentrated.

When they are place, select all of them and give them the following properties:

Name : ExplosionMortar1
Parent : MortarTrain
Magnitude : 180 (Its small, but there are a lot, so its a lot)

Go in flags, and check Repeatable.

Now you've got a quite big explosion. If it's too big for your taste, delete a few env_explosion entities.

If you want more effect, you can add an env_shooter and make it shoot gibs of rocks when the explosion occurs.

  1. Parent the env_shooter to MortarTrain.
  2. Pick the model from the debris folder.
  3. Simulate a physic and choose the rest.

Adding the sound effect

Now we should have an explosion moving around the map, but we want to add something to make it sound like an incoming mortar strike.

Put an ambient_generic in the air, approximately in the center of all the env_explosion entities.

Name : MortarIncoming1
Sound : The incoming mortar sound
Volume : 10
MaxAudibleDistance : 4500
SourceEntityName : MortarTrain

Then, if you want another sound for when the mortar hits, you can put another ambient_generic in.

Tying it all together

Place a logic_timer somewhere in your map:

UseRandomTime : yes
MinimumInterval : Your choice
MaximumInterval : Your choice

Then go in outputs:

Ontimer : MortarIncoming1  Playsound Delay 0
OnTimer : ExplosionMortar1 Explode   Delay 1

If you want to put an env_shooter in, just add

Ontimer : Env_shooter Shoot, Delay 1

Now, compile it and you should have a working mortar field!

See also