Skip to content

CreateActor

Creates an NPC actor - a dressed, named body the server owns.

soul is the face and build: a soul of any archetype from the souls by name, id or GUID (nil = the server’s appearance pool for the name, like a player without a SetSpawnInfo face). name is the label over its head (nil = none). clothing and weapons are preset GUIDs (clothing, weapons; nil = the server’s [spawn] presets, like a player; weapons = "none" makes an unarmed one that fights with its fists). world is the virtual world (nil = the shared one). The actor stands where it is put until MoveActor; its health is 100. nil when the soul is unknown or the world is full.

CreateActor(soul, x, y, z, yaw [, name, clothing, weapons, world])
Parameter Type
soul string | number | nil a soul’s name, id or GUID; nil = the server’s pool
x number metres
y number metres
z number metres
yaw number degrees (0 without)
name string the label over its head; nil = none (optional)
clothing string a clothing preset GUID; nil = the server default (optional)
weapons string a weapon preset GUID; nil = the server default; "none" = unarmed (optional)
world number the virtual world; nil = the shared one (optional)

number - the actor’s entity id; nil when it could not be made

-- a guard at the gate, dressed by the server, facing south
local guard = CreateActor("test_cuman_ai", 1290, 1095, -1, 180, "Gate guard")
SetEntityData(guard, "role", "guard")
-- an unarmed brawler set on the caller
local brawler = CreateActor(nil, x + 3, y, z, 180, "Brawler", nil, "none")
SetActorHostile(pid, brawler, true)

MoveActor · SetActorAnim · SetActorHostile · GetEntityName · DestroyEntity · FindSouls · the NPC actors group of the index