Shooting anything in abstract form

This tutorial will show you how to shoot almost anything.

Bullets
Make an and use this table as a reference for the settings for each weapon. Since  won't do damage, the damage should be done with a.

Make muzzle effects with.
 * AirboatGunImpact
 * BloodImpact
 * cball_bounce
 * cball_explode
 * GlassImpact
 * HelicopterImpact
 * StunstickImpact
 * WaterSurfaceExplosion

Projectiles

 * 1) Make an entity from the list below and name it  (or whatever you want).
 * 2) Make a, name it  and set Template 1 to.
 * 3) Make an, and configure it however is needed for your projectile and use case (i.e. fire a crossbow bolt when a button is pressed).

Punting
Making a fake gravity gun punt is actually not terribly complex, though this setup is not quite 1-to-1. If the gravity gun-like object you're making is able to move, remember to parent all the triggers, visual effects, etc. to whatever the moving part is.

Make a over the area an object should have to be in to get punted. It should be very thin. Set these properties:

Set the flags how you wish, you'll probably want Physics Objects checked.

Make a inside the. Name it. Set the same flags, and make these outputs:

Make a, name it , set these outputs:

The last output won't do anything except temporarily disable the relay, to act as a refire rate. You can adjust the rate by changing the delay. Make sure Allow fast retrigger is NOT checked! Any other special effects you want should be activated from OnTrigger.

Now for the flashy bits! Make an where you want the punting beam to come from. Make sure it isn't in anything solid. Give it these settings (adjust as you wish, adapted from the Ep2 intro):

Make an and name it. Place it however is necessary so that the laser will point in the direction you want to punt objects.

Make an close to the gun and set these properties:

Make another  closeby and set these properties:

The gun is now fully ready to punt anything in its way. It will push multiple objects at once, but there's no perfect solution to that. When the time is right, send the TouchTest input to gg_checkforpuntables.

Grabbing
Make a similar to the first one, but bigger and longer. If you want to be accurate to the real gun, make it about 900 units long. Set these properties:

Make a and set these:

Make a small at the front of the gun:

Any grab-related effects, like beams, should be activated here from OnStartTouchAll.

Make an near the front of the gun, but a bit farther away than. Name it.

If your gun can move around, you need to make the next three entities so that this  moves with it:
 * Two more s. We'll call them   and.
 * A with these settings:
 * Entity to Measure:
 * Measure Reference:
 * Entity to Move:
 * Movement Reference: (moving part of gun)

Move the s so that they have the same distance between each other, and   and the moving part of the gun.

Make a :

Make a named   and set these:

Any trying-to-grab effects should be activated here from OnTrigger. Make sure Allow fast retrigger is NOT checked.

Make a named   and set these:

Any dropping effects should be activated here from OnTrigger.

Make an :

Flags: No Damage, Test LOS

To finish, a few sounds. Make an.

Another.

And another.

Last one.

That's everything. When you want to grab and drop stuff, send the Test input to gg_holding. The gun will try to grab objects for up to three seconds before giving up. Unfortunately, when the object is being held and it moves a large distance, it will teleport back to the spot it was grabbed at, and launch itself from there. Moving held objects long spaces will obviously not look good. There seems to not be any good solution to this.

Portals
has inputs for firing portals even when the gun isn't being held. Also see.

Strider cannon
As with the gravity gun, this setup is not exactly how the real thing works or looks, but it's close.

Make an where you want the gun to shoot. Name it.

Make a  and name it. The specific location of it in Hammer won't matter.

Make an :

Another sprite:

And one more:

Place the first two at the front of the laser's source. Place  at the same spot as.

Make an on the front of the gun:

Make another  where   is.

Flags: Start On

Make an named   and set Sound Name to.

Make another  named   and set Sound Name to.

Make a and give it these settings:

Make an at the front of the gun and give it these settings:

Since our projectile is capable of bouncing, we need a way to stop it from doing so. Create a which the projectile will always hit. A small one over the  from earlier would be ideal, but if the cannon is going to be aimable, it will have to cover every solid surface.

Flags: Everything (not including physics debris)

Make a called   and set Filter Name to.

Lastly, make a named   with these outputs:

Send the Trigger input to  to fire the cannon.

Bullets
Make an  and use this table as a reference for the settings for each weapon. Since  won't do damage, the damage should be done with a. If you want the gun to have tracers (unlike regular CSS guns), set the Tracer to Default, otherwise set it to  (avoids console spam when developer 1 is on). Despite the name, that tracer will not make muzzle effects.

Projectiles
CS:S grenades can be spawned, but they just bounce forever.
 * Flashbangs can be simulated, except for the muting part. The flash can be done with an or, and the ringing sound can be done with  (but you'll have to get your own ringing sound, cause CSS apparently generates the real one on the fly).
 * HE grenade explosions can be imitated with . Radius is ~320, damage 99.
 * Smoke clouds can be imitated with s.

Bullets
Make an  and use this table as a reference for the settings for each weapon. Since  won't do damage, the damage should be done with a. For tracers, machine guns use, rifles and smgs use  , and pistols don't use anything, so set them to   which only shows bullet impacts.

Rockets
Rockets can be spawned in with or  (recommended to use  and  with it). Set the speed to 1300.

Grenades
Manually-spawned grenades instantly crash the game. Smoke clouds can be imitated with s and a, and grenades can be imitated with s (radius ~350).

Bullets
Make an where you want bullets to go. Name it  and set the Transmit to client flag. Make sure the center of it isn't in anything solid.

Make an where you want the bullets to come from.

Particle effects:
 * : Normal
 * : Blue crit
 * : Red crit

Make a with these outputs:

Damage must be done with a.

Below is a list of the weapons, the sounds to play, and their refire rates.

Projectiles

 * 1) Make an entity from the list below and name it  (or whatever you want).
 * 2) Make a, name it  and set Template 1 to.
 * 3) Make an, and configure it however is needed for your projectile and use case (i.e. fire a rocket when a button is hit).

Unusable projectiles (might be able to imitate them with other entities):
 * Rescue Ranger and Crusader's Crossbow shots appear as huntsman arrows.
 * Other flare guns use the same entity as the regular one, and cannot have their effects changed mapside.
 * Loose Cannon and Iron Bomber grenades use the same entity as stock, and cannot have their effects changed mapside.
 * Dragon's Fury, Pomson , and Wrap Assassin projectiles instantly crash the game.
 * One of the bomb spells crashes the game when it hits a player.
 * Many spells will never do what they're supposed to.

Bullets
can be used to shoot things, but it's limited in a few ways and can't be manually controlled.

Make an where you want bullets to go. Name it  and set the Always transmit to client flag. Make sure the center of it isn't in anything solid.

Make an where you want the bullets to come from.

Particle effects:
 * : Normal thin white
 * : Thin white, longer streak
 * : Thick yellow + thin yellow
 * : Thick yellow
 * : Thick red + thin red
 * : Thick red
 * : Thin yellow + smoke puff trail + white smoke lines
 * : Thin yellow + smoke puff trail
 * : Thin yellow

Make a with these outputs:

Damage must be done with a.

Below is a list of the weapons, the sounds to play, and their refire rates.

Projectiles
None of Left 4 Dead's projectiles work correctly when directly spawned.
 * Pipe bombs can be imitated with an and an  using.
 * Grenades can be imitated with an.
 * Molotovs, vomit and vomit jars cannot be recreated.

Bullets
It seems that it's not possible to visually recreate Alien Swarm's bullets, so the visual portion of this will be a bit lackluster, since it has to make do with Half-Life 2's bullet tracer. Make an  and, if you're trying to emulate a particular gun, check the ingame menu for damage and fire rate stats. Since  won't do damage, the damage should be done with a.

Projectile

 * 1) Make an entity from the list below and name it  (or whatever you want).
 * 2) Make a, name it  and set Template 1 to.
 * 3) Make an, and configure it however is needed for your projectile and use case (i.e. fire a crossbow bolt when a button is pressed).

Cannot be made because they won't work right:

Turrets
Make an  and use these settings:

Actual turrets fire from two different spots. If you want the gun to fire from two different spots, copy the  and set Rate of fire to 0.2 for both of them.

Portals
has inputs for firing portals even when the gun isn't being held. Also see.

Bullets
Make an and set  to whatever you want. The entity will automatically fire with that weapon's fire rate, damage, and particle effects.

If the gun does not face east by default, you'll have to do this next part to make the muzzle effects point in the right direction. Make a and set this output.

will not play the gun's firing sound. Make an, uncheck the Is NOT Looped flag, and play one of the sounds below as rapidly as the fire rate.

Projectiles
Molotovs and grenades will bounce forever unless you add this output to the :
 * 1) Make an entity from the list below and name it  (or whatever you want).
 * 2) Make a, name it  and set Template 1 to.
 * 3) Make an, and configure it however is needed for your projectile and use case (i.e. fire a crossbow bolt when a button is pressed).

Be careful: If the projectile receives this input more than once, its explosion timer will reset.