Entitydef (decl)
From modwiki
Entity definitions are simply a list of key/value pairs or spawn arguments that define the attributes of the specified entity. Much in the same way you assign key/value pairs to entities in the level editor, entity definitions define the default keys and values for a specific entity type.
Contents |
Syntax
entityDef [entitytype] {
[key_1] [value_1]
[key_2] [value_2]
[key_3] [value_3]
...
}
Entity definitions begin with a header which consists of the keyword "entityDef" followed by the name of the entity type.
The header is followed by the body of the declaration which is enclosed in curly brackets.
The body is composed of a series of keys and values.
Inheritance and Spawn Classes
In order to explain inheritance and spawn classes we need to look at an example. Here is a paraphrased snippet from the monster_zombie_fat entity definition:
entityDef monster_zombie_fat {
"inherit" "zombie_default"
"scriptobject" "monster_zombie"
"size" "48 48 68"
"use_aas" "aas48"
"team" "1"
"rank" "0"
"health" "100"
"melee_range" "32"
"walk_on_sight" "1"
"mass" "200"
...
}
The "inherit" key/value pair can be used in any entity definition. It's purpose is to instruct the engine to inherit key/value pairs from the specified entity type to reduce redundancy. What that means is that monster_zombie_fat makes use of the key/value pairs defined in zombie_default as well as the key/value pairs defined in monster_zombie_fat's own definition.
By looking at zombie_default we can see the key/value pairs that are inherited:
entityDef zombie_default {
"inherit" "monster_default"
"blink_min" "2.0s"
"blink_max" "8.0"
...
}
Notice that this entity definition also inherits key/value pairs from another entity, in this case from monster_default:
entityDef monster_default {
"editor_color" "1 .5 0"
"editor_mins" "-24 -24 0"
"editor_maxs" "24 24 64"
"editor_showangle" "1"
"editor_copy" "anim"
...
"spawnclass" "idAI"
...
}
And at this point the inheritance stops because there is no other "inherit" key/value pair. However, there is a "spawnclass" key/value pair. The spawnclass key/value pair defines the spawn class of this entity as defined in the SDK.
Practical Example
If you wanted to create a new type of monster_zombie_fat with a health value of 200 you simply create a new entity definition that inherits from monster_zombie_fat and set a new health key/value pair...
entityDef monster_zombie_fat_200 {
"inherit" "monster_zombie_fat"
"health" "200"
}
Script Objects
To explain script objects, again, let's look at the first example posted...
entityDef monster_zombie_fat {
"inherit" "zombie_default"
"scriptobject" "monster_zombie"
"size" "48 48 68"
"use_aas" "aas48"
"team" "1"
"rank" "0"
"health" "100"
"melee_range" "32"
"walk_on_sight" "1"
"mass" "200"
...
}
The "scriptobject" key/value pair can be used in any entity definition. The function of this key/value pair is to assign a script to this entity type to control its behavior. In other words, you are defining what AI script to use to control this entity.

