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:
|
|
|
|
* [bob, true] call ace_common_fnc_disableAI;
|
|
|
|
*
|
|
|
|
* Public: No
|
2015-01-16 23:21:47 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-04-10 20:02:36 +00:00
|
|
|
PARAMS_2(_unit,_disable);
|
|
|
|
|
|
|
|
if ((local _unit) && {!([_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
|
|
|
|
if (_unit getVariable ["ace_isunconscious", false]) exitWith {ERROR("Enabling AI for unconsious unit");};
|
|
|
|
_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
|
|
|
};
|