Making a Useable Machine
Gun
This is an issue I resolved with help from the
jolt.co.uk forums, so I made a tutorial on it. With a bit of help too from the Valve entities site as well.
Ok, the First thing you need is to have the Halflife.wad loaded into the textures that you are using.
1) First of all, create a cylinder that the gun will be mounted on. I think a cylinder is best simply because it looks better when finished.
2) Now, create a block that sticks out of the cylinder, as shown in the picture below. This block MUST have a texture of "ORIGIN". This will enable the gun to rotate, and is the centre from where the gun will rotate from.
Note: The Origin brush WONT be visible in the game, so it doesn't matter that it overlaps.

3) Ok, now design the gun itself, but make sure that it is attached to the origin brush for it to rotate. Also, make sure that you design the gun pointing EAST (to the right in the top-down view in VHE). I'm not sure why, but I just obeyed the entity site! Here's what I have so far.
P.S. I've added a sky brush in to make the gun show up better against the background. Using Vertex Manipulation on the Cylinder that is coming out of the machine gun, has created a realistic gun look. See my 'tree' tutorial for more info on how to do this.

4) Now, add a brush WHERE YOU WANT THE PLAYER TO CONTROL THE GUN FROM. So if you want the player to fire in the opposite direction from the gun as it is made in VHE, then make the brush by the barrel of the gun. Like this:

5) Next, create an ambient_generic entity next to the gun.
- Give it a name, I'm using gunfire.wav
- And the pathname in the box given. I find that ambience/biggun1 2 or 3.wav are the best for this.
- Next, in the flags TICK: - Is not looped and the radius you want the sound to play in.
6) Ok, Group together all the parts of the gun, including the origin brush, but not the main cylinder, ambient_generic or the AAA_Trigger brush. These grouped objects will be used for the gun to function as one.

7) Select the group and make it an entity (press Ctrl+t). Select 'func_tank' from the list. The Options here needed are:
Name - I'm using: gun
Target - This is the ambient_generic's name, so in this case, its gunfire.wav
Yaw Rate - This is the speed that the gun will move across the horizontal plane, I find 300 is about right.
Yaw Range - This is the angle in degrees that the gun can move from its starting position. (so for in front and the sides, 180 is fine)
Pitch Rate - How fast the gun moves in the vertical plane, again, 300 is about right.
Pitch Range - How high the gun can aim up and down. If you don't want it to move up and down, then set this to 0.
Barrel Length - the distance from the centre of the support cylinder to the end of the barrel. This is where the sprite and bullets will appear from. Mine is 40 and is found by counting the smallest squares from the centre of the support to the end of the barrel.
Barrel Vertical - The distance from halfway up the cylinder to the top of the gun. This is to get the height for the sprite and bullets right. Mine is 35 for this.
Flash Sprite - Choose a sprite for when the gun fires, muzzleflash.spr are the ones that you should choose from.
Sprite Scale - How big the sprite will be, 1 or 2 is fine for this gun.
Rate of Fire - The amount of bullets fired per second, so 10 is fine.
Damage per bullet - I find about 12 is FAIR!
Firing Persistance - How many bullets will be fired AFTER you let go of the trigger.
Bullet Accuracy - Choose what you want from the list.
Bullets - Choose 6mm, MP5 or 12mm
Then, setting the flags: Only Controllable is needed (the others are for monster turrets)
VERY IMPORTANT: Set the angle with which the gun is to start in the Angle part of the Class info. In this case, we want 180 (or the Yaw section of the Pitch Yaw Roll)
8) Ok, now the turret is set up, we now need to make it useable by the players. Select the AAA_Trigger brush and make it an entity. Choose 'func_tankcontrols'. There is only one option available, and the target entity name is the name of the 'func_tank' that we just created. This case, its gun.
9) It should now work...

Here's some examples of prefab guns that have been tailored into func_tank's:

The left one is an M249, and the others are military ones. The one on the right is like the ones on the American choppers. Awesome!
Extra Notes:
10) What you can also do, is put a CLIP brush around the guns rotating area, so that no-one can interfere in the guns movement.
11) The other options available in the Class Info I haven't used simply because it works fine without them! Feel free to experiment though. Although, use the light flags options 'Opaque' to make the gun create shadows.
12) Also, to make a func_mortar, it is exactly the same principle, applying an origin brush, making the gun and its properties. It also uses the func_tank entity to use it as well.
By The God
Comments?