ACE3/addons/common/functions/fnc_disableAI.sqf

38 lines
951 B
Plaintext
Raw Normal View History

/*
* Author: Glowbal, KoffeinFlummi
* Disables/Enables AI
2015-01-16 23:21:47 +00:00
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Disable AI <BOOL>
*
* Return Value:
* None
*
* Example:
* [bob, true] call ace_common_fnc_disableAI;
*
* Public: No
2015-01-16 23:21:47 +00:00
*/
#include "script_component.hpp"
PARAMS_2(_unit,_disable);
if ((local _unit) && {!([_unit] call EFUNC(common,isPlayer))}) then {
2015-01-18 19:09:19 +00:00
if (_disable) then {
_unit disableAI "MOVE";
2015-01-18 19:09:19 +00:00
_unit disableAI "TARGET";
_unit disableAI "AUTOTARGET";
_unit disableAI "FSM";
_unit disableConversation true;
2015-01-18 19:09:19 +00:00
} else {
//Sanity check to make sure we don't enable unconsious AI
if (_unit getVariable ["ace_isunconscious", false] && alive _unit) exitWith {ERROR("Enabling AI for unconsious unit");};
_unit enableAI "MOVE";
2015-01-18 19:09:19 +00:00
_unit enableAI "TARGET";
_unit enableAI "AUTOTARGET";
_unit enableAI "FSM";
_unit disableConversation false;
2015-01-18 19:09:19 +00:00
};
};