category
General Half-Life 2/Entities
description
Lay down a wall of fire with a mounted weapon.
keywords
mounted, machine, gun.
Make a room for your MMG. I suggest a long corridor with a bunch of zombies up one end. Put in an info_player_start and an item_suit up the other end.
Make a little barricade wall, 36 units high, near the info_player_start. This will be what your machine gun is mounted on. Place a prop_dynamic on top of this little wall. Make sure the center of the prop_dynamic is over the centre of the wall (top view), and the top half of the prop_dynamic is sticking up out of the top of the wall. Just for this tutorial, make sure the prop_dynmic faces east. Properties you have to change:
Name: Whatever you want (im going with gun1)
World Model: models/props_combine/bunker_gun01.mdl
Default Animation: idle_inactive
Thats it for the prop_dynamic. No flags or anything have to be changed so we'll move on to the entity that actually does everything, the
func_tank.
Ok this is the hard and complicated bit:
A) Make a small box (any texture, it will be invisible in the game) 8 units wide, 8 units long and 16 units high. The base of this box must be ONE unit above the top of the wall.
B) Tie this box to a func_tank. In the old Half-Life, this entity served as a controlable mounted gun. It serves the same purpose in Half-Life 2, but in HL2 the func_tank uses the prop_dynamic as the visible gun. Properties to change:
Name: Whatever you want (im going with gun1_tank)
Parent: The name of the prop_dynamic (gun1)
Control Volume: gun1_controls (we'll set that up later)
Yaw rate: 200
Yaw range: 60
Yaw Tolerance: 15
Pitch rate: 120
Pitch range: 60
Pitch tolerance: 15
Barrel length: 0
Barrel horizontal: 0
Barrel vertical: 8
Rate of Fire: 17
Damage per bullet: 20
Damage per bullet Vs player: 5
Firing persistance: 3
Firing persistance2: 1
Bullet Accuracy: Small Cone
Gun Base Attachment: aimrotation
Gun Barrel Attachment: muzzle
Gun Yaw Pose Param: aim_yaw
Gun Yaw Pose Center: 0
Gun Pitch Pose Param: aim_pitch
Gun Pitch Pose Center: 7.5
Ammunition Count: whatever you want (-1 means infinite ammo)
NPC Man Point: gun1_manpoint (we'll set that up later)
Ignore Grac Upto: 768
Player Lock Time: 0.3
Effect Handling: AR2
Bullets: AR2
Flags to tick:
*Active
*Controllable
*NPC Controllable
*Non-solid
Now that that's all done we have to set up the outputs. Copy the values of the outputs from the screenshot below. Pay attention to the delays. I don't think it matters what order they are in, but try and make them in that order anyway.
Now we'll set up the control volume. Select the texture "tools_toolstrigger" and make a box a bit smaller than the size of the player (player size = 32x32x72). This will be the area in which the player can control the gun, so center it behind the gun, 8 units way from the small wall. Tie this box to a trigger_multiple.
Properties to change:
Name: gun1_controls
Delay Before Reset: 1
Flags to tick:
*Clients
*NPCs
That's all for the control volume. The last thing to do is the point where an NPC will stand if it decides to use the gun.
Place an info_target on the floor, centered behind the gun, 25 units away from the wall. Name it gun1_manpoint.
And that's all. Put some lights in your map and compile it. If you want the turret facing a different direction, make sure you set the angles of the func_tank and info-target to the same angle as the prop_dynamic. Also, if theres any problems, get up me in the forums or check the example map, and NO, this does NOT work for HL2 Deathmatch.
Related:
Example Map
Serever