Arma 3: Animals: Override Default Animal Behaviour Via Script

From Bohemia Interactive Community
Revision as of 20:44, 11 December 2015 by Burkhar (talk | contribs) (Created page with "{{note|Please note, this feature is WIP and works only in Development Build 1.55.133700 and later!}} ---- == Introduction == Current system of animal behaviour is that anima...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search



Current system of animal behaviour is that animals are randomly idling / moving around when spawned. This is caused by changes on engine side to save some performance. However, many people from community want to be able to control animals via script in some reasonable manner. So I started to work on some tweaks of animal animation configs which will offer this possibility to them. This page is overview of this feature and tutorial, how this behaviour can be achieved.

At the moment, the tweaks are made for dog animation config only, because dog has the most variable movement possibilities and is mostly requested by community. Don't worry, other animals will be tweaked as well.


Animals can be spawned via multiple ways. Here I will explain you which ways will work with my recent tweaks, which partly and which not.

Module Animals from Sites category

Probably the easiest way how to spawn animals. Just insert the module in editor, set the desired parameters and you have animals in your mission. Unfortunately, animals spawned this way can't be controlled via script in any way and will only randomly move around depending on the area you set.

Spawn via createAgent command

Spawning animals via scripting command createAgent is another way how to have animals in your mission. And yes, animals created this way can be controled in some limited way. As the animal AI is controlled by AIAgent, it won't be able to be controlled via commands such as doMove and doStop and will roam randomly around. But you can determine, in which state (like move, stop, etc.) the animal will move.


_dog = createAgent ["Fin_random_F", getPos player, [], 5, "CAN_COLLIDE"];

Spawn via createUnit command

Another way to spawn animal is using createUnit command. This is probably most interesting for you, modders and mission creators. In this mode the AI is handled differently than agent so the animal won't randomly change directions and will face same direction in which it has been spawned. But the cool point is, you can command the animal via doMove and doStop commands, so you will be able to control it in any way you want (creating waypoints, following the player, etc.)

Additionaly the animal can be groupped with player and thus will be able to obey some basic commands like Move via command menu.

Example 1:

_grp = createGroup CIVILIAN;
_dog = _grp createUnit ["Fin_random_F", getPos player, [], 5, "CAN_COLLIDE"];

Example 2:

_dog = group player createUnit ["Fin_random_F", getPos player, [], 5, "CAN_COLLIDE"];


It is very simple. All you need is playMove or switchMove commands and knowledge of available animation states, which override the default animal behaviour (see list of currently available animals). When you will do that, remember, the animal will remain in that state until you won't change it via script. And also keep in mind, that the animal will be affected by FSM if you won't disbale it via BIS_fnc_animalBehaviour_disable variable!

Currently available animals


Available states


_dog playMove "Dog_Stop";


_dog playMove "Dog_Sit";


_dog playMove "Dog_Walk";


_dog playMove "Dog_Run";


_dog playMove "Dog_Sprint";

Back to default behaviour:

_dog playMove "Dog_Idle_Stop";