Template:Archived Page History/CBaseEntity/en: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 2: Line 2:
The base class for all entities.
The base class for all entities.


== 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 BaseEntity}}
{{KV BaseEntity}}
{{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 (or occasionally {{path|materials/}}).}}
{{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 (or occasionally {{path|materials/}}). Not all entities will actually render the model.}}


== Inputs ==
=== Inputs ===
{{I BaseEntity}}
{{I BaseEntity}}


== Outputs ==
=== Outputs ===
{{O BaseEntity|l4d=1}}
{{O BaseEntity|l4d=1}}


= Programming related =
== Programming related ==
To get the class name of an entity, use  
To get the class name of an entity, use  
<source lang="cpp">
<source lang="cpp">
Line 19: Line 19:
</source>
</source>


== Asserts ==
=== Asserts ===
=== Client ===
==== Client ====
'''Problem:'''
'''Problem:'''
<source lang="cpp">
<source lang="cpp">

Revision as of 12:53, 15 May 2024

Flag-white.pngEnglish (en)

The base class for all entities.

Keyvalues

Todo: Document the other KVs from this class as well.


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 (or occasionally 🖿materials/). Not all entities will actually render the model.

Inputs

Outputs

Programming related

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.