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.
Syntax
Section titled “Syntax”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) |
Returns
Section titled “Returns”number - the actor’s entity id; nil when it could not be made
Example
Section titled “Example”-- a guard at the gate, dressed by the server, facing southlocal guard = CreateActor("test_cuman_ai", 1290, 1095, -1, 180, "Gate guard")SetEntityData(guard, "role", "guard")
-- an unarmed brawler set on the callerlocal brawler = CreateActor(nil, x + 3, y, z, 180, "Brawler", nil, "none")SetActorHostile(pid, brawler, true)See also
Section titled “See also”MoveActor · SetActorAnim · SetActorHostile · GetEntityName · DestroyEntity · FindSouls · the NPC actors group of the index
