CBaseEntity: Difference between revisions
Jump to navigation
Jump to search
Important:Following Keyvalues / Inputs / Outputs are available for all entities that inherit this class, but may be overridden by game code.
mNo edit summary |
Gameplayer (talk | contribs) No edit summary |
||
Line 9: | Line 9: | ||
== Keyvalues == | == Keyvalues == | ||
{{todo|Document [[Template:KV BaseEntity/doc/Uncovered Keyvalues|the other KVs from this class]] as well.}} | {{todo|Document [[Template:KV BaseEntity/doc/Uncovered Keyvalues|the other KVs from this class]] as well.}} | ||
{{KV | {{KV|[[Classname]]|intn=classname|string|nofgd=1|Determines the characteristics of the entity before it spawns.}} | ||
{{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. (parentname [targetname],[attachment]).}} | |||
{{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 {{cmd|ent_keyvalue}} command). Entities spawned in run-time don't have a Hammer ID.|nofgd=1}} | |||
{{KV|Speed|intn=speed|float}} | |||
{{KV Render FX}} | |||
{{KV Rendermode}} | |||
{{KV|Next Think|intn=nextthink|float|Amount of time before the entity [[Thinking|thinks]] again.|nofgd=1}} | |||
{{KV|[[Effect flags|Effects]]|intn=effects|flags|Combination of effect flags to use.|nofgd=1}} | |||
{{KV|Render Color (R G B)|intn=rendercolor|color255|Color tint.}} | |||
{{KV|Model Index|intn=modelindex|short|Given the number index from dumping the <code>cl_precacheinfo modelprecache</code> table, sets entity model to 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}} | |||
{{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|Max Health|intn=max_health|int|Health cannot exceed this value. This keyvalue applies to only specific entities.}} | |||
{{KV|Health|intn=health|int|Current health of an entity. This keyvalue applies to only specific entities.}} | |||
{{KV|Target|intn=target|string}} | |||
{{KV|Damage filter|intn=damagefilter|string|Name of a filter that controls which entities can damage this entity.}} | |||
{{KV|Shadow Cast Distance|intn=shadowcastdist|int|Sets how far the entity casts dynamic shadows. 0 means default distance from the {{Ent|shadow_control}} entity.}} | |||
{{KV|TeamNum|intn=TeamNum|int}} | |||
{{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|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|Base velocity|intn=basevelocity|vector}} | |||
{{KV|Angular velocity|intn=avelocity|vector}} | |||
{{KV|Water level|intn=waterlevel|character}} | |||
{{KV|[[Gravity]]|intn=gravity|float}} | |||
{{KV|Friction|intn=friction|float|{{Warning|Non-functional.}}}} | |||
{{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|Velocity|intn=velocity|vector}} | |||
{{KV|Texture Frame|intn=texframeindex|int|The initial frame number for all animated textures on this entity.|nofgd=1}} | |||
{{KV|[[Spawnflags]]|intn=spawnflags|flags|Toggles exclusive features of an entity, its specific number is determined by the combination of flags added.|nofgd=1}} | |||
{{KV|View offset|intn=view_ofs|vector}} | |||
{{todo|Find out which class these two keyvalues belong to.}} | |||
{{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|Hammer does not move point entities accordingly in the editor.}}}} | |||
{{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.}}}} | |||
== Inputs == | == Inputs == |
Revision as of 10:48, 26 September 2024
![]() |
---|
CBaseEntity |
![]() |
The base class for all entities.

Keyvalues
Todo: Document the other KVs from this class as well.
- Global Entity Name (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.
- 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]).
- Hammer ID (hammerid) <integer> !FGD
- The entity's unique Hammer ID that's auto-generated on map compiles. Mainly used by plugins or debugging commands (like the ent_keyvalue command). Entities spawned in run-time don't have a Hammer ID.
- Speed (speed) <float>
- Render FX (renderfx) <byte choices>
- Various somewhat legacy alpha effects. See render effects.
- Render Mode (rendermode) <byte choices>
- Set a non-standard rendering mode on this entity.
Render Modes
- Render Color (R G B) (rendercolor) <color255>
- Color tint.
- Model Index (modelindex) <short> !FGD
- Given the number index from dumping the
cl_precacheinfo modelprecache
table, sets entity model to 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.
- Response Contexts (ResponseContext) <string>
- Pre-defined response system contexts; Format is
[key]:[value],[key]:[value],...
and so on.Tip:Can also be filtered for or against!
- Max Health (max_health) <integer>
- Health cannot exceed this value. This keyvalue applies to only specific entities.
- Health (health) <integer>
- Current health of an entity. This keyvalue applies to only specific entities.
- Target (target) <string>
- Damage filter (damagefilter) <string>
- Name of a filter that controls which entities can damage this entity.
- Shadow Cast Distance (shadowcastdist) <integer>
- Sets how far the entity casts dynamic shadows. 0 means default distance from the shadow_control entity.
- TeamNum (TeamNum) <integer>
- 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).
- Base velocity (basevelocity) <vector>
- Angular velocity (avelocity) <vector>
- Water level (waterlevel) <character>
- Friction (friction) <float>
Warning:Non-functional.
- Local Time (ltime) <float> !FGD
- The local time of the entity, independent of the global clock. Used mainly for physics calculations.
- Velocity (velocity) <vector>
- Texture Frame (texframeindex) <integer> !FGD
- The initial frame number for all animated textures on this entity.
- Spawnflags (spawnflags) <flags> !FGD
- Toggles exclusive features of an entity, its specific number is determined by the combination of flags added.
- View offset (view_ofs) <vector>
Todo: Find out which class these two keyvalues belong to.
- Origin (X Y Z) (origin) <coordinates>
- The position of this entity's center in the world. Rotating entities typically rotate around their origin.
Bug:Hammer does not move point entities accordingly in the editor. [todo tested in ?]
- 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:This works on brush entities, although Hammer doesn't show the new angles.
Inputs
Outputs
To get the class name of an entity, use
entity->edict()->GetClassName();
Asserts
Client
Problem:
// Model could not be found
Assert( !"Model could not be found, index is -1" );
Solution:
- Check your model name three times.
- Precache your model on both server and client.