Generic Keyvalues, Inputs and Outputs/Keyvalues: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Russification)
(→‎Keyvalues: VBSP technically shouldn't be using brushes with the origin KV for leak testing)
 
(93 intermediate revisions by 20 users not shown)
Line 1: Line 1:
{{otherlang2
<!-- if translating then translate whole 'Generic Keyvalues, Inputs and Outputs' page using language bar -->
|noborder=true
== Keyvalues ==
|ru=Template:KV_BaseEntity:ru
{{KV|[[targetname|Name]]|intn=targetname|string|The name that other entities use to refer to this entity.}}
}}__NOTOC__
{{KV|[[Classname|Class]]|intn=classname|string|Determines the characteristics of the entity ''before'' it spawns. {{Tip|Changing this on runtime still has uses, but should be used sparingly, as certain entities expect entities to have certain classnames. For example, using a classname defined in [[S_PreserveEnts]] will persist the entity on new rounds.}}}}
<noinclude>This template is our holder for all [[keyvalues]] that are assigned through {{ent|CBaseEntity}}. The template has a very specific syntax that you must follow to apply properly, because new games have added new features throughout the years. See [[Help:Templates]] for more info on named parameters.
{{KV|[[Globalname|Global Entity Name]]|string|intn=globalname|When entity transitions to different map which has an entity with same globalname (and classname) properties of this entity (color, origin, angles etc.) will be copied over to that entity. (unless the given property is marked not to transfer e.g. model)
<pre>{{KV BaseEntity}}</pre>
:{{Important|Meant to be used in singleplayer games which have {{hl2}} style map transition ({{l4ds}} is '''not''' one of those)}}}}
'''No parameters:''' display keyvalues for ALL games.
{{KV|Model|intn=model|string|In-game representation of the entity to display. For [[brush entities]], this is a reference to a non-zero [[bmodel]] index in the current BSP. For [[point entities]], this is the path to an [[MDL]] [[model]] or [[VMT]] [[sprite]], relative to the game's root directory. Not all entities will actually render the model, and only specific entities will [[precache]] the model defined here (non-precached models cannot be displayed).}}
<pre>{{KV BaseEntity|base=1}}</pre>
{{KV|[[Origin]] (X Y Z)|intn=origin|coordinates|The position of this entity's center in the world. Rotating entities typically rotate around their origin.}}
'''Base:''' display keyvalues that have only existed since whatever game added the class (most have existed since HL2, the first Source game).
:{{bug|hidetested=1|Editing this manually in Hammer does not move point entities accordingly in the editor.}}
<pre>{{KV BaseEntity|l4d2=1}}</pre>
:{{note|Brush entities with this keyvalue count towards [[leak]] tests, whereas they do not if this keyvalue is absent.}}
'''Game as a parameter:''' display the keyvalues that <code>base</code> displays, AND keyvalues that were added to the class, by the specified game. You can specify as many games as needed. You must specify ALL the games you want to include (e.g. <code>l4d2</code> will not automatically include <code>l4d</code> keyvalues as well). This is because there are situations like in Portal 2, where the output <code>OnKilled</code> is not available through <code>CBaseEntity</code>, despite being a far descendant of the L4D branch which added it.
{{KV|[[Pitch Yaw Roll]] (Y Z X)|intn=angles|angle|This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.{{Note|This works on brush entities, although Hammer doesn't show the new angles.}}}}
{{KV|[[Spawnflags|Flags]]|intn=spawnflags|flags|Toggles exclusive features of an entity, its specific number is determined by the combination of flags added. In hammer it has its own tab in entity properties called '[[Hammer_Object_Properties_Dialog#Flags_Tab|Flags]]'}}
{{KV|Damage Filter|intn=damagefilter|target_destination|Name of a filter that controls which entities can damage this entity.}}


All parameters for this template:
=== Parenting ===
*<code>base</code> (Use if the entity was available before L4D2.)
{{KV|[[Parent]]|intn=parentname|targetname|Maintain the same initial offset to this entity. An attachment point can also be used if separated by a comma at the end. (<code>parentname [targetname],[attachment]</code>) {{Tip|Entities transition to the next map with their parents {{l4ds|not}}}}{{Tip|{{Ent|phys_constraint}} can be used as a workaround if parenting fails.}}}}
*<code>l4d</code> (DEPRECATED 9/21/18: Found out these keyvalues only work with renderable things. They have been migrated to visiblebrush and BaseAnimating KV templates. This is completely removed from the template and won't affect anything.)
 
*<code>l4d2</code>
=== Vscript ===
*<code>csgo</code>
{{KV|Entity Scripts|intn=vscripts|scriptlist|Space delimited list of [[VScript]] files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions. Scripts executed on the [[worldspawn]] entity will be placed in root scope.|since=L4D2|also={{tf2branch}}}}
*<code>css</code> (DEPRECATED 10/1/18: Previously used for a notice that was ''thought'' to apply to all entities in CS:S. The purpose of this now exists in [[Template:PreservedEnt]]. This is completely removed from the template and won't affect anything.)
{{KV|[[Entity_Scripts#Thinker_Functions|Think function]]|intn=thinkfunction|string|Name of the function within this entity's script that'll be called automatically every 100 milliseconds, or a user-defined interval if the function returns a number. Must be present when entity is spawning, setting it later (for example via AddOutput) has no effect. Avoid [[expensive]] operations in this function, as it may cause performance problems.|since=L4D2|also={{tf2branch}}}}
*<code>brush</code> (This adds things common for all brush entities, visible or not. For visible ones, use [[:Template:KV visiblebrush]] in conjunction.)
 
{{note|If you want to edit something on this template, please make sure you edit it in both places. ''Per-game'' keyvalues are duplicated, for technical reasons.}}
=== Rendering ===
See [[FGD Template Prototype]].
{{KV RenderFields}}
{{note|Some <code>CBaseEntity</code> keyvalues are not covered here. See the talk page.}}
{{KV Shadow}}
----
 
[[Category:Keyvalue Templates|Global]]
=== Miscellaneous ===
</noinclude><!--
{{Expand|
-->{{#if:{{{brush|}}}|{{minititle|Brush}}
{{KV|[[Effect flags|Effects]]|intn=effects|flags|Combination of effect flags to use.|nofgd=1}}
{{KV|Minimum Bounding Box Size (mins)|vector|Co-ordinate of the minimum bounding box corner. The bounding box is drawn from this corner to the other one. Requires Bounding Box collisions (solid 2) to be used. Can be used to overwrite the collision shape of a brush, although it can only be a cuboid.|nofgd=1}}
{{KV|[[Lag Compensation]]|intn=LagCompensate|boolean|Set to '''Yes''' to lag compensate this entity. Should be used very sparingly!|nofgd=1|since=L4D2}}
{{KV|Maximum Bounding Box Size (maxs)|vector|Co-ordinate of the maximum bounding box corner. The bounding box is drawn from this corner to the other one. Requires Bounding Box collisions (solid 2) to be used. Can be used to overwrite the collision shape of a brush, although it can only be a cuboid.|nofgd=1}}
{{KV|Is Automatic-Aim Target|intn=is_autoaim_target|bool|If set to 1, this entity will slow down aiming movement for consoles and joystick controllers when the entity is under the crosshairs.|nofgd=1|since=CSGO}}
{{KV|Collisions (solid)|choices|Method of collision for this entity.|nofgd=1}}
}}
:*0: None
:*1: BSP ([[QPhysics]])
:*2: [[Bounding box|Bounding Box]]
:*3: [[Bounding box|Oriented Bounding Box]]
:*4: [[Bounding box|Oriented Bounding Box]], constrained to Yaw only
:*5: Custom/Test
:*6: [[VPhysics]]
{{KV|Model Index (modelindex)|short|Changes the entity's model to a precached model on the map.|nofgd=1}}}}
{{minititle|Base}}
{{KV|[[Classname]] (classname)|string|The classname defines the type of entity. Classnames can be changed using {{ent|AddOutput}}, which will influence how the engine deals with the entity in certain circumstances.}}
{{KV|[[targetname|Name]] (targetname)|string|The name that other entities refer to this entity by.}}
{{KV|Global Entity Name (globalname)|string|Name by which this entity is linked to another entity in a different map. When the player transitions to a new map, entities in the new map with globalnames matching entities in the previous map will have the previous map's state copied over their state.}}
{{KV|[[Parent]] (parentname)|targetname|Specifies a movement parent. An entity will maintain its initial offset from its parent. An attachment point can be added to the end of the name, separated by a comma. ''Every'' entity can be parented, even point entities. Entities which are parented will be forced to transition to the next map, such as from a {{ent|trigger_transition}}. Some entities which aren't intended to be parented may not function correctly. {{ent|phys_constraint}} can be used as a workaround to parenting.}}
{{KV|[[Origin]] (X Y Z) (origin)|coordinates|The position of this entity's center in the world. Rotating entities typically rotate around their origin.}}
{{KV|[[Pitch Yaw Roll]] (X Y Z) (angles)|angle|This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.{{note|This works on brush entities, although Hammer doesn't show the new angles.}}}}
{{KV|[[Flag|Flags]] (spawnflags)|integer|Toggles features of an entity, its specific number is determined by the combination of flags added.}}
{{KV|[[ResponseContext|Response Contexts]] (ResponseContext)|string|Pre-defined response system contexts for this entity. Format is <code>key:value,key:value,...</code>. Contexts may be [[filter_activator_context|filtered]].}}
{{KV|[[Effect flags|Effects]] (effects)|int|Combination of effect flags to use.|nofgd=1}}
{{KV|Local Time (ltime)|float|The local time of the entity, independent of the global clock. Used mainly for physics calculations.|nofgd=1}}
{{KV|Next Think (nextthink)|float|Amount of time before the entity [[Thinking|thinks]] again.|nofgd=1}}
{{KV|Hammer ID (hammerid)|int|The entity's [[Hammer]] ID. Mainly used by plugins and debugging commands, such as {{ent|ent_keyvalue}}. Can be manually assigned with the "hammerid" or "id" keyvalue. Entities spawned at run-time are not assigned any Hammer ID.|nofgd=1}}<!--
-->{{#if:{{{l4d2|}}}|<!--
-->{{KV|Disable for Xbox 360 (disableX360)|bool|If Yes, disables this entity on the Xbox 360 version of Source.|nofgd=1|since=L4D2}}
{{KV|Entity Scripts (vscripts)|scriptlist|Space delimited list of [[VScript]] files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions.|since=L4D2}}
{{KV|Script think function (thinkfunction)|string|Name of a function in this entity's script which will be called automatically every 100 milliseconds (ten times a second) for the duration of the script. It can be used to create timers or to simulate autonomous behavior. The return value (if present) will set the time until the next call. Try to avoid [[expensive]] operations in this function, as it may cause performance problems.|since=L4D2}}
{{KV|[[Lag Compensation]] (LagCompensate)|boolean|Set to '''Yes''' to lag compensate this entity. Should be used very sparingly!|nofgd=1|since=L4D2}}<!--
-->| }}{{#if:{{{csgo|}}}|<!--
-->{{KV|Is Automatic-Aim Target (is_autoaim_target)|bool|If set to 1, this entity will slow down aiming movement for consoles and joystick controllers when the entity is under the crosshairs.|nofgd=1|since=CSGO}}<!--
-->| }}{{#if:{{{l4d2|}}}||{{#if:{{{csgo|}}}||{{#if:{{{base|}}}||<!--
-->{{KV|Disable for Xbox 360 (disableX360)|bool|If Yes, disables this entity on the Xbox 360 version of Source.|nofgd=1|since=L4D2}}
{{KV|Entity Scripts (vscripts)|scriptlist|Space delimited list of [[VScript]] files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions.|since=L4D2}}
{{KV|Script think function (thinkfunction)|string|Name of a function in this entity's script which will be called automatically every 100 milliseconds (ten times a second) for the duration of the script. It can be used to create timers or to simulate autonomous behavior. The return value (if present) will set the time until the next call. Try to avoid [[expensive]] operations in this function, as it may cause performance problems.|since=L4D2}}
{{KV|[[Lag Compensation]] (LagCompensate)|boolean|Set to '''Yes''' to lag compensate this entity. Should be used very sparingly!|nofgd=1|since=L4D2}}
{{KV|Is Automatic-Aim Target (is_autoaim_target)|bool|If set to 1, this entity will slow down aiming movement for consoles and joystick controllers when the entity is under the crosshairs.|nofgd=1|since=CSGO}}}}}}}}

Latest revision as of 07:24, 9 May 2025

Keyvalues

Name (targetname) <string>
The name that other entities use to refer to this entity.
Class (classname) <string>
Determines the characteristics of the entity before it spawns.
Tip.pngTip:Changing this on runtime still has uses, but should be used sparingly, as certain entities expect entities to have certain classnames. For example, using a classname defined in S_PreserveEnts will persist the entity on new rounds.
Global Entity Name (globalname) <string>
When entity transitions to different map which has an entity with same globalname (and classname) properties of this entity (color, origin, angles etc.) will be copied over to that entity. (unless the given property is marked not to transfer e.g. model)
Icon-Important.pngImportant:Meant to be used in singleplayer games which have Half-Life 2 style map transition (Left 4 Dead seriesLeft 4 Dead series is not one of those)
Model (model) <string>
In-game representation of the entity to display. For brush entities, this is a reference to a non-zero bmodel index in the current BSP. For point entities, this is the path to an MDL model or VMT sprite, relative to the game's root directory. Not all entities will actually render the model, and only specific entities will precache the model defined here (non-precached models cannot be displayed).
Origin (X Y Z) (origin) <coordinates>
The position of this entity's center in the world. Rotating entities typically rotate around their origin.
Icon-Bug.pngBug:Editing this manually in Hammer does not move point entities accordingly in the editor.
Note.pngNote:Brush entities with this keyvalue count towards leak tests, whereas they do not if this keyvalue is absent.
Pitch Yaw Roll (Y Z X) (angles) <angle>
This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.
Note.pngNote:This works on brush entities, although Hammer doesn't show the new angles.
Flags (spawnflags) <flags>
Toggles exclusive features of an entity, its specific number is determined by the combination of flags added. In hammer it has its own tab in entity properties called 'Flags'
Damage Filter (damagefilter) <targetname>
Name of a filter that controls which entities can damage this entity.

Parenting

Parent (parentname) <targetname>
Maintain the same initial offset to this entity. An attachment point can also be used if separated by a comma at the end. (parentname [targetname],[attachment])
Tip.pngTip:Entities transition to the next map with their parents (not in Left 4 Dead seriesLeft 4 Dead series)
Tip.pngTip:phys_constraint can be used as a workaround if parenting fails.

Vscript

Entity Scripts (vscripts) <scriptlist> (in all games since Left 4 Dead 2) (also in Team Fortress 2 branch)
Space delimited list of VScript files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions. Scripts executed on the worldspawn entity will be placed in root scope.
Think function (thinkfunction) <string> (in all games since Left 4 Dead 2) (also in Team Fortress 2 branch)
Name of the function within this entity's script that'll be called automatically every 100 milliseconds, or a user-defined interval if the function returns a number. Must be present when entity is spawning, setting it later (for example via AddOutput) has no effect. Avoid expensive operations in this function, as it may cause performance problems.

Rendering

RenderFields:


Render Mode (rendermode) <byte choices>
Set a non-standard rendering mode on this entity.
Render Modes
  • 0: Normal
  • 1: Color
  • 2: Texture
  • 3: Glow
  • 4: Solid/Alphatest Obsolete
  • 5: Additive
  • 6: Removed, does nothing Obsolete
  • 7: Additive Fractional Frame
  • 8: Alpha Add
  • 9: World Space Glow
  • 10: Don't Render
Render FX (renderfx) <byte choices>
Various somewhat legacy alpha effects. See render effects.
Render Amount / Transparency (renderamt) <byte>
Transparency amount, requires a Render Mode other than Normal. 0 is invisible, 255 is fully visible.
Render Color (R G B) (rendercolor) <color255>
Color tint.

Shadow:

Disable Shadows (disableshadows) <boolean>
Prevents the entity from creating cheap render-to-texture shadows, or lightmap shadows if the entity is a prop_static. Does not affect shadow mapping.
Disable Receiving Shadows (disablereceiveshadows) <boolean>
Prevent the entity from receiving dynamic shadows on itself.
Shadow Cast Distance (shadowcastdist) <integer> !FGD
Sets how far the entity casts dynamic shadows. 0 means default distance from the shadow_control entity.
Disable Shadow Depth (disableshadowdepth) <boolean> (in all games since Portal 2)
Used to disable rendering into shadow depth (for projected textures) for this entity.
Disable flashlight (disableflashlight) <boolean> (in all games since Portal 2)
Used to disable projected texture lighting and shadows on this entity.
Projected Texture Cache (shadowdepthnocache) <integer choices> (in all games since Portal 2)
Used to hint projected texture system whether it is sufficient to cache shadow volume of this entity or to force render it every frame instead.
Choices
  • 0 : Default
  • 1 : No cache - render every frame
  • 2 : Cache it - render only once

Miscellaneous

Effects (effects) <flags> !FGD
Combination of effect flags to use.
Lag Compensation (LagCompensate) <boolean> (in all games since Left 4 Dead 2) !FGD
Set to Yes to lag compensate this entity. Should be used very sparingly!
Is Automatic-Aim Target (is_autoaim_target) <boolean> (in all games since Counter-Strike: Global Offensive) !FGD
If set to 1, this entity will slow down aiming movement for consoles and joystick controllers when the entity is under the crosshairs.