Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1.  
  2. /*
  3. Author: Freddo
  4.  
  5. Description:
  6. Makes medic move to a soldier and heal him.
  7.  
  8. Parameter(s):
  9. 0: OBJECT - Medic
  10. 1: OBJECT - Injured unit
  11.  
  12. Returns:
  13. NOTHING
  14. */
  15.  
  16. scopeName "main";
  17.  
  18. params ["_medic","_unit"];
  19. if (not ("Medikit" in items _medic) || not (isNull objectParent _unit) || _medic distance2D _unit > 50) exitWith {};
  20.  
  21. if (VCM_DEBUG) then {systemChat format ["%1 attempting to heal %2", _medic, _unit];};
  22.  
  23. _medic setVariable ["VCM_UNIT_HEALING", 1, false];
  24.  
  25. while {not (isNull _unit) && alive _unit && damage _unit != 0 && isNull objectParent _unit && not (isNull _medic) && alive _medic && _medic distance2D _unit > 2} do
  26. {
  27. _medic doMove getPos _unit;
  28. sleep 5;
  29. };
  30.  
  31. doStop _unit;
  32.  
  33. _medic action ["HealSoldier", _unit];
  34.  
  35. sleep 5;
  36.  
  37. //Rerun script if medic didn't manage to heal
  38. if (damage _unit != 0) then {breakTo "main"};
  39.  
  40. _unit doFollow leader _unit;
  41. _medic doFollow leader _medic;
  42.  
  43. _medic setVariable ["VCM_UNIT_HEALING", 0, false];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement