[Tutorial] Player and NPC controlled 50 cal.

There is no real mapping forum, so I figure I’ll just put this here. I saw a few people wondering how to set up the 50 cal. gun. Here is how you make a player controlled and an NPC controlled 50 cal.

Player Controlled 50 Cal. Machinegun

  1. Create a prop_dynamic.
    Name : 50cal_model
    Model: models/props_marines/50cal.mdl
    Tag Flags: Start with Collision Disabled

  2. Create a platform or prop (like a ammo crate), which is about 32 units high and put the 50 cal on top of it. At this height, the player and enemy grunts can use it standing.

  3. Create a brush with the “triggertool” texture. This is the field in which the player has to stand to control the turret, so make it big enough for the player to stand in and put it behind the gun handles. Make it into trigger_multiple.

Name: 50cal_control
Tag Flags: Clients (should be on by default)

  1. Create a new brush with the “toolsinvisible” or “nodraw” texture and make it: h: 16, w: 16, l:64 and put it inside the 50 cal model. Make sure it covers the entire length of the gun. Make this into a func_50cal. Now align the origin of the brush to the middle of the model (right above the tripod, there where the turret can turn)

Name: 50cal_gun
Parent 50cal_model (the model will copy the movements of the func_tank this way)
Contol Volume: 50cal_control
Tag Flags: Controllable, Non-Solid

Make sure the brush has the same angles as the model!

  1. Then connect the animations of the 50cal model to the yaw and pitch movement of the func_50cal by entering these values:
    Gun Base Attachment: aimrotation
    Gun Barrel Attachment: muzzle
    Gun Yaw Pose Param: aim_yaw
    Gun Pitch Pose Param: aim_pitch

  2. Now you’ll need to set the fire properties. You can experiment with different settings, but here is how I’ve set up mine:

Rate of Fire: 10
Damage per bullet: 15
Bullet Accuracy: Medium Cone

  1. More experimenting can be done with the movement of the turret, by setting the Yaw and Pitch. Yaw controls all horizontal movement and Pitchs is for all vertical movement. Range will determine how far you can turn the gun and rate controls the speed of the turn.

My settings of choice:
Yaw rate: 45
Yaw rang: 120
Yaw tolerance: 15
Pitch rate: 45
Pitch range: 15
Pitch tolerance: 5

  1. And you’re done! Go ingame and see if the turret behaves like you want it to. You might want to tweak some fire and movement properties to make it perfect for your setting. In Hammer it should look something like this now:

NPC Controlled 50 Cal. Machinegun
To make NPCs use the 50 cal. you’ll need to make a few additions and changes. First, create a 50cal by using the tutorial above. If you make a second 50cal like I do, make sure you use unique names for this second gun. For this my tutorial I’m using a prefix: npc_50cal_gun. Note that you don’t need to do this for the Attachment and Pose parameters of the func_50cal. If you’re not making a second 50cal, leave out the npc_ prefix.

  1. Create a human_grunt and put him right behind the gun in firing position.
    Name: npc_50cal_grunt
    Tag Flags: Long Visibility/Shoot

  2. Between the Grunt’s boots, place an info_target.
    Name: npc_50cal_manpoint

This is where the grunt will stand when he shoots the 50cal. Make sure it has the same view angle as the gun itself.

  1. In the func_50cal add the following:
    Firing Persistence: 2
    Firing Persitance2: 1
    Damage per bullet vs player: 10
    NPC Man Point: npc_50cal_manpoint
    Player Lock time: 1
    Tag Flags: Only Direct, Controllable, NPC Controllable, Non-Solid

  2. In the trigger_multiple (the control field):
    Tag Flags: Clients, NPCs

  3. Now create a trigger_auto. Set the following Output:
    OnMapSpawn > npc_50cal_grunt > FindNPCToManTank > npc_50cal_grunt

This will cause the grunt to take control of the 50cal at the start of the map. You can also set this up with a different trigger if you want him to start using the turret at a given time.

If you start the map now, the grunt will start using the turret after he sees you. There is only one draw-back. If you rush towards him and stand behind him, he’ll hold on to the turret, not able to fight you anymore. We want him to let go off the turret and fight the player with his mp5, once the player gets too close. Here is how that’s done:

  1. Create a brush with the toolstrigger texture and make it a trigger_once. Put it in front of the gun, so the player will touch it when he gets close. You can also create brushes along the side of the grunt’s position in case the player flanks him.

Create the following Output:
OnTrigger > npc_50cal_gun > ForceNPCOff

  1. All done! Compile and give it a try. Hammer should look something like this:

Hope these tutorials were helpful. You can download the example VMF here:
50 Cal Tutorial

Cool, I vote we make an actual BMS mapping forum to post this kind of stuff

Seconded! Lets go annoy some admins about it :wink:

It took a few weeks of persistent requesting, but we finally have our mapping subforum! :smiley:

For 40 days our people wandered through the desert… now we have our own place we can call home. :wink:

Does this work in multi-player? I can’t seem to get it working as of yet.

I tried to open to open the latest crossfire to see how the turrets work in that map. Couldn’t seem to open the map. Hameer kept timing out. Is that a func_50cal or a different setup?

From what I can tell (After a lot of testing) the only turret that works in MP is the func_tow_mp and .50 Cal. I’m not sure if a brush based gun can be used… All I tried was models with these.

The vmf is down. Could you upload it again?

Founded in 2004, Leakfree.org became one of the first online communities dedicated to Valve’s Source engine development. It is more famously known for the formation of Black Mesa: Source under the 'Leakfree Modification Team' handle in September 2004.