The Combine thumpers were used in the Half-Life 2 single player game to keep away antlions, but they can also be used as a nifty sci-fi themed prop. This tutorial will show you how to use them in both situations. In the process, we will use several entities that you probably haven't encountered before, so it might be worthwhile following this tutorial through for fun!
Antlion thumpers
For this part, we need three things- a
prop_thumper, a button to turn it on and off, and something that keeps the enemy at bay.
We start with said
prop_thumper; all we need to do here is give it a
name (e.g.
thumper1) and of course decide whether we want a big or small thumper (the larger model looks better with the larger dust cloud, and similarly for the small thumper).
Next, our button that turns the device on and off when we press a button (this setup is easily modified to stop the player from turning it back on again). Create a
prop_dynamic using the
world model models/props_combine/CombineButton.mdl, call it
thumper1_button, and set
collisions to be
not solid so it doesn't get in the way.
We now need a
func_button, textured with TOOLSINVISIBLE, that the player will actually use: set
sounds to something like
combine blip growl, and the
delay before reset to
6. We will deal with the outputs of this and others after creating all the required entities. Next, make a
logic_branch entity named
thumper1_branch, and with an
initial value of
1. Now create two
logic_relay entities: one called
thumper1_relay_on, and the other
thumper1_relay_off (and make sure that they are not set to start disabled).
Finally, we need the device that keeps away the enemy. For antlions, they are scared off by the
ai_sound entity with
sound_type set to
thumper, so make one of these named
thumper1_scare and the
location proxy set to
thumper1 (since you can't specify any distances here, this may require some level tweaking to get working properly! You should also note that this can only be turned off, so is not "reusable"). If you want to keep away other types of enemy, make a
func_brush textured with the TOOLSNPCCLIP texture, call it
thumper1_scare and make sure that
solidity is set to
toggle.
Now onto the outputs. Go back to the func_button, and add two outputs:
1)
OnPressed target
thumper1_branch via
Test
2)
OnPressed target
thumper1_button via
SetAnimation :
press
Edit the logic_branch and add these outputs:
1)
OnFalse target
thumper1_relay_on via
trigger
2)
OnFalse target
thumper1_branch via
SetValue :
1 (after a delay of
0.1)
3)
OnTrue target
thumper1_relay_off via
trigger
4)
OnTrue target
thumper1_branch via
SetValue :
0 (after a delay of
0.1)
(This setup will thus either fire the on or off relay for the thumper, depending on the state of the logic_branch)
Edit the logic_relay named
thumper1_relay_off and add these outputs:
1)
OnTrigger target
thumper1 via
disable
2)
OnTrigger target
thumper1_button via
SetDefaultAnimation :
idle
3)
OnTrigger target
thumper1_scare
This third output depends on how we're keeping away the enemy: if you're using the ai_sound method, then you'll have to
kill it, or for the func_brush use
disable to stop it from blocking NPCs.
The last step is to edit the other logic_relay, and add triggers as above but enabling the thumper (and func_brush, if you've used it). And we're done!
Thumpers without dust
This route will be somewhat easier than the last one- we simply have a prop trigger a sound and a shake when it completes its thumping animation.
Start with a
prop_dynamic entity, named
thumper2, which uses one of the thumper models (in the
props_combine/ directory). Create a
logic_relay, named
thumper2_loop.
Next, make an
ambient_generic named
thumper2_sound, with the
sound name ambient/machines/thumper_hit.wav. Set a very large
max audible distance or make another ambient_generic, or else it will sound quieter than expected! You can also set the
SourceEntityName to be our thumper,
thumper2.
We also need an
env_shake named
thumper2_shake. Again, specify a large
effect radius, a short
duration (e.g.
0.4) and a mid-range
amplitude. Obviously, these values will need testing in game and tweaking until they feel right! Tick any flags that you think will look good, too.
Now, if you don't have one in your level, place a
logic_auto entity to start the thumping when the map begins (or use some other trigger if you don't want this to happen). Add an output which looks like this:
OnMapSpawn target
thumper2_loop via
trigger.
Edit the logic_relay and add these two outputs:
1)
OnTrigger target
thumper2 via
SetAnimation :
idle
2)
OnTrigger target
thumper2_loop[b] via [b]trigger (after a delay of
2.82).
Finally, add these two outputs to your prop_dynamic thumper:
1)
OnAnimationBegun target
thumper2_sound via
PlaySound
2)
OnAnimationBegun target
thumper2_shake via
StartShake
Unfortunately with this method, there isn't a way to have the thumper slow down/speed up when turned on and off- this is reserved to the prop_thumper entity. If you're quick, you may also notice that there's a very very slight delay between the thumper hitting the ground and the sound being made (perhaps less than 0.01 seconds) but this probably due to delays in the I/O system of the Source engine rather than anything else.
Spice it up with some lights and wires or oil decals and we should end up with a cool looking sci-fi prop: