CreateAnimal
Creates an animal - the game’s wolf, boar, deer, hare … that the server walks like an actor.
animal is the kind - "wolf", "wild dog", "dog", "boar", "pig", "red deer stag", "red deer doe",
"roe deer buck", "roe deer hind", "hare", "sheep ewe", "sheep ram", "cattle cow", "cattle bull", "hen",
"raven" (case and spaces do not matter; "deer", "stag", "doe", "buck", "hind", "sheep", "ram", "cow",
"bull" and "chicken" work too) - or one of its souls from the souls by name, id or GUID, for a
particular look (a soul of another archetype is refused). name is the mode’s name for it (GetEntityName, the server
log; no label shows over an animal). world is the virtual world (nil = the shared one). It stands where it is put until
MoveActor - about 1.5 walks, 4 trots, 6.5 or more runs - and its health is 100 (SetActorHealth makes a hare
easier to kill). It never fights back and gives nothing when it dies: the mode decides what a kill is worth in
OnActorDeath. nil for an unknown kind, a soul that is no animal’s, a full world, or a soul named instead of a kind
(by name, id or GUID) when the server has no tables export of the game loaded (the kinds still work then).
Syntax
Section titled “Syntax”CreateAnimal(animal, x, y, z, yaw [, name, world])| Parameter | Type | |
|---|---|---|
animal |
string | number | the kind ("wolf", "red deer stag" …) or an animal’s soul by name, id or GUID |
x |
number | metres |
y |
number | metres |
z |
number | metres (below 0 = on the ground) |
yaw |
number | degrees (0 without) |
name |
string | the mode’s name for it; nil = none (optional) |
world |
number | the virtual world; nil = the shared one (optional) |
Returns
Section titled “Returns”number - the animal’s entity id; nil when it could not be made (an unknown kind, a soul that is no animal’s or cannot be told apart without the tables export, a full world)
Example
Section titled “Example”-- a pack of three wolves trotting to the clearingfor i = 1, 3 do local wolf = CreateAnimal("wolf", 1290 + i * 2, 1095, -1, 0) MoveActor(wolf, 1320, 1140, -1, 4)end
-- a hare that dies to one arrow, and pays for itlocal hare = CreateAnimal("hare", x + 5, y, -1, 90)SetActorHealth(hare, 10)function OnActorDeath(id, killer) if id == hare and killer >= 0 then GivePlayerItem(killer, "rabbitMeat", 1) endendSee also
Section titled “See also”CreateActor · MoveActor · SetActorHealth · OnActorDeath · DestroyEntity · FindSouls · the NPC actors group of the index
