func_tank

Modified

12-Jul-2023

The func_tank is used to represent a mounted cannon which can be controlled by players as well as monsters, if allowed. For either to be able to use this, it must be hooked up to a single func_tankcontrols entity. If you want func_tank to be controllable by player, you need to specify a name of func_tank and use func_tankcontrols entity in addition of this entity. Automatic turret needs "Active" flag enabled. Entity requires origin brush tied to barrel, so it can rotate around it.

Keyvalues


OnDestroy Function ondestroyfn : Name of the function to use from already parsed .as script files when entity is destroyed (killed) in any way. If the function belongs to namespace, you must use prefix with the namespace name (e.g. mynamespace::MyFunction) for the keyvalue.

Name targetname : Set name of func_tank so other entities can trigger it to take control, preferably func_tankcontrols. Some others entities like func_button works as well. Does not accept 'Off' use-type. Can be kill-targeted.

Target target : Entity to trigger whenever a controlled func_tank shot. Trigger use-type is 'Toggle'.

Render FX renderfx : Set custom render FX effect. Only works when "Render Mode" is set to different than 'Normal'

  • 0 : Normal : Default rendering.
  • 1 : Slow Pulse : Transparency slow fading in and out in a loop.
  • 2 : Fast Pulse : Transparency fast fading in and out in a loop.
  • 3 : Slow Wide Pulse : Transparency slow fading in and out widely in a loop.
  • 4 : Fast Wide Pulse : Transparency fast fading in and out widely in a loop.
  • 9 : Slow Strobe : Regular slow appearing/dissapearing.
  • 10 : Fast Strobe : Regular fast appearing/dissapearing.
  • 11 : Faster Strobe : Regular very fast appearing/dissapearing.
  • 12 : Slow Flicker : Random slow appearing/dissapearing.
  • 13 : Fast Flicker : Random fast appearing/dissapearing.
  • 5 : Slow Fade Away : Not working. Fading out slowly until reaching invisibility. Works once when entity spawns or have changed it's "Render FX" at a runtime (e.g. through env_render). Requires high "FX Amount"
  • 6 : Fast Fade Away : Not working. Fading out quickly until reaching invisibility. Works once when entity spawns or have changed it's "Render FX" at a runtime (e.g. through env_render). Requires high "FX Amount"
  • 7 : Slow Become Solid : Not working. Fading in slowly from invisible to fully visible. Works once when entity spawns or have changed it's "Render FX" at a runtime (e.g. through env_render). Requires low or zero "FX Amount"
  • 8 : Fast Become Solid : Not working. Fading in quickly from invisible to fully visible. Works once when entity spawns or have changed it's "Render FX" at a runtime (e.g. through env_render). Requires low or zero "FX Amount"
  • 14 : Constant Glow : Sprites with 'Glow' render mode only. Disables sprite resizing.
  • 15 : Distort : Random distortion, looped.
  • 16 : Hologram (Distort + fade) : 'Random distortion' + 'Pulse' applied, looped.
  • 17 : Dead Player (DONT USE!)
  • 18 : Explode (Garg Like)
  • 19 : Glow Shell : Applies nice animated glowing shell on model. Color can be applied. "FX Amount" manipulates glow shell size.
  • 20 : ClampMinScale (Sprites)

Render Mode rendermode : Render mode determines how this entity is rendered.

  • 0 : Normal : Normal rendering. Entity will receive light, except if it is a sprite. "FX Amount" is obsolete when this is used.
  • 1 : Color : Brush entities only: Instead of rendering the texture, the whole entity will appear in one color, set by "FX Color". "FX Amount" sets the transparency. 0 means invisible. 255 means fully opaque.
  • 2 : Texture : Texture-only rendering. Entity will not receive light. Instead, only the texture will be rendered as is. "FX Amount" sets the transparency. 0 means invisible. 255 means fully opaque. This is used for transparent things such as windows. Tip: If you have a window separating a dark and a bright room using only one entity, you can apply a brighter glass texture to the side of the window seen from within the dark room than to the side seen from the bright room. That way, the window's brightness will look realistic from both sides, instead of from just one. Generally, darker rooms require the render amount to be lower, making the glass more transparent, or it would look illogically bright.
  • 3 : Glow : Sprites only. The sprite will appear in the same size regardless of your distance to it. In addition to that, the further away you are from it, the less visible it will be. (It's only barely visible at about 500 units far away) Good for light coronas. This renders the sprite in additive mode.
  • 4 : Solid : Brush entities only. All textures of the brush entity starting with '{' will have the last color of their palette (usually blue, black or purple) be rendered fully transparent. This is used for textures with see-through parts, such as grates and railings. Requires "FX Amount" to be set to a value greater than 0, commonly 255.
  • 5 : Additive : Works just as the "Render Mode" 'Texture', except that the entity's appearance will be added to the background instead of forming a mean. This means, black pixels of textures will be fully transparent, while full-bright pixels are added with a factor of "FX Amount" divided by 255. This is often used for sprites indicating a glowing light, as well as for overlay func_illusionaries to give a computer texture the appearance of having many small, glowing lights, screens and whatever other elements. Render-amount of 255 makes it bright. 0 makes it invisible.

FX Amount (1 - 255) renderamt : Render amount to use when other than "Render Mode" 'Normal' is used.

FX Color (R G B) rendercolor : Used with "Render Mode" 'Color' and 'Glow' to set color. Also sets color of 'Glow Shell' "Render Mode".

Global Entity Name globalname : Global name of entity, allows to have one entity in the multiple maps (e.g. elevator in map1 and map2 have the same "Global Entity Name" which tells the engine to treat those entities as a one single entity, so all elevator settings, positions, actions e.t.c. are copied to another map in a moment of map transitions.

Pitch Yaw Roll (X Y Z) angles : Where Z means Y and Y means Z, that is, when you're thinking Hammer-grid. (Hammer uses Z for height and Y for depth, while every other sane 3D-application does this the other way round; nonetheless this keyvalue description has the letters in the conventional order) This, technically, is a 3D-vector containing Euler-angles to describe either the entity's rotation or direction of effect. E.g. a func_door_rotating will use this as its initial rotation, while a trigger_push will keep its original alignment and use this for the direction of its push-effect instead. Euler-angles are a hierarchical system to determine an object's orientation in 3D-space. A yaw-value of 0 would mean the entity would face east. (right in top-down view) 90 would mean it would face north. (up in top-down-view) After yaw, pitch is applied. Think aiming up/down with your character in first person. At last, the roll-value is applied. Think your character falling over sideways in first person. Some entities, mostly point entities, do not use the angles keyvalue for any purpose.

(Team) Master master : Currently unsupported.

Yaw Rate yawrate : How fast the barrel rotates horizontally, in degrees per seconds.

Yaw Range yawrange : The range, in degrees, of the barrel horizontal rotation in each side- left and right. This value is doubled for the whole barrel range e.g. when it's set to 90, the barrel can rotate left by 90 degrees and right by 90 degrees, what gives the total of 180.

Yaw Tolerance yawtolerance : Additional left-right range. If the gun tries to turn beyond yaw range + yaw tolerance, the gun will snap back to the maximum yaw range.

Pitch Rate pitchrate : Vertical barrel rotating speed, in degrees per seconds.

Pitch Range pitchrange : Vertical range of the barrel rotation, up and down. This value is doubled for the whole barrel range e.g. when it's set to 10, the barrel can rotate up by 10 degrees and down by 10 degrees, what gives the total of 20.

Pitch Tolerance pitchtolerance : Additional up-down range. If the gun tries to turn beyond pitch range + pitch tolerance, the gun will snap back to the maximum pitch range.

Barrel Length barrel : Determines where bullets comes from. Distance is counted from origin brush to barrel end.

Barrel Horizontal barrely : How wide the barrel is, horizontally (x axis).

Barrel Vertical barrelz : How wide the barrel is, vetically (z axis).

Smoke Sprite spritesmoke : Name of the sprite to show whenever bullet is shoot. Starts with 'sprites/' folder.

Flash Sprite spriteflash : Name of the sprite to show as a muzzle flash of the barrel. Starts with 'sprites/' folder.

Sprite Scale spritescale : Scale of smoke and flash sprites.

Rotate Sound rotatesound : Sound file to play in a loop while barrel is rotating.

Rate of Fire firerate : Number of bullets per second.

Damage Per Bullet bullet_damage : Damage to deal each shot.

Firing Persistence persistence : How many seconds this entity will continue shooting after losing player from field of view. Works only for automatic turrets.

Bullet Accuracy firespread : Allows to customize bullet spreading, from perfect shot to Star Wars Stormtrooper accuracy.

  • 0 : Perfect Shot
  • 1 : Small cone
  • 2 : Medium cone
  • 3 : Large cone
  • 4 : Extra-large cone

Minmum target range minRange : Minimum view distance to shoot target, used for automatic turrets only.

Maximum target range maxRange : Maximum view distance to shoot target, used for automatic turrets only. Values above 2048 doesn't work.

Minimum light level _minlight : Sets the minimum light level. Set this value if entity is too dark on compiled map. Also useful for things like computer screens or holograms. Default is 0, max 1.

R Player relation_player : Set relationship towards player.

  • -2 : Ally
  • -1 : Friend
  • 0 : No Relation
  • 1 : Dislike
  • 2 : Hate
  • 3 : Nemesis

R Unknown relation_none : Set relationship towards entities classified as "unknown".

  • -2 : Ally
  • -1 : Friend
  • 0 : No Relation
  • 1 : Dislike
  • 2 : Hate
  • 3 : Nemesis

R Machine relation_machine : Set relationship towards machines.

  • -2 : Ally
  • -1 : Friend
  • 0 : No Relation
  • 1 : Dislike
  • 2 : Hate
  • 3 : Nemesis

R Human Passive relation_human_passive : Set relationship towards humans (passive).

  • -2 : Ally
  • -1 : Friend
  • 0 : No Relation
  • 1 : Dislike
  • 2 : Hate
  • 3 : Nemesis

R Human Military relation_human_militar : Set relationship towards military humans.

  • -2 : Ally
  • -1 : Friend
  • 0 : No Relation
  • 1 : Dislike
  • 2 : Hate
  • 3 : Nemesis

R Alien Military relation_alien_militar : Set relationship towards military aliens.

  • -2 : Ally
  • -1 : Friend
  • 0 : No Relation
  • 1 : Dislike
  • 2 : Hate
  • 3 : Nemesis

R Alien Passive relation_alien_passive : Set relationship towards passive aliens.

  • -2 : Ally
  • -1 : Friend
  • 0 : No Relation
  • 1 : Dislike
  • 2 : Hate
  • 3 : Nemesis

R Alien Monster relation_alien_monster : Set relationship towards alien monsters.

  • -2 : Ally
  • -1 : Friend
  • 0 : No Relation
  • 1 : Dislike
  • 2 : Hate
  • 3 : Nemesis

R Alien Prey relation_alien_prey : Set relationship towards alien preys.

  • -2 : Ally
  • -1 : Friend
  • 0 : No Relation
  • 1 : Dislike
  • 2 : Hate
  • 3 : Nemesis

R Alien Predator relation_alien_predator : Set relationship towards alien predators.

  • -2 : Ally
  • -1 : Friend
  • 0 : No Relation
  • 1 : Dislike
  • 2 : Hate
  • 3 : Nemesis

R Insect relation_insect : Set relationship towards insect.

  • -2 : Ally
  • -1 : Friend
  • 0 : No Relation
  • 1 : Dislike
  • 2 : Hate
  • 3 : Nemesis

R Player Ally relation_player_ally : Set relationship towards player allies.

  • -2 : Ally
  • -1 : Friend
  • 0 : No Relation
  • 1 : Dislike
  • 2 : Hate
  • 3 : Nemesis

R Player BioWeapon relation_player_bioweapon : Set relationship towards player's bioweapon (e.g. snarks thrown by player).

  • -2 : Ally
  • -1 : Friend
  • 0 : No Relation
  • 1 : Dislike
  • 2 : Hate
  • 3 : Nemesis

R Monster BioWeapon relation_monster_bioweapon : Set relationship towards monster's bioweapons (e.g. shockroach dropped by shocktroopers).

  • -2 : Ally
  • -1 : Friend
  • 0 : No Relation
  • 1 : Dislike
  • 2 : Hate
  • 3 : Nemesis

ZHLT Template Model Target zhlt_usemodel : For Brush entities: sets brush model template of this entity. Set it to the name of other brush entity (now called a template) and it's brush model will be used instead. Templates might save server resources by "copying" single brush entity (template identified by name) and using it in multiple places (can be used for entities like tables, columns, barrels, cars e.t.c.). Also one template occupies only one entity slot when compiling a map, no matter how many entities refers to it. For model-based point entities: copy display model of specified entity, to use it's model instead. Using "Custom model" is more appropriate in most cases, however, when it's not possible, use "ZHLT Copy Lighting From Target".

ZHLT Copy Lighting From Target zhlt_copylight : For Brush entities: copies light info from specified entity. This can be useful when we want this entity to be light up in a similar way the other entity of the map is, e.g. we have few func_pushables on map, and they are lit differently, tough they can be moved (and lightning is not updated on dynamic entities), it may looks shabby. With this keyvalue we can prevent this making all func_pushables received light in a same way. Another example: we have few windows in corridor (e.g. func_breakables), all of them receive a light in acceptable way, but the last window receive part of the light from another room and breaking whole atmosphere. We can set this window "Copy Lightning From Target" to any other window to fix this. Note that this can be also used for completely different entities, so we copy lightning from func_door to func_breakable as well. For model-based point entities: if model lightning does not satisfy you (e.g. it's too dark) you can specify a name of entity here to copy it's lightning values- it can be other model-based entity or simply info_target.

ZHLT Disable Clipping zhlt_noclip : Enable or disable collision of entity.

  • 0 : Default : Keep default collision.
  • 1 : Always non-solid : This makes entity non-solid- all collision info from this entity will be ignored. Use it in case when entity have no build-in collision disabling ability (e.g. by selecting "Passable" flag in func_door) and you much desire to disable collision for this entity.

ZHLT Invisible zhlt_invisible : Brush entities only. Determines if entity should be visible.

  • 0 : Visible (default)
  • 1 : Invisible

ZHLT Custom Shadow (when opaque) zhlt_customshadow : Opaque brush entities only. If "ZHLT Ligth Flags" of this entity uses any of the option with 'Opaque' word, this will allow to customize shadow dropped by this entity. Value format: [0 - 1.0] [0 - 1.0] [0 - 1.0], use three values for color or only one for transparency.

ZHLT Embed Light Map (when translucent) zhlt_embedlightmap : Transparent brush entities only. Set it to 'Yes' and this transparent entity will take a light from environment making it looks much more natural. Use it when entities (e.g. glass represented by func_wall) omits lightning from surrounding. Note that this is expensive so shouldn't be used too often, but resolution of those lightmaps can be controlled by keyvalue explained below.

  • 0 : No (default)
  • 1 : Yes

ZHLT Embed Light Map Resolution zhlt_embedlightmapresolution : Value of power of two that controls the resolution of embedded lightmaps of transparent textures (see keyvalue above). Higher value for better optimization. Default and recommended value is 4.

ZHLT Light Flags zhlt_lightflags : Brush entities only. Changes light casting or receiving setting.

  • 0 : Default : Let the entity decide about lightning setting.
  • 1 : Embedded Fix : Disables bleed fix on given entity. Sometimes when entity gets trough the wall, it may get wrong lighting in one of the site. Use this flag when this problem appear.
  • 2 : Opaque (blocks light) : May be useful for func_door or func_illusionary to generate shadows. Can also generate shadows on transparent '{' textures with 'Solid' Render Mode (amount: 255). Note that shadow sharpness depends on '-blur' compile value. The blur value of map above is 0.5 (it's 1.5 by default).
  • 3 : Opaque + Embedded fix : both 'Opaque' and 'Embedded Fix' settings.
  • 6 : Opaque + Concave Fix : Instead of using 'Embedded Fix' you can use 'Concave Fix'. It's generally used for curved entities, use it when you spot a black seems on curved (arched) entities.

ZHLT Light Origin Target light_origin : Set it to the name of info_target, this entity will receive lights from specified info_target position instead of it's own position. As a lot of entites can moves and lightning is not updated dynamically you can choose how your entity will be lit in game (e.g. elevators, pushables e.t.c.). Now you don't need to put the whole entity in the well-lit room at map start to make them look desirable.

Bullets bullet : Bullets visual appearance type.

  • 0 : None
  • 1 : 9mm
  • 2 : MP5
  • 3 : 12mm

Flags


  • 1 : Active : Makes this func_tank active on start, which means it will try to kill every enemies in it's view distance.

  • 16 : Only Direct : If selected, the automatic func_tank will trigger it's target only when they are in it's line of sight.

  • 32 : Controllable : If selected, player can control this turret. Keep in mind that func_tankcontrols is required for this.

  • 512 : Use Relations : Enables usage of relation keyvalues (may be glitched).

  • 1024 : Player can't fire : Prevent player from shooting (player might still mount the tank).

  • 2048 : Not in Deathmatch : Obsolete in Sven Co-op. Makes the entity don't appear in Multiplayer Games.

Turret can be both controllable and automatic- attacks player until he gets control over this func_tank.

Entity must be facing east at x/y view of the editor, the angle of barrel must be customized with 'Yaw' compass in object properties.

Max range of all func_tank entities cannot be set to higher that 2048.