Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _assignedTargets = [];
- {
- _gp = _x;
- {
- _u = _x;
- if (!isPLayer _u) then {
- if (isNull assignedTarget _u) then {
- if (currentWeapon _u == secondaryWeapon _u) then {
- _u doTarget objNull;
- _u lookAt objNull;
- _u disableAI "AUTOTARGET";
- _ammo = (getText (configfile >> "CfgMagazines" >> currentMagazine _u >> "ammo"));
- _aiAmmoUsageFlags = getText (configfile >> "CfgAmmo" >> _ammo >> "aiAmmoUsageFlags");
- if (_aiAmmousageFlags == "") then {
- _aiAmmoUsageFlags = str (getNumber (configfile >> "CfgAmmo" >> _ammo >> "aiAmmoUsageFlags"));
- };
- _targetTypes = if (["256",_aiAmmoUsageFlags] call BIS_fnc_instring) then {["AIR"]} else {["CAR","TANK"]};
- _nearTargets = [(side _u),viewDistance,"ENEMY",position _x,_targetTypes] call MCSS_fnc_NearEntities;
- if (count _nearTargets > 0) then {
- {
- _target = _x;
- if (!(_target in _assignedTargets)) exitWith {
- _assignedTargets pushBackUnique _target;
- if (canMove _target) then {
- _u doTarget _target;
- _u doFire _target
- } else {
- _u doTarget objNull;
- _u lookAt objNull;
- };
- };
- } foreach _nearTargets;
- } else {
- if !(_u getVariable ["MCSS_C2_ROE",false]) then {
- _u enableAI "AUTOTARGET";
- };
- };
- } else {
- if !(_x getVariable ["MCSS_C2_ROE",false]) then {
- _x enableAI "AUTOTARGET";
- };
- };
- } else {
- if ((canMove assignedTarget _u) OR (getDammage (assignedTarget _u) < 0.9)) then {
- _u doTarget objNull;
- _u lookAt objNull;
- };
- };
- };
- } foreach (units _gp);
- } foreach (([] call MCSS_C2_HCALLGROUPS) + [group player]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement