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

From Valve Developer Community
Jump to navigation Jump to search
(Put "Brush" section in the ScrollBox and removed its extra-minititle (I thought less headlines might look cleaner). Trying automatic brush entity recognition (pagename starts with "func").)
(→‎Keyvalues: VBSP technically shouldn't be using brushes with the origin KV for leak testing)
 
(49 intermediate revisions by 13 users not shown)
Line 1: Line 1:
{{lang|Template:KV BaseEntity}}
<!-- if translating then translate whole 'Generic Keyvalues, Inputs and Outputs' page using language bar -->
<onlyinclude><includeonly><!--
== Keyvalues ==
{{KV|[[targetname|Name]]|intn=targetname|string|The name that other entities use to refer to this entity.}}
{{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|[[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)
:{{Important|Meant to be used in singleplayer games which have {{hl2}} style map transition ({{l4ds}} is '''not''' one of those)}}}}
{{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|[[Origin]] (X Y Z)|intn=origin|coordinates|The position of this entity's center in the world. Rotating entities typically rotate around their origin.}}
:{{bug|hidetested=1|Editing this manually in Hammer does not move point entities accordingly in the editor.}}
:{{note|Brush entities with this keyvalue count towards [[leak]] tests, whereas they do not if this keyvalue is absent.}}
{{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.}}


-->{{ScrollBox
=== Parenting ===
|title=Base
{{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.}}}}
|noscroll={{{noscroll|}}}
|<!--


  ++ BRUSH ++
=== 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}}}}
{{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}}}}


-->{{#if:{{{brush|  {{#ifeq: {{str left|{{ROOTPAGENAME}}|4}} | func | 1 | }}  }}}|
=== Rendering ===
{{KV|Collisions|intn=solid|choices|Method of collision for this entity. {{ExpandBox|
{{KV RenderFields}}
:*0: None
{{KV Shadow}}
:*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: Oriented Bounding Box (Use for runtime spawned brush entities meant to be rotated) {{Not in FGD}}
:*4: Oriented Bounding Box but constrained to [[QAngle|Yaw]] only {{Not in FGD}}
:*5: Custom/Test (Usually no collision with anything) {{Not in FGD}}
:*6: [[VPhysics]]}}
| }}
<!-- "mins" and "maxs" used to be here, but the "Bounding Box" page already describes it -->
<!-- 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}}
-->
<br />
| }}<!-- END #IF


  ++ BASE ++
=== Miscellaneous ===
 
{{Expand|
-->{{KV|[[targetname|Name]]|intn=targetname|string|The name that other entities use to refer to this entity.}}
{{KV|[[Effect flags|Effects]]|intn=effects|flags|Combination of effect flags to use.|nofgd=1}}
<!-- This probably have too little use cases, we'll have to see if someone objects.
{{KV|Global Entity Name|intn=globalname|string| When the player transitions to a new map, entities in the new map with matching globalnames will have their previous map's states copied over to it.}}
-->
{{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}}{{tip|{{ent|phys_constraint}}can be used as a workaround if parenting fails.}}}}
{{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.}}}}
{{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.}}}}
<!-- This probably have too little use cases, we'll have to see if someone objects. Thankfully the page already describes its existence.
{{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|[[Classname]]|intn=classname|string|Determines the characteristics of the entity ''before'' it spawns. {{tip|Changing this on runtime still has use, like making matching an entry in [[S_PreserveEnts]] will persist the entity on new rounds!}}|nofgd=1}}
{{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}}
{{KV|[[Effect flags|Effects]]|intn=effects|int|Combination of effect flags to use.|nofgd=1}}
<!-- I'm not sure what the use cases of these 2 are, so ill hide them for now. Sourcemod scripters don't use "hammerid" often either
{{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|Next Think|intn=nextthink|float|Amount of time before the entity [[Thinking|thinks]] again.|nofgd=1}}
{{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}}
-->
<!--
  ++ Game Specifics ++
 
  IF: L4D2
 
-->{{#if:{{{l4d2|}}}|
{{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|[[Entity_Scripts#Thinker_Functions|Thinker 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. 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|[[Lag Compensation]]|intn=LagCompensate|boolean|Set to '''Yes''' to lag compensate this entity. Should be used very sparingly!|nofgd=1|since=L4D2}}
<!-- Its 360, so it goes away
{{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|[[Entity_Scripts#Thinker_Functions|Thinker 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. 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}}
<!-- Its 360, so it goes away
{{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></onlyinclude>
{{documentation}}
<!-- Add categories to the /doc subpage, not here -->

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.