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
-
Create a prop_dynamic.
Name : 50cal_model
Model: models/props_marines/50cal.mdl
Tag Flags: Start with Collision Disabled -
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.
-
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)
- 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!
-
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 -
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
- 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
- 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.
-
Create a human_grunt and put him right behind the gun in firing position.
Name: npc_50cal_grunt
Tag Flags: Long Visibility/Shoot -
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.
-
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 -
In the trigger_multiple (the control field):
Tag Flags: Clients, NPCs -
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:
- 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
- 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