func_tank

A func_tank is a mounted gun that aims at targets by itself, or that a player controls from a
func_tankcontrols.
The keys it shares with the other mounted guns, such as the turn rates, the barrel and the targets, are in the table below.
Attributes
The entity also has these common keys:
- Naming and triggering: Name, Target and Global Entity Name
- Position: Pitch Yaw Roll
- Appearance: all except Model scale, Body and Skin
- Compiler keys of brush entities: all of them
Names the parent, an entity that this one moves and turns with. The entity keeps the place and the angles it has on the parent in the editor. If several entities have the name, the first one counts. A name ending in .1 to .4 puts a sprite or a model that isn't solid on that attachment point of the model of the parent. A solid brush on a parent that turns needs its own origin brush. Moving objects explains it all.
If you leave this key empty, the entity doesn't move with anything.
parentflagsKeeps some of the entity's own position or angles instead of following the parent. Add up the values of the axes to keep: 2 for X, 4 for Y, 8 for Z, 16 for pitch, 32 for yaw and 64 for roll. So 112 keeps the entity level. 0 follows the parent on every axis.
0Sets how loud the shots of a player at the controls are for monsters, and -1 makes them silent.
If you leave this key empty or set 0, the shots are loud, at 1000.
0masterNames a master, and while the master is off, no player can take the controls. A gun with Active still fires, so use Fire Master to stop that.
Names a master, and the gun only fires while that master is on. It still aims and turns while the master is off.
yawrateSets how fast the gun turns left and right, in degrees per second.
If you leave this key empty, it is 0 and the gun doesn't turn.
30yawrangeSets how far the gun turns left and right from where it faces in the map, in degrees to each side.
If you leave this key empty, it is 0 and the gun can't turn.
180yawtoleranceSets how far off its target the gun may point left or right and still fire by itself, in degrees.
If you leave this key empty, it is 0 and the gun never fires by itself, unless it has Only Direct.
15pitchrateSets how fast the gun turns up and down, in degrees per second.
0pitchrangeSets how far the gun turns up and down from where it faces in the map, in degrees to each side.
0pitchtoleranceSets how far off its target the gun may point up or down and still fire by itself, in degrees.
If you leave this key empty, it is 0 and the gun never fires by itself, unless it has Only Direct.
5barrelSets how far the end of the barrel is in front of the origin of the entity, in units. Shots, sprites and the aim start there.
0barrelySets how far the end of the barrel is to the right of the origin of the entity, in units. A negative value is to the left.
0barrelzSets how far the end of the barrel is above the origin of the entity, in units. A negative value is below it.
0spritesmokeSets a sprite that drifts up from the end of the barrel with each shot.
spriteflashSets a muzzle flash sprite shown at the end of the barrel with each shot.
spritescaleSets the size of the smoke and flash sprites, where 1 is their own size.
If you leave this key empty or set 0, they have their own size.
1rotatesoundSets a sound that plays while the gun turns.
firerateSets how many shots the gun fires per second, and 0 means 1.
1persistenceSets how many seconds the gun keeps firing after it loses sight of its target.
If you leave this key empty, it is 0 and the gun never fires by itself.
1minRangeSets the distance, in units, below which the gun ignores targets.
0maxRangeSets the distance, in units, beyond which the gun ignores targets. With 0, there is no limit when the gun attacks only players, and with another Behavior/Classification, 0 means 512.
0Sets how many shots the gun has, and 0 or less means no limit. When the gun is empty, it clicks instead of firing.
0Sets who a gun with Active shoots at. Monsters also see the gun as this class, as Monster classes shows.
- Attack only players (0) - The nearest player in view
- Human Military (4) - Players and monsters that the Feds hate, within Maximum target range
- Alien Military (5) - Players and monsters that alien soldiers hate, within Maximum target range
- Player Ally (11) - Players and monsters that the allies of players hate, within Maximum target range
Attack only players (0)Names other guns, without Active, that turn with this one and fire when it fires.
The gun fires this at each shot, and passes on a point at the end of the barrel as the activator.
Sets how the smoke sprite at the barrel is drawn each time the gun fires.
- Default (Solid) (0) - Solid
- Color (1)
- Texture (2)
- Glow (3)
- Solid (4)
- Additive (5)
Default (Solid) (0)bulletPicks the bullets the gun fires, which set the damage of each bullet when Damage Per Bullet is 0.
- None (0) - The gun fires no bullets
- 9mm (1) - 8 to 22 damage for each hit
- MP5 (2) - 12 to 29 damage for each hit
- 12mm (3) - 21 to 56 damage for each hit
None (0)Sets whether its bullets break what they kill into gibs.
- Default for func_tank (0) - With a Damage Per Bullet above 16 the kill breaks into gibs, at 16 or less it never does, and without a Damage Per Bullet the game decides by the damage
- Normal (1) - The game decides by the damage
- Never gib (2) - Kills never break into gibs
- Always gib (3) - Kills always break into gibs
Default for func_tank (0)bullet_damageSets the damage of each bullet, and 0 uses the damage of the Bullets type.
0firespreadSets how far the bullets stray from where the gun points, in a cone that gets wider with each choice.
- Perfect Shot (0) - Every shot goes where the gun points
- Small cone (1)
- Medium cone (2)
- Large cone (3)
- Extra-large cone (4)
Perfect Shot (0)Flags
1ActiveThe gun starts switched on, so it aims at targets and fires by itself. Triggering it switches it on or off
16Only DirectThe gun only fires when a line from its barrel hits the target, and then it fires even when its aim is outside the tolerances
32ControllablePlayers can take the controls of the gun through a func_tankcontrols, and it aims where they look
A red laser dot shows where the barrel points while the gun is on or a player has the controls
A player at the controls aims the gun at the exact point they look at, instead of the gun copying their view angles
Notes
- The player at the controls gets the kills of the gun: the frags, the Co-op XP and the line in the kill feed. While nobody is at the controls, no player gets them
- Once the map runs,
trigger_changevalueandtrigger_copyvaluecan't change Smoke Sprite or Flash Sprite, so the gun keeps its sprites, and withdeveloper 1set in the console, the console says why - If
trigger_changevalueortrigger_copyvaluesets Rate of Fire to 0 or below, the tank fires one shot a second, and an accuracy outside the list is Perfect, as when the map loads. See Changing keys
See also
func_tankcontrols- the place where a player takes the controlsfunc_tanklaser- a mounted laserfunc_tankmortar- a mounted mortarfunc_tankrocket- a mounted rocket launcher- func_tank on TWHL - the Half-Life entity
Changes since 1.38
- You can use the new keys Player weapon volume, Fire Master, Bullet count, Behavior/Classification, Extra barrels name, Trigger on firing, Smoke sprite render mode and Bullet gib policy, and the new flags Laser Spot, Match Target and Smoke on empty

