Mounted Machine Gun

Tutorial collection, comprehensive listings on main site.

Mounted Machine Gun

Postby Tutorial on Mon Mar 07, 2005 12:07 am

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.

Image Image

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:

Image Image

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.

Image

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:

Image

*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.

Image

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.

Image
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.

Image

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
- Don't send PM's to this user -
Tutorial
Not A Real User
 
Joined: Sun Mar 06, 2005 11:00 pm

Postby RSX WHEEEEEE on Tue Jun 28, 2005 7:37 pm

You can choose the bullets? A shotgun turret, i can see it now...
User avatar
RSX WHEEEEEE
May Contain Skills
May Contain Skills
 
Joined: Tue Jun 21, 2005 4:19 pm
Location: ATL HO!

Postby Sfisher7 on Wed Jun 29, 2005 6:31 pm

I'm having trouble, when I use it and look around it does'nt move :?.
Sfisher7
Been Here A While
Been Here A While
 
Joined: Sat Jun 18, 2005 4:30 pm
Location: USA

get the npc to come to the machine gun

Postby dalewb on Tue Jul 26, 2005 4:44 pm

"The last thing to do is the point where an NPC will stand if it decides to use the gun. "

Exactly how do you go about doing this? I've tried to use an aiscripted_schedule but the npc will just not move at all. Here is what I got with the npc:
Image

There are 3 info_nodes leading from the npc to the info_target. Above the info_target is an aiscripted_schedule. It's "goal entity" field is pointing to the info_target. It is triggered to "StartSchedule" on level load.
dalewb
Just Joined
Just Joined
 
Joined: Tue Jul 26, 2005 4:30 pm

Postby HallWack on Sun Aug 21, 2005 8:51 am

Sfisher7 wrote:I'm having trouble, when I use it and look around it does'nt move :?.


U forgot to parent tank to gun.
S0rry 4 b4d 3ngl15h. 1 h0p3 u 4ll und3r574nd
HallWack
Dumpling
Dumpling
 
Joined: Sun Aug 21, 2005 8:45 am
Location: 60.1667 Northern Latitude; 24.7 Eastern Longitude.

mounted gun problem

Postby lagenger on Thu Sep 01, 2005 1:15 am

does this work for cs:s too?? if so how do you use the gun in the game?? :wink:
sometimes i dream about cheese
lagenger
Just Joined
Just Joined
 
Joined: Thu Sep 01, 2005 1:13 am
Location: california

hl2mp / Gun partially working

Postby Antarion on Thu Nov 10, 2005 12:41 pm

Hello,

i just tried to setup one for these guns within a hl2mp test map. The gun seems to be semi-working, i can control and fire it but the gun model itself doesnt follow my movements. Furthermode i do not see any bullets (impacts), yet the hit the target.

Any ideas? I've double checked the outputs, the gun is setup as a parent for the tank, everthing seems to be setup corectly.

-Antarion
Antarion
Just Joined
Just Joined
 
Joined: Thu Nov 10, 2005 12:38 pm

Re: hl2mp / Gun partially working

Postby ScarT on Thu Nov 10, 2005 12:46 pm

Antarion wrote:Hello,

i just tried to setup one for these guns within a hl2mp test map. The gun seems to be semi-working, i can control and fire it but the gun model itself doesnt follow my movements. Furthermode i do not see any bullets (impacts), yet the hit the target.

Any ideas? I've double checked the outputs, the gun is setup as a parent for the tank, everthing seems to be setup corectly.

-Antarion


Weapon doesn't contain networking code (I guess), it has to be coded in to the game DLL.
User avatar
ScarT
Senior Member
Senior Member
 
Joined: Sat Apr 02, 2005 7:33 pm
Location: Denmarkian Land

Associating a Combine with the Gun

Postby XOXIXO on Sun Nov 13, 2005 11:07 pm

Great tutorial btw....

is there a way to tie an npc_combine_s to the gun so that he fires on the player automatically?? I can't seem to figure it out...

thanks in advance if anyone knows

:)
XOXIXO
Dumpling
Dumpling
 
Joined: Sun Nov 13, 2005 11:03 pm

Re: Associating a Combine with the Gun

Postby Skurmedel on Mon Nov 14, 2005 12:09 am

XOXIXO wrote:Great tutorial btw....

is there a way to tie an npc_combine_s to the gun so that he fires on the player automatically?? I can't seem to figure it out...

thanks in advance if anyone knows

:)


There should be a way to do it since they had it in HL2s main story :)
Skurmedel
Regular
Regular
 
Joined: Mon Aug 08, 2005 11:51 am
Location: Gothenburg, Sweden

Re: Associating a Combine with the Gun

Postby Shr3d on Mon Nov 14, 2005 2:15 am

Skurmedel wrote:
XOXIXO wrote:Great tutorial btw....

is there a way to tie an npc_combine_s to the gun so that he fires on the player automatically?? I can't seem to figure it out...

thanks in advance if anyone knows

:)


There should be a way to do it since they had it in HL2s main story :)


Edit the fgd.
Shr3d
 

Postby Fate™ on Mon Apr 17, 2006 9:48 pm

HallWack wrote:
Sfisher7 wrote:I'm having trouble, when I use it and look around it does'nt move :?.


U forgot to parent tank to gun.


i have same problem and i have them parented.
User avatar
Fate™
1337 p0st3r
1337 p0st3r
 
Joined: Mon Jun 06, 2005 8:00 pm
Location: England

Postby SteelionCore on Sat Apr 22, 2006 3:04 am

I'm getting an error when I compile the map. Not sure if it's the turret, or something else.

The command failed. Windows reported the error:
"The system cannot find the file specified."

Is is a Hammer problem, a Steam problem, or some other problem?

If someone can help me out a bit, I'd be glad. I want to test my map already. :cry:
SteelionCore
Member
Member
 
Joined: Sat Apr 22, 2006 2:59 am

Postby MercX on Sat Apr 22, 2006 4:36 am

SteelionCore wrote:I'm getting an error when I compile the map. Not sure if it's the turret, or something else.

The command failed. Windows reported the error:
"The system cannot find the file specified."

Is is a Hammer problem, a Steam problem, or some other problem?

If someone can help me out a bit, I'd be glad. I want to test my map already. :cry:


probably not the turret. hit Alt-P in hammer to check for problems. if i remember correctly this happens with invalid brushes and stuff like that.
Age of Chivalry Dev Team.
User avatar
MercX
Pheropod
Pheropod
 
Joined: Tue Aug 30, 2005 6:59 pm
Location: US

Postby mbs357 on Thu Jun 08, 2006 9:06 pm

Good tutorial. Gun works great.
Also having a problem with NPCs using it...
I've looked at a prefab from a member's signature and NPCs use that one just fine...
Can't figure it out.
mbs357
Member
Member
 
Joined: Tue May 30, 2006 6:59 pm
Location: Constitutional Republic of America
Next

Return to Tutorials

Who is online

Users browsing this forum: No registered users