Advertisement
Guest User

Untitled

a guest
Jul 1st, 2016
780
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.64 KB | None | 0 0
  1. // ai medic using ACE3
  2. #include "\z\ace\addons\medical\script_component.hpp"
  3. private ["_needradio", "_medic", "_injured", "_deads"];
  4. _medic = _this select 0;
  5. _units = _this select 1;
  6. _injured = objNull;
  7. _needradio = true;
  8.  
  9. //main loop
  10. while {alive _medic} do {
  11.  
  12. sleep 2;
  13. //waiting for a wounded
  14. while {(isNull _injured) and (alive _medic)} do {
  15. //if the medic is injured
  16. if (_medic getvariable [QGVAR(isBleeding), false]) then {
  17. //if medic is already dead, then exit
  18. if (!alive _medic) exitWith{};
  19. //else he is the injured and he is a priority to heal himself
  20. _injured = _medic;
  21. } else {
  22. _deads = [];
  23. {
  24. if (!alive _x or isNull _x) then {
  25. _deads = _deads + [_x];
  26. };
  27. if ((isNull _injured) and (_x getvariable [QGVAR(isBleeding), false]) and (alive _x) and (!isNull _x)) then {
  28. _injured = _x;
  29. if (_needradio) then {_medic groupChat format["Keep calm %1, I will heal you.", (name _injured)];};
  30. };
  31. } foreach _units;
  32. _units = _units - _deads;
  33. };
  34. sleep 5;
  35. };
  36.  
  37. if(!alive _medic) exitWith{};
  38.  
  39. //we have an injured, stop him
  40. if ((!isPlayer _injured) and (_medic!=_injured)) then {
  41. _injured disableAI "MOVE";
  42. _injured setUnitPos "down";
  43. };
  44. if (_medic != _injured) then {
  45. //medic go for him
  46. _medic doMove (position _injured);
  47. while {(_medic distance _injured > 10) and (alive _injured) and (!isNull _injured)} do {
  48. sleep 1;
  49. _medic doMove (position _injured);
  50. if(!alive _medic) exitWith{_injured enableAI "MOVE"; _injured setUnitPos "auto";};
  51. };
  52. };
  53.  
  54. if(!alive _medic) exitWith{_injured enableAI "MOVE"; _injured setUnitPos "auto";};
  55.  
  56. //when medic is close enough to the injured...
  57. //...and injured is still alive
  58. if ((alive _injured) and (!isNull _injured) and (alive _medic)) then {
  59. //stop the medic
  60. // _medic disableAI "MOVE";
  61. // _medic setUnitPos "middle";
  62. // sleep 1;
  63. //HEAL the injured
  64. // ******************************
  65. _medic allowDamage false;
  66. _medic action ["HealSoldier", _injured];
  67. _medic playMove "AinvPknlMstpSnonWnonDnon_medic_1";
  68. sleep 9;
  69. _injured setVariable [QGVAR(pain), 0, true];
  70. _injured setVariable [QGVAR(morphine), 0, true];
  71. _injured setVariable [QGVAR(bloodVolume), 100, true];
  72. _injured setVariable ["ACE_isUnconscious", false, true];
  73. _injured setvariable [QGVAR(tourniquets), [0,0,0,0,0,0], true];
  74. _injured setvariable [QGVAR(openWounds), [], true];
  75. _injured setvariable [QGVAR(bandagedWounds), [], true];
  76. _injured setVariable [QGVAR(internalWounds), [], true];
  77. _injured setvariable [QGVAR(lastUniqueWoundID), 1, true];
  78. _injured setVariable [QGVAR(heartRate), 80];
  79. _injured setvariable [QGVAR(heartRateAdjustments), []];
  80. _injured setvariable [QGVAR(bloodPressure), [80, 120]];
  81. _injured setVariable [QGVAR(peripheralResistance), 100];
  82. _injured setVariable [QGVAR(fractures), [], true];
  83. _injured setvariable [QGVAR(triageLevel), 0, true];
  84. _injured setvariable [QGVAR(triageCard), [], true];
  85. _injured setVariable [QGVAR(salineIVVolume), 0, true];
  86. _injured setVariable [QGVAR(plasmaIVVolume), 0, true];
  87. _injured setVariable [QGVAR(bloodIVVolume), 0, true];
  88. _injured setvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0], true];
  89. _injured setvariable [QGVAR(airwayStatus), 100];
  90. _injured setVariable [QGVAR(airwayOccluded), false];
  91. _injured setvariable [QGVAR(airwayCollapsed), false];
  92. _injured setvariable [QGVAR(addedToUnitLoop), false, true];
  93. _injured setvariable [QGVAR(inCardiacArrest), false, true];
  94. _injured setvariable [QGVAR(hasLostBlood), 0, true];
  95. _injured setvariable [QGVAR(isBleeding), false, true];
  96. _injured setvariable [QGVAR(hasPain), false, true];
  97. _injured setvariable [QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives), true];
  98. _injured setvariable [QGVAR(painSuppress), 0, true];
  99. _injured setDamage 0;
  100. // ******************************
  101. //wait until injured is healed or dead
  102. waitUntil { !(_injured getvariable [QGVAR(isBleeding), false]) or (!alive _injured) };
  103. sleep 3;
  104. if (_medic != _injured) then {
  105. if (_needradio) then {_medic groupChat format["OK %1, you are ready to fight.", (name _injured)];};
  106. };
  107. _medic allowDamage true;
  108. //healed soldier is ready to fight
  109. _injured enableAI "MOVE";
  110. _injured setUnitPos "auto";
  111. };
  112. //we are ready for looking a new injured
  113. _injured = objNull;
  114. //set the medic to ready to looking for a new injured
  115. // _medic enableAI "MOVE";
  116. // _medic setUnitPos "auto";
  117. //doMove stops the medic, so we have to command him to follow his leader
  118. _medic doFollow (leader group _medic);
  119. if(!alive _medic) exitWith{_injured enableAI "MOVE"; _injured setUnitPos "auto";};
  120. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement