SetAnimalBehavior
What an animal does by itself - calm, aggressive, defensive or skittish.
"calm"(every animal’s to start with): nothing by itself - it walks where you send it, even when hurt."aggressive": hunts the nearest player who comes withinradiusmetres (SetAnimalHostile), and whoever hurts it."defensive": turns on whoever hurts it."skittish": runs from the nearest player who comes withinradiusmetres (SetAnimalFlee, to twice the radius and 30 m at least), and from whoever hurts it.
The behaviour stays through hunts and flights: an aggressive wolf that lost its prey goes for the next player who comes near.
Syntax
Section titled “Syntax”SetAnimalBehavior(id, behavior [, radius])| Parameter | Type | |
|---|---|---|
id |
number | the animal |
behavior |
string | "calm", "aggressive", "defensive" or "skittish" |
radius |
number | metres the aggressive and the skittish keep watch over (15; 1 to 100) (optional) |
Returns
Section titled “Returns”boolean - false for anything but an animal, or an unknown word
Example
Section titled “Example”-- the forest's wolves attack on sight, its deer bolt, its boars charge whoever wounds themfor _, w in ipairs(wolves) do SetAnimalBehavior(w, "aggressive", 25) endfor _, d in ipairs(deer) do SetAnimalBehavior(d, "skittish", 30) endfor _, b in ipairs(boars) do SetAnimalBehavior(b, "defensive") endSee also
Section titled “See also”GetAnimalBehavior · SetAnimalHostile · SetAnimalFlee · SetAnimalAttack · the NPC actors group of the index
