SetAnimalFlee
Runs an animal from a player.
The animal runs straight away from the player at its kind’s flight pace (deer and hares ~9 m/s, a boar 5.5, sheep and cattle
4.5-5) until it is distance metres from them, then stands. A MoveActor or StopActor of yours ends it, and so does
SetAnimalFlee(id, nil).
Syntax
Section titled “Syntax”SetAnimalFlee(id, pid [, distance])| Parameter | Type | |
|---|---|---|
id |
number | the animal |
pid |
number | nil | the player to run from; nil stops the flight |
distance |
number | metres from the player where it stops (30; 3 to 200) (optional) |
Returns
Section titled “Returns”boolean - false for anything but a live animal, or a player not in its world
Example
Section titled “Example”-- the deer bolts when a shot misses itfunction OnProjectileHitZone(pid, zone, x, y, z) if zone == deer_zone then SetAnimalFlee(deer, pid, 60) endendSee also
Section titled “See also”SetAnimalHostile · SetAnimalBehavior · GetAnimalState · the NPC actors group of the index
