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

From Valve Developer Community
Jump to navigation Jump to search
m (grammar error)
(→‎Keyvalues: VBSP technically shouldn't be using brushes with the origin KV for leak testing)
 
(56 intermediate revisions by 14 users not shown)
Line 1: Line 1:
<includeonly>
<!-- if translating then translate whole 'Generic Keyvalues, Inputs and Outputs' page using language bar -->
<!--
== Keyvalues ==
  ++ BRUSH ++
-->
<!-- IF: BRUSH -->
{{#if:{{{brush|}}}|{{minititle|Brush}}
{{KV|Minimum Bounding Box Size|intn=mins|vector|Starting at the brush's origin, mark the maximum bounding box's corner as this far away. Requires<code>maxs</code>if used so the other side of the box isn't empty.|nofgd=1}}
{{KV|Maximum Bounding Box Size|intn=maxs|vector|Starting at the brush's origin, mark the minimum bounding box's corner as this far away. Requires<code>mins</code>if used so the other side of the box isn't empty.|nofgd=1}}
:{{note|To translate a brush's size in Hammer to these keys, first divide the size value shown in Hammer by 2. Then, apply the result to the<code>maxs</code>key, and invert the number (Multiply / Divide by -1) and apply it for the<code>mins</code>key.}}
:{{note|If collisions is already set, it must be set back to Bounding Box (solid 2).}}
{{KV|Collisions|intn=solid|choices|Method of collision for this entity.
:*0: None
:*1: BSP ([[QPhysics]]) {{Not in FGD}} {{bug|In {{portal2}}, if an entity using QPhysics collisions is hit by [[Gel]], the game will crash!}}
:*2: [[Bounding box|Bounding Box]]
:*3: [[Bounding box|Oriented Bounding Box]] (Use for runtime spawned rotated brush entities) {{Not in FGD}}
:*4: [[Bounding box|Oriented Bounding Box]], constrained to [[QAngle|Yaw]] only {{Not in FGD}}
:*5: Custom/Test (Usually no collision with anything) {{Not in FGD}}
:*6: [[VPhysics]]
| }}
<!-- We should make a new page for "model index"? -->
{{KV|Model Index|intn=modelindex|short|Given the number index from dumping the<code>cl_precacheinfo modelprecache</code>table, sets entity model to of the index. {{warning|If an entity has animations that ''will be'' played, then the set model also must have its own sequences, else the game crashes.}}|nofgd=1}}
| }}
<!--
  ++ Base ++
-->
{{minititle|Base}}
{{KV|[[targetname|Name]]|intn=targetname|string|The name that other entities use to refer to this entity.}}
{{KV|[[targetname|Name]]|intn=targetname|string|The name that other entities use to refer to this entity.}}
{{KV|[[Parent]]|intn=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|[[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.}}}}
{{KV|Global Entity Name|intn=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|[[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)
{{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.{{note|Hammer does not move the entities accordingly only in the editor.}}}}
:{{Important|Meant to be used in singleplayer games which have {{hl2}} style map transition ({{l4ds}} is '''not''' one of those)}}}}
{{KV|[[Pitch Yaw Roll]] (X Y Z)|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|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).}}
{{KV|[[ResponseContext|Response Contexts]]|intn=ResponseContext|string|Pre-defined response system contexts; Format is <code>key:value,key:value,...</code>and so on. {{tip|Can also be [[filter_activator_context|filtered for or against!]]}}}}
{{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.}}
{{KV|[[Classname]]|intn=classname|string|Determines the characteristics of the entity ''before'' it spawns. {{tip|Changing classnames using the{{ent|AddOutput}}input can still influence the game's code, like making the classname match one element in the [[S_PreserveEnts]] list will make the entity persists on new rounds!}}|nofgd=1}}
:{{bug|hidetested=1|Editing this manually in Hammer does not move point entities accordingly in the editor.}}
{{KV|[[Flag|Flags]]|intn=spawnflags|integer|Toggles exclusive features of an entity, its specific number is determined by the combination of flags added.|nofgd=1}}
:{{note|Brush entities with this keyvalue count towards [[leak]] tests, whereas they do not if this keyvalue is absent.}}
{{KV|[[Effect flags|Effects]]|intn=effects|int|Combination of effect flags to use.|nofgd=1}}
{{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.}}}}
<!-- I'm not sure what the use cases of these 2 are, so ill hide them for now. Not too much of a harm to show "hammerid" for the plugin / sourcepawn peeps
{{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|Local Time|intn=ltime|float|The local time of the entity, independent of the global clock. Used mainly for physics calculations.|nofgd=1}}
{{KV|Damage Filter|intn=damagefilter|target_destination|Name of a filter that controls which entities can damage this entity.}}
{{KV|Next Think|intn=nextthink|float|Amount of time before the entity [[Thinking|thinks]] again.|nofgd=1}}
 
-->
=== Parenting ===
{{KV|Hammer ID|intn=hammerid|int|The entity's unique [[Hammer]] ID that's auto-generated on map compiles. Mainly used by plugins or debugging commands (like the'''<code>ent_keyvalue</code>'''command). Run-time spawned entities don't have a Hammer ID.|nofgd=1}}
{{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.}}}}
<!--
 
  ++ Game Specifics ++
=== Vscript ===
-->
{{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}}}}
<!-- IF: L4D2 -->{{#if:{{{l4d2|}}}|
{{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}}}}
{{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.|since=L4D2}}
 
{{KV|Script think function|intn=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}}
=== Rendering ===
{{KV RenderFields}}
{{KV Shadow}}
 
=== Miscellaneous ===
{{Expand|
{{KV|[[Effect flags|Effects]]|intn=effects|flags|Combination of effect flags to use.|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|[[Lag Compensation]]|intn=LagCompensate|boolean|Set to '''Yes''' to lag compensate this entity. Should be used very sparingly!|nofgd=1|since=L4D2}}
{{KV|Disable for Xbox 360|intn=disableX360|bool|If this entity should automatically be given the 'Disable' input on the Xbox 360 version of Source.|nofgd=1|since=L4D2}}
| <!-- ELSE IF: NOT BASE [CSGO] -->{{#if:{{{base|}}}||
{{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.|since=L4D2}}
{{KV|Script think function|intn=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]]|intn=LagCompensate|boolean|Set to '''Yes''' to lag compensate this entity. Should be used very sparingly!|nofgd=1|since=L4D2}}
{{KV|Disable for Xbox 360|intn=disableX360|bool|If this entity should automatically be given the 'Disable' input on the Xbox 360 version of Source.|nofgd=1|since=L4D2}}
{{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|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}}
| }} }}</includeonly>
}}
<noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage, not here -->
</noinclude>

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.