Skip to content

SetActorUse

Sends an actor to one of the level’s seats, beds or work spots to do what the game’s people do there.

key is a smart object’s key of GetSmartObjects. The actor walks to the object (at 1.3 m/s, around walls on the navigation mesh), starts the activity with the game’s own animation - sits down, lies down, kneels in the bed, takes up the work - and stays in it until StopActorUse or a MoveActor (it gets up first, then walks). OnActorActivity tells "start" and "end". One actor an object; a woman takes the women’s animation where the game has one. A chore mimes its tool (no draw knife in the hands at the trestle).

SetActorUse(id, key)
Parameter Type
id number the actor
key string the smart object’s key

boolean - false for an unknown or taken object, an activity without an animation for this body, or an actor that is not standing free

-- every guard off duty finds a seat
local x, y, z = GetEntityPos(guard)
local seat = GetNearestSmartObject(x, y, z, 40, "sit")
if seat then SetActorUse(guard, seat.key) end

GetSmartObjects · SetActorUseAt · StopActorUse · OnActorActivity · the Actor life group of the index