entityguide‎ > ‎

Entity Keyvalues

Introduction

Within Valve Hammer Editor's .rmf- and .map-file formats, all keyvalues are saved as pairs of two strings - the key's name and the value - even if a value is a number. A string is a row/chain of chars, or simply, a piece of text if that is easier for you to grasp, which's end is defined by a byte with all bits set to zero, called the null-terminator. However, this is not continuously the case in game. When the map loads, known keyvalues are parsed into the entities' internal data structures of different types. If a keyvalue is not know, it will be discarded and then can no longer be read after the map has loaded.


Entity-specific Keyvalues

Entity-specific keyvalues are keyvalues which exist for specific entity classes only. They are the direct property of the respective entity and meddling with them from the outside can easily cause undefined behaviour. The entity might rely on an entity-specific keyvalue to manage its internal state, or it only parses it once when it spawns and does not care about it after that. It might also
be perfectly safe to change it and work without problems. In short: It depends. If you want to change an entity-specific keyvalue,
ask in the SC Forums whether your ambition is safe or not. Some entity-specific keyvalues can be read and written through
trigger_changevalue, trigger_copyvalue and trigger_condition; for example, all keyvalues of trigger_entity_iterator are supported. The majority of entity-specific keyvalues is not supported, yet, and can only be replaced directly. I'll spare you from the technical details and let you know the range of supported entity-specific keyvalues is worked on being expanded. Entity-specific keyvalues can often (but not always) be identified through what they read, e.g. "m_isz*" (usually a string then), "m_i*" (integer), "m_f*" (float), and so forth. However, the underscore may be missing, or the keyvalue may not have any hints like that at all! There is one absolute method to figure out if a keyvalue from the FGD is an entity-specific keyvalue: If it is not a base keyvalue.



Base Keyvalues/Private Entity Variables

By base keyvalues, I am refering to private entity variables ("PEV") which are inherited by all entities from the entity base class. This means, that no matter what entity you are dealing with, it has the ability to store these basic keyvalues. There is a total of exactly 123 (what a nice number) private entity variables. These values are often kept up to date between server and client and are supposed to cover all sorts of generic information, like position in the map, velocity, visual appearance, health and armor. As a result, not all entities do require all their base keyvalues; not at all. A lot of them are unused for specific entities. Henceforth, despite making
no sense until now, a lot of base keyvalues are abused to store information which is unrelated to what they're called, because
of programming convenience. This is good for us, because base keyvalues can be read and written from the outside, while entity-specific keyvalues can only be overwritten, and we can easily tell which base keyvalues correspond to what data by switching Smart-Edit-mode in VHE off or by just checking the FGD. Many of these can be touched without second thought, while some will exact vengeance on you if you do.


Here is a list of all base keyvalues. All entities do have these, even if they do not show up in Valve Hammer Editor. Most of them have an expected functionality/original purpose. However, the exact ways they are used by the respective entities are all up to the game engine.

Key nameVal. typeDescriptionExample value
classnameStringClassname of that entity."func_train"
globalnameStringGlobal name used for level transitions."map02_scientist_003"
origin3D-VectorPosition of the entity in world coordinates.30 60 90
oldorigin3D-VectorOld position. Always 0 0 0 in engine.0 0 0
velocity3D-VectorDirection and speed of the entity.100 20 0
basevelocity3D-VectorBase direction and speed of the entity. (for example if standing
on a train)
100 20 0
clbasevelocity3D-VectorUsed by client.100 20 0
movedir3D-VectorMovement direction used by trigger_push or func_rotating.0.5 1 0
angles3D-VectorAngles of the entity. (pitch, yaw, roll)0 90 0
avelocity3D-VectorAngular velocity. (rotational speed, degrees per second)0 25 0
punchangle3D-VectorAuto-decaying view angle adjustment. (e.g. when an alien grunt punches you)0 25 0
v_angle3D-VectorViewing angle. (player only)0 25 0
endpos3D-VectorEnd position; used by some moving entities.500 100 0
startpos3D-VectorStart position, used by some moving entities100 0 0
impacttimeFloat--
starttimeFloat--
fixangleIntegerValue to tell the engine, what to do with the entity angles.
0: nothing;
1: force view angles;
2: add avelocity.
0
idealpitchFloat--
pitch_speedFloat--
ideal_yawFloat--
yaw_speedFloat--
modelindexIntegerIndex of the entity model.23
modelStringName of the entity model."models/scientist.mdl"
viewmodelIntegerPlayer's viewmodel. (what you see in first person)23
weaponmodelIntegerPlayer's weaponmodel. (what other players see when they look
at you)
23
absmin3D-VectorAbsolute mins; coordinates of the lower left back corner of the entity hull in world space.100 100 0
absmax3D-VectorAbsolute maxs; coordinates of the upper right front corner of the entity hull in world space.132 132 32
mins3D-VectorEntity hull mins; coordinates of the lower left back corner of the entity hull.-16 -16 -16
maxs3D-VectorEntity hull maxs; coordinates of the upper right front corner of the entity hull.16 16 16
size3D-VectorEntity hull size.32 32 32
ltimeFloat--
nextthinkFloatTime-value of the entity, telling the engine when to call the "think"-function of the entity next, which may compute and execute several entity functionalities. (e.g. train movement)(depends on server time value)
movetypeIntegerMovetype-value, telling engine how this entity should behave physically. (see movetype value list below)1
solidIntegerSolid-value, telling engine how OTHER entities should behave physically when they touch this entity. (see solid value list below)1
skinIntegerSkin of this entity. (texture selection for studiomodels)1
bodyIntegerBody of this entity. (sub-model selection for studiomodels)1
effectsIntegerEffects-flag, telling the engine how to render this entity. (see effects value list below)1
gravityFloatPercentage of "normal" gravity.100
frictionFloatUsed by engine when movetype is MOVETYPE_BOUNCE (inverse elasticity); used by several entities for friction. (e.g. func_pushable)100
light_levelInteger--
sequenceIntegerCurrent animation sequence.3
gaitsequenceIntegerMovement animation sequence for player. (0 for none)2
frameFloatPercentage of playback position in animation sequences. (0 - 255)102
animtimeFloatWorld time when frame was set.(depends on server time value)
framerateFloatAnimation playback rate. (-8x to 8x)3
controllerbyte[4]Bone controller setting. (0 - 255)110 20 0 80
blendingbyte[2]Blending-amount between sub-sequences. (0 - 255)200 120
scaleFloatSprite rendering scale. (0 - 255)0.25
rendermodeIntegerRender-mode.(see list of rendermode modes below)
renderamtFloatRender-amount.255
rendercolor3D-VectorRender-color for color render-mode.255 128 32
renderfxIntegerRender-effect.(see list of renderfx modes below)
healthFloatHealth-points of the entity. Use it in trigger_camera to check if this camera is used (1 for camera is being used, 0 for not).100
fragsFloatFrags of the entity.100
weaponsIntegerBit-mask for available weapons.-
takedamageIntegerTakedamage-value, telling the engine if and how this entity can take damage. (see list of takedamage values below)0
deadflagIntegerDeadflag-value, telling the engine what the life/death status of the entity is. (see list of deadflag values below)0
view_ofs3D-VectorView offset vector.8 0 32
buttonIntegerButton-flags, sent from client telling the server, which buttons are pressed. (see list of button values below)0
impulseInteger--
chainEntity-referenceEntity-pointer when linked into a linked list.Entity-pointer or NULL.
dmg_inflictorEntity-referenceEntity-pointer to the entity that did damage to this entity.Entity-pointer or NULL.
enemyEntity-referenceEntity-pointer to the current enemy this entity is focusing on.Entity-pointer or NULL.
aimentEntity-referenceEntity-pointer when movetype is MOVETYPE_FOLLOW.Entity-pointer or NULL.
ownerEntity-referenceEntity-pointer when this entity is owned by another entity. Examples: When a func_tank is being used by a player, the tank's owner is that player. An RPG fired by a player is owned by that player. Entities have no collision with their owner and vice versa.Entity-pointer or NULL.
groundentityEntity-referenceEntity-pointer to the entity where this entity is standing on. (includes "worldspawn" for map)Entity-pointer or NULL.
spawnflagsIntegerSpawnflags, set by mapper.0
flagsIntegerFlags, set by engine. (see list of flags below)0
colormapIntegerLow byte topcolor; high byte bottomcolor. This specifies model custom colors, as seen in use on player models.57020
topcolorIntegerTop color of player model.225
bottomcolorIntegerBottom color of player model.225
teamInteger--
classifyIntegerClassification of this entity used in monsters relationship. Can be used with monsters, breakables (including doors) and any other targetable entity (in mean of attack).(see list of classify values below)
max_healthFloatMaximum health this entity can have.100
teleport_timeFloat--
armortypeFloatMaximum armor this entity can have.100
armorvalueFloatArmor points of this entity.100
waterlevelIntegerValue to tell the server if the entity is swimming, on dry ground
or wading.
(see list of waterlevel values below)
watertypeIntegerWatertype. (slime, lava, water)0
targetStringName of the target of this entity."top_sprite"
targetnameStringName of this entity."trigger_top_sprite_on"
netnameStringUsed in several ways, see FGD or ask someone. For players, this contains their nickname."lalala"
messageStringUsed in several ways, see FGD or ask someone."lalala"
dmg_takeFloat--
dmg_saveFloat--
dmgFloatAmount of damage this entity will inflict on others if it deals damage.10
dmgtimeFloat--
noiseString--
noise1String--
noise2String--
noise3String--
speedFloatSpeed of this entity (not current speed; that's what velocity is!)100
air_finishedFloat--
pain_finishedFloat--
radsuit_finishedFloat--
pContainingEntityEntity-referenceEntity-pointer. (?)Entity-pointer or NULL
playerclassInteger--
maxspeedFloatMaximum speed of this entity.200
fovFloatField of view90
weaponanimInteger--
pushmsecInteger--
bInDuckInteger1 if crouching, 0 otherwise.0
flTimeStepSoundIntegerTime-delay for step sounds. (?)-
flSwimTimeInteger--
flDuckTimeInteger--
iStepLeftInteger--
flFallVelocityFloat--
gamestateInteger--
oldbuttonsInteger--
groupinfoInteger--
iuser1 - iuser4IntegerUser-defined integer-values, used by Sven Co-op on several entities in different ways.-
fuser1 - fuser4FloatUser-defined float-values, used by Sven Co-op on several entities in different ways.-
vuser1 - vuser43D-VectorUser-defined vectors, used by Sven Co-op on several entities
in different ways.
-
euser1 - euser4Entity-referenceUser-defined entity-pointers, used by Sven Co-op on several entities in different ways.-


What follows is several tables explaining what different values mean for various base keyvalues. Since SC 4.6, you can also write the value name instead of the numeric value, given that it fits the targeted keyvalue type. You then can also put a leading tilde ('~') to perform bitwise negation, which is useful for flags.


List of "flags"-flags


Flag ValueFlag NameDescription
1FL_FLYEntity can fly.
2FL_SWIMEntity can swim.
4FL_CONVEYOREntity is a conveyor.
8FL_CLIENTEntity is a client/player.
16FL_INWATEREntity is in water.
32FL_MONSTEREntity is a monster.
64FL_GODMODEEntity is invincible.
128FL_NOTARGETEntity won't be attacked by enemies.
256FL_SKIPLOCALHOSTDon't tell clients abouts this entity; they're predicting this entity by themselves.
512FL_ONGROUNDEntity is on the ground.
1024FL_PARTIALGROUNDAt least one of the 4 corners of this entity's hull does not touch the ground.
2048FL_WATERJUMPPlayer jumping out of water.
4096FL_FROZENPlayer is frozen. (Whilst a trigger_camera-sequence)
8192FL_FAKECLIENTFake client, simulated server side; don't send network messages to them. (Used for bots)
16384FL_DUCKINGPlayer is fully crouching.
32768FL_FLOATEntity can float on water.
65536FL_NOWEAPONSDenies use of player weapon.


List of "button"-flags


Flag ValueFlag NameDescription
1IN_ATTACKPrimary-button attack pressed.
2IN_JUMPJump-button pressed.
4IN_DUCKDuck-button pressed.
8IN_FORWARDForward-button pressed.
16IN_BACKBackward-button pressed.
32IN_USEUse-button pressed.
64IN_CANCEL<unknown>
128IN_LEFTTurn left-button pressed.
256IN_RIGHTTurn right-button pressed
512IN_MOVELEFTStrafe left-button pressed.
1024IN_MOVERIGHTStrafe right-button pressed.
2048IN_ATTACK2Secondary attack-button pressed.
4096IN_RUNWalk-button pressed.
8192IN_RELOADReload-button pressed.
16384IN_ALT1Left "Alt"-button pressed.
32768IN_SCOREScoreboard-button pressed.


List of "deadflags"-states


State ValueState NameDescription
0DEAD_NOAlive.
1DEAD_DYINGPlaying death animation or corpse still falling off of a ledge waiting to hit the ground.
2DEAD_DEADDead; lying still.
3DEAD_RESPAWNABLE<unknown>
4DEAD_DISCARDBODY<unknown>

List of "takedamage"-states


State ValueState NameDescription
0DAMAGE_NODoes not take damage.
1DAMAGE_YESDoes take damage.
2DAMAGE_AIMDoes only take damage from aiming weapons.

List of "solid"-states


State ValueState NameDescription
0SOLID_NOTNo interaction with other objects.
1SOLID_TRIGGERNotice touch, but don't block.
2SOLID_BBOXTouch on edge, block.
3SOLID_SLIDEBOXTouch on edge, but not if other is on ground.
4SOLID_BSPBSP clip, touch on edge, block.

List of "waterlevel"-states


State ValueState NameDescription
0WATERLEVEL_DRYNot in water.
1WATERLEVEL_FEETFeet underwater.
2WATERLEVEL_WAISTWaist underwater.
3WATERLEVEL_HEADHead underwater.

List of "movetype"-states


State ValueState NameDescription
0MOVETYPE_NONENever moves.
3MOVETYPE_WALKPlayer only; moving on the ground.
4MOVETYPE_STEPGravity, special edge handling; monsters use this.
5MOVETYPE_FLYNo gravity, but still collides with stuff.
6MOVETYPE_TOSSReceive gravity and collisions.
7MOVETYPE_PUSHNo clip to world; push and crush. (e.g. func_train)
8MOVETYPE_NOCLIPNo gravity; no collisions; still handle velocity and angular velocity.
9MOVETYPE_FLYMISSILEHandled as if was larger for monsters. (Collides more easily)
10MOVETYPE_BOUNCEJust like "Toss", but reflect velocity when contacting surfaces. (E.g. when dropping weapons/ammo)
11MOVETYPE_ BOUNCEMISSILELike "Bounce", but without gravity.
12MOVETYPE_FOLLOWTrack movement of aiming entity.
13MOVETYPE_PUSHSTEPBSP model that needs gravity and world collisions; uses nearest hull for world collision. (e.g. func_pushable)

List of "effects"-flags


Flag ValueFlag NameDescription
1EF_BRIGHTFIELDSwirling cloud of yellow particles. (Used when a monster is stuck in wall to receice the level designer's attention)
2EF_MUZZLEFLASHSingle frame ELIGHT on entity attachment 0.
4EF_BRIGHTLIGHTDLIGHT centered at entity origin.
8EF_DIMLIGHTPlayer flashlight.
16EF_INVLIGHTGet model-lighting from ceiling. (Barnacles have this)
32EF_NOINTERPDon't interpolate the next frame.
64EF_LIGHTRocket flare pulsing glow sprite.
128EF_NODRAWDon't draw entity. (Brush- basedtriggers have this)
256EF_NOANIMTEXTURESNever animate a texture on given brush.
512EF_FRAMEANIMTEXTURESNever animate a texture on given brush. but if the brush has a "frame" value, the corresponding animating texture is used. 
1024EF_SPRITE_CUSTOM_VPOverride sprite viewport draw mode with the type specified in key "sequence".
2048EF_NODECALSNo decals will be drawn on this entity.

List of "renderfx" -modes


ValueState NameDescription
0kRenderFxNoneNormal render mode.
1kRenderFxPulseSlowSlow pulse.
2kRenderFxPulseFastFast pulse.
3kRenderFxPulseSlowWideSlow wide pulse.
4kRenderFxPulseFastWideFast wide pulse.
5kRenderFxFadeSlowSlow fade away.
6kRenderFxFadeFastFast fade away.
7kRenderFxSolidSlowSlow become solid.
8kRenderFxSolidFastFast become solid.
9kRenderFxStrobeSlowSlow strobe.
10kRenderFxStrobeFastFast strobe.
11kRenderFxStrobeFasterFaster strobe.
12kRenderFxFlickerSlowSlow flicker.
13kRenderFxFlickerFastFast flicker.
14kRenderFxNoDissipationConstant glow.
15kRenderFxDistortDistort/scale/translate flicker.
16kRenderFxHologramkRenderFxDistort + distance fade
17kRenderFxDeadPlayerkRenderAmt is the player index
18kRenderFxExplodeScale up really big!
19kRenderFxGlowShellGlowing Shell
20kRenderFxClampMinScaleKeep this sprite from getting very small. (sprites only!)

List of "rendermode"-modes


State ValueState NameDescription
0kRenderNormalNormal render mode.
1kRenderTransColorColor with transparency render mode.
2kRenderTransTextureTexture with transparency render mode.
3kRenderGlowGlow render mode.
4kRenderTransAlphaTexture with transparency and alpha render mode.
5kRenderTransAddAdditive render mode.

List of "classify" -states


ValueState NameDescription
-1CLASS_FORCE_NONEForces class override to none.
0CLASS_NONENo classification.
1CLASS_MACHINEIs machine.
2CLASS_PLAYERIs player.
3CLASS_HUMAN_PASSIVEIs passive human.
4CLASS_HUMAN_MILITARYIs military human.
5CLASS_ALIEN_MILITARYIs military alien.
6CLASS_ALIEN_PASSIVEIs passive alien.
7CLASS_ALIEN_MONSTERIs monster alien.
8CLASS_ALIEN_PREYIs prey alien.
9CLASS_ALIEN_PREDATORIs predator alien.
10CLASS_INSECTIs insect.
11CLASS_PLAYER_ALLYIs player ally.
12CLASS_PLAYER_BIOWEAPONIs player bioweapon.
13CLASS_ALIEN_BIOWEAPONIs alien bioweapon.
14CLASS_XRACE_PITDRONEIs X-Race pitdrone
15CLASS_XRACE_SHOCKIs X-Race shock trooper (also Voltigores)
16CLASS_TEAM1Is on Team 1 (used to put players into teams to enable special features)
17CLASS_TEAM2Is on Team 2 (used to put players into teams to enable special features)
18CLASS_TEAM3Is on Team 3 (used to put players into teams to enable special features)
19CLASS_TEAM4Is on Team 4 (used to put players into teams to enable special features)
99CLASS_BARNACLEIs Barnacle (used by xen trees/spores, Barnacle is Alien Predator)

Comments