CBaseEntity
Jump to navigation
Jump to search
![]() |
---|
CBaseEntity |
![]() |
The base class for all entities.

Keyvalues
- 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 or rendercolor32) <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).
- Local Time (ltime) <float> !FGD
- The local time of the entity, independent of the global clock. Used mainly for physics calculations.
- 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.
- FX Amount/Transparency (0–255) (renderamt) <integer>
- Transparency amount, requires a Render Mode other than Normal. 0 is invisible, 255 is fully visible.
- Disable Shadows (disableshadows) <boolean>
- Prevent the entity from creating cheap render-to-texture shadows. Does not affect shadow mapping.
- Disable Receiving Shadows (disablereceiveshadows) <boolean>
- Prevent the entity from receiving shadows on itself.
- No damage forces (nodamageforces) <boolean>
- 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.
- Angle (angle) !FGD
- 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 ?]
- Name (targetname) <string>
- The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g.
parentname
ortarget
).
Also displayed in Hammer's 2D views and Entity Report.
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.