Fandom

武装突袭 Wiki

Arma 3 Animals: Override Default Animal Behaviour Via Script

简体 | 繁體

4,827个页面创建
于此维基上
添加新页面
评论0 Share

您使用了广告屏蔽软件!


Wikia通过广告运营为用户提供免费的服务。我们对用户通过嵌入广告屏蔽软件访问网站进行了使用调整。

如果您使用了广告屏蔽软件,将无法使用我们的服务。请您移除广告屏蔽软件,以确保页面正常加载。


Please note, this feature works only in Development Build 1.55.133793 and later!

Introduction 编辑

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.

Basics 编辑

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! 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 agents can be controlled via moveTo command. And you can also determine, in which state (like run, sprint, etc.) the animal will move.

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

Spawn via createUnit command 编辑

WARNING: If you will group animal created this way with another unit such as soldier, the animal will also be able to communicate via radio messages (eg. "Cease fire" etc.). Do not use unless you know, what you are doing!

Another way to spawn animal is using createUnit command. 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. You can command the animal via doMove and doStop commands, so you will be able to control it in its movement, but still, be aware of the warning above. Best way to spawn script controllable animals is createAgent command.

Example:

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

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

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

Usage 编辑

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 change it via script. And also keep in mind, that the animal agent (spawned via createAgent command) will be affected by FSM if you won't disbale it via BIS_fnc_animalBehaviour_disable variable!

Example mission for dog 编辑

You can try following mission, just simply download ZIP archive with mission here. All dog actions are controllable via action menu. See this video captured from this example mission.

Example script for dog following player 编辑

// Spawn dog
_dog = createAgent ["Fin_random_F", getPos player, [], 5, "CAN_COLLIDE"];
 
// Disable animal behaviour
_dog setVariable ["BIS_fnc_animalBehaviour_disable", true];
 
// Following loop
0 = [_dog] spawn {
	params ["_dog"];
 
	// Force dog to sprint
	_dog playMove "Dog_Sprint";
 
	while {alive _dog} do 
	{
		_dog moveTo getPos player;
 
		sleep 0.5;
	};
};

Currently available animals 编辑

Dog 编辑

Stop:
_dog playMove "Dog_Stop";
Sit:
_dog playMove "Dog_Sit";
Walk:
_dog playMove "Dog_Walk";
Run:
_dog playMove "Dog_Run";
Sprint:
_dog playMove "Dog_Sprint";
Back to default behaviour:
_dog playMove "Dog_Idle_Stop";

Sheep 编辑

Stop:
_sheep playMove "Sheep_Stop";
Walk:
_sheep playMove "Sheep_Walk";
Run:
_sheep playMove "Sheep_Run";
Back to default behaviour:
_sheep playMove "Sheep_Idle_Stop";

Goat 编辑

Stop:
_goat playMove "Goat_Stop";
Walk:
_goat playMove "Goat_Walk";
Run:
_goat playMove "Goat_Run";
Back to default behaviour:
_goat playMove "Goat_Idle_Stop";

Rabbit 编辑

Stop:
_rabbit playMove "Rabbit_Stop";
Hop:
_rabbit playMove "Rabbit_Hop";
Back to default behaviour:
_rabbit playMove "Rabbit_Idle_Stop";

Cockerel 编辑

Stop:
_cock playMove "Cock_Stop";
Walk:
_cock playMove "Cock_Walk";
Run:
_cock playMove "Cock_Run";
Back to default behaviour:
_cock playMove "Cock_Idle_Stop";

Hen 编辑

Stop:
_hen playMove "Hen_Stop";
Walk:
_hen playMove "Hen_Walk";
Back to default behaviour:
_hen playMove "Hen_Idle_Stop";

Snake 编辑

Stop:
_snake playMove "Snakes_Stop";
Move:
_snake playMove "Snakes_Move";
Back to default behaviour:
_snake playMove "Snakes_Idle_Stop";

更多维基

随机维基