SetEntityState
Sets a key of an entity’s bag, read by every client that sees the entity.
The bag travels with the entity’s spawn to whoever comes into range and is dropped when it leaves their view -
KcdMp.state.entity[id][key] while the entity is in view. Gone with the entity. An NPC actor’s pose rides in its bag
under the key anim (SetActorAnim).
Syntax
Section titled “Syntax”SetEntityState(id, key, value)| Parameter | Type | |
|---|---|---|
id |
number | the entity |
key |
string | 1-48 characters |
value |
string | number | boolean | nil | kept as a string; nil removes the key |
Returns
Section titled “Returns”boolean - false when there is no such entity or out of bounds
Example
Section titled “Example”local horse = CreateHorse(x, y, z, yaw, pid)SetEntityState(horse, "owner", GetPlayerName(pid)) -- the client scripts can label itSee also
Section titled “See also”GetEntityState · GetEntityStates · SetEntityData · the State bags group of the index
