Advertisement
Guest User

Untitled

a guest
Feb 17th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. _assignedTargets = [];
  2. {
  3. _gp = _x;
  4. {
  5. _u = _x;
  6. if (!isPLayer _u) then {
  7. if (isNull assignedTarget _u) then {
  8. if (currentWeapon _u == secondaryWeapon _u) then {
  9. _u doTarget objNull;
  10. _u lookAt objNull;
  11. _u disableAI "AUTOTARGET";
  12. _ammo = (getText (configfile >> "CfgMagazines" >> currentMagazine _u >> "ammo"));
  13. _aiAmmoUsageFlags = getText (configfile >> "CfgAmmo" >> _ammo >> "aiAmmoUsageFlags");
  14. if (_aiAmmousageFlags == "") then {
  15. _aiAmmoUsageFlags = str (getNumber (configfile >> "CfgAmmo" >> _ammo >> "aiAmmoUsageFlags"));
  16. };
  17. _targetTypes = if (["256",_aiAmmoUsageFlags] call BIS_fnc_instring) then {["AIR"]} else {["CAR","TANK"]};
  18.  
  19. _nearTargets = [(side _u),viewDistance,"ENEMY",position _x,_targetTypes] call MCSS_fnc_NearEntities;
  20. if (count _nearTargets > 0) then {
  21. {
  22. _target = _x;
  23. if (!(_target in _assignedTargets)) exitWith {
  24. _assignedTargets pushBackUnique _target;
  25.  
  26. if (canMove _target) then {
  27. _u doTarget _target;
  28. _u doFire _target
  29. } else {
  30. _u doTarget objNull;
  31. _u lookAt objNull;
  32. };
  33. };
  34. } foreach _nearTargets;
  35. } else {
  36. if !(_u getVariable ["MCSS_C2_ROE",false]) then {
  37. _u enableAI "AUTOTARGET";
  38. };
  39. };
  40. } else {
  41. if !(_x getVariable ["MCSS_C2_ROE",false]) then {
  42. _x enableAI "AUTOTARGET";
  43. };
  44. };
  45. } else {
  46. if ((canMove assignedTarget _u) OR (getDammage (assignedTarget _u) < 0.9)) then {
  47. _u doTarget objNull;
  48. _u lookAt objNull;
  49. };
  50. };
  51. };
  52. } foreach (units _gp);
  53. } foreach (([] call MCSS_C2_HCALLGROUPS) + [group player]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement