ACE3/addons/common/functions/fnc_disableAI.sqf

43 lines
1.0 KiB
Plaintext
Raw Normal View History

#include "..\script_component.hpp"
/*
* 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:
2015-09-18 13:40:51 +00:00
* [bob, true] call ace_common_fnc_disableAI
*
* Public: No
2015-01-16 23:21:47 +00:00
*/
params [["_unit", objNull, [objNull]], ["_disable", true, [false]]];
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 {
_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
2015-09-18 13:40:51 +00:00
if (_unit getVariable ["ace_isunconscious", false] && alive _unit) exitWith {
ERROR("Enabling AI for unconsious unit");
2015-09-18 13:40:51 +00:00
};
_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
};
};