Guest
Hi,
i want to prevent AI from using waypoints 'n stuff, due to Performance reasons. So i came up with this:
private ["_unitGroup","_cache","_counter","_i","_unit"]
_unitGroup = _this select 0;
_cache = _this select 1;
fnc_freeze {
if (_cache) then {
diag_log format ["Freezing %1 Units",(count _unitGroup)];
_i = 0;
{
_unit = _unitGroup select _i;
_unit disableAI "TARGET";
_unit disableAI "AUTOTARGET";
_unit disableAI "MOVE";
_unit disableAI "ANIM";
_unit disableAI "FSM";
_i = _i + 1;
} foreach _unitGroup;
} else {
diag_log format ["UnFreezing %1 Units",(count _unitGroup)];
_i = 0;
{
_unit = _unitGroup select _i;
_unit enableAI "TARGET";
_unit enableAI "AUTOTARGET";
_unit enableAI "MOVE";
_unit enableAI "ANIM";
_unit enableAI "FSM";
_i = _i + 1;
} foreach _unitGroup;
};
};
while {true} do {
_counter = _unitGroup nearEntities ["CAManBase",1250];
if (_counter != 0) then {[] spawn fnc_freeze;};
sleep 15;
};
Apparently there's something wrong with the counter. I can't see, what?

