ACE3/addons/medical_ai/XEH_postInit.sqf
BaerMitUmlaut 278e7fa800 Add Medical AI implementation for basic medical (#4311)
* Initial commit medical AI

* Finished non-healing functions

* Initial work on self healin

* AI healing

* Finished medical AI for basic medical

* Finito

* Fix for dead units, medic not being close enough

* Make ace_medical required

* Fixed double systemChat

* Made AI units able to heal players

* Fixed wound treatment

* Fixed medic movement

* Made units heal themselves earlier
2016-09-04 11:25:03 +02:00

32 lines
1.2 KiB
Plaintext

#include "script_component.hpp"
["ace_settingsInitialized", {
// Only run for AI that does not have to deal with advanced medical
if (EGVAR(medical,enableFor) == 1 || {hasInterface && {EGVAR(medical,level) == 2}}) exitWith {};
["ace_firedNonPlayer", {
_unit setVariable [QGVAR(lastFired), CBA_missionTime];
}] call CBA_fnc_addEventHandler;
if (hasInterface) then {
["ace_unconscious", {
params ["_unit", "_unconscious"];
if (!_unconscious || {_unit != ACE_player}) exitWith {};
private _medic = objNull;
{
if ((!isPlayer _x) && {[_x] call EFUNC(medical,isMedic)}) exitWith {
_medic = _x;
};
} forEach (units _unit);
if (isNull _medic) exitWith {};
private _healQueue = _medic getVariable [QGVAR(healQueue), []];
_healQueue pushBack _unit;
_medic setVariable [QGVAR(healQueue), _healQueue];
}] call CBA_fnc_addEventHandler;
};
GVAR(statemachine) = [configFile >> "ACE_Medical_AI_StateMachine"] call CBA_statemachine_fnc_createFromConfig;
}] call CBA_fnc_addEventHandler;