Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1.  
  2. private ["_nearAI", "_revealAmount", "_sideUnit", "_nearAISingle", "_sideAI", "_sideUnits", "_inContact", "_enemyInContact"];
  3.  
  4. sleep 5; //wait for init
  5.  
  6. waitUntil
  7. {
  8. if ((player getVariable "acre_sys_core_isSpeaking") == 1) then
  9. {
  10. _nearAI = nearestObjects [player, ["Man"], 20];
  11. _nearAI = _nearAI - [playableUnits];
  12.  
  13. {
  14. if ((alive _x) && (_x knowsAbout player < 1.0) && !(_x knowsAbout player >= 4.0)) then
  15. {
  16.  
  17. _nearAISingle = _x;
  18. _sideAI = side _nearAISingle;
  19. _sideUnits = [];
  20. _inContact = false;
  21.  
  22. //AI hears talking
  23. _revealAmount = 1.0;
  24.  
  25. //Command and control checks
  26. if ( ([weapons _nearAISingle, "ACRE_PRC117F"] call acre_api_fnc_hasKindOfRadio) || ([weapons _nearAISingle, "ACRE_PRC119"] call acre_api_fnc_hasKindOfRadio) || ([weapons _nearAISingle, "ACRE_PRC148"] call acre_api_fnc_hasKindOfRadio) || ([weapons _nearAISingle, "ACRE_PRC152"] call acre_api_fnc_hasKindOfRadio) ) then {
  27. _revealAmount = _revealAmount + 1.0;
  28. //AI has a radio
  29. {
  30. if ((side _x == _sideAI) && !(isplayer _x)) then {
  31. _sideUnits = _sideUnits + [_x];
  32. };
  33. }
  34. foreach allunits;
  35.  
  36. {
  37. _sideUnit = _x;
  38. {
  39. if ((_sideUnit knowsAbout _x > 2) && (([weapons _sideUnit, "ACRE_PRC117F"] call acre_api_fnc_hasKindOfRadio) || ([weapons _sideUnit, "ACRE_PRC119"] call acre_api_fnc_hasKindOfRadio) || ([weapons _sideUnit, "ACRE_PRC148"] call acre_api_fnc_hasKindOfRadio) || ([weapons _sideUnit, "ACRE_PRC152"] call acre_api_fnc_hasKindOfRadio))) exitWith {
  40. _inContact = true;
  41. _revealAmount = _revealAmount + 1.0;
  42. //AI has radio link to other troops in contact
  43. };
  44.  
  45. }
  46. foreach playableunits;
  47. }
  48. foreach _sideUnits;
  49.  
  50.  
  51. };
  52.  
  53. if (!isNull ((leader (group _nearAISingle)) findNearestEnemy (getPos leader (group _nearAISingle)))) then {
  54.  
  55. _enemyInContact = (leader (group _nearAISingle)) findNearestEnemy (getPos leader (group _nearAISingle));
  56.  
  57. if (_enemyInContact distance _nearAISingle < 2000) then {
  58. _revealAmount = _revealAmount + 1.0;
  59. //AI is already in contact with enemy
  60. };
  61. };
  62.  
  63. //player sideChat format["%1 hears you, for %2", _x, _revealAmount];
  64. [0, {(_this select 0) reveal (_this select 1);}, [_nearAISingle, [player, _revealAmount]]] call CBA_fnc_globalExecute;
  65. };
  66. } forEach _nearAI;
  67. };
  68.  
  69. sleep 0.25;
  70.  
  71. false
  72. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement