MoveActor
Walks an actor to a point - around the walls when the server has the navigation mesh.
At speed metres per second, facing its way - about 1.5 walks, 4 runs, 6.5 sprints (the body’s clips follow the speed).
OnActorArrive fires when it gets there. A new target replaces the old one; a pose (SetActorAnim) is cleared. With
the level’s navigation mesh (HasNavmesh, the navigation guide) the actor takes the walk the game’s own
people would - corner by corner, around walls and through doorways; a target off the mesh (in a wall, on a roof) or a
server without the mesh gets the straight line, where the body stops at a wall and catches up when the line comes out.
A closed door in its way opens for everyone as the actor gets there; a locked one (SetDoorState) ends the walk at the
door, with OnActorArrive ([actors] open_doors).
A horse nobody rides walks too - a server horse (CreateHorse) or a player’s own (SetHorseOwner): the speed picks
its gait (about 1.5 a walk, 3.5 a trot, 6.5 a canter, 9.5 a gallop) and OnActorArrive gets the horse’s id at the end - a
player’s call for their horse, a herd moved, a pack horse led. A player who mounts it on the way ends the walk; a horse a
player rides is refused. StopActor and TurnActor take a horse as well.
Syntax
Section titled “Syntax”MoveActor(id, x, y, z [, speed])| Parameter | Type | |
|---|---|---|
id |
number | the actor |
x |
number | metres |
y |
number | metres |
z |
number | metres; below 0 = on the ground there (the server’s world data, else the height the actor walks at) |
speed |
number | metres per second (1.5) (optional) |
Returns
Section titled “Returns”boolean - false for anything but a living actor that is not knocked out (SetActorKnockedOut) or grabbing a body (ActorCarryEntity), or a living horse no player rides
Example
Section titled “Example”MoveActor(guard, 1300, 1100, -1, 1.5) -- a walkMoveActor(runner, tx, ty, tz, 4) -- a run
-- a player calls their horse: it canters to themlocal x, y, z = GetPlayerPos(pid)MoveActor(horse, x + 2, y, -1, 6.5)See also
Section titled “See also”StopActor · TurnActor · IsActorMoving · OnActorArrive · OnPlayerWhistle · the NPC actors group of the index
