2015-04-10 20:02:36 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal, KoffeinFlummi
|
|
|
|
* Disables/Enables AI
|
2015-01-16 23:21:47 +00:00
|
|
|
*
|
2015-04-10 20:02:36 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Disable AI <BOOL>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2015-09-18 13:40:51 +00:00
|
|
|
* [bob, true] call ace_common_fnc_disableAI
|
2015-04-10 20:02:36 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
2015-01-16 23:21:47 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-12-12 15:48:54 +00:00
|
|
|
params [["_unit", objNull, [objNull]], ["_disable", true, [false]]];
|
2015-04-10 20:02:36 +00:00
|
|
|
|
2015-09-18 13:40:51 +00:00
|
|
|
if (!local _unit) exitWith {};
|
|
|
|
|
|
|
|
if !([_unit] call EFUNC(common,isPlayer)) then {
|
2015-01-18 19:09:19 +00:00
|
|
|
if (_disable) then {
|
2015-04-10 20:02:36 +00:00
|
|
|
_unit disableAI "MOVE";
|
2015-01-18 19:09:19 +00:00
|
|
|
_unit disableAI "TARGET";
|
2015-04-10 20:02:36 +00:00
|
|
|
_unit disableAI "AUTOTARGET";
|
|
|
|
_unit disableAI "FSM";
|
|
|
|
_unit disableConversation true;
|
2015-01-18 19:09:19 +00:00
|
|
|
} else {
|
2015-04-10 20:02:36 +00:00
|
|
|
//Sanity check to make sure we don't enable unconsious AI
|
2015-09-18 13:40:51 +00:00
|
|
|
if (_unit getVariable ["ace_isunconscious", false] && alive _unit) exitWith {
|
2016-07-25 16:57:38 +00:00
|
|
|
ACE_LOGERROR("Enabling AI for unconsious unit");
|
2015-09-18 13:40:51 +00:00
|
|
|
};
|
|
|
|
|
2015-04-10 20:02:36 +00:00
|
|
|
_unit enableAI "MOVE";
|
2015-01-18 19:09:19 +00:00
|
|
|
_unit enableAI "TARGET";
|
2015-04-10 20:02:36 +00:00
|
|
|
_unit enableAI "AUTOTARGET";
|
|
|
|
_unit enableAI "FSM";
|
|
|
|
_unit disableConversation false;
|
2015-01-18 19:09:19 +00:00
|
|
|
};
|
2015-04-10 20:02:36 +00:00
|
|
|
};
|