Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Have the medic do medic things
- // _medicClass needs to match the current class of your medic
- //
- // KP Liberation
- //_medicClass = "rhsusf_army_ocp_medic";
- //
- // Antistasi
- _medicClass = "I_G_medic_F";
- _medic = objNull;
- _injured = objNull;
- _medicPos = objNull;
- _injuredUnits = [];
- {
- if ((typeOf _x == _medicClass) && (alive _x)) exitWith {
- _medic = _x;
- };
- } forEach units group player;
- if(isNull _medic) exitWith { hint "No medic found"; };
- player sideChat format["Found squad medic %1", (name _medic)];
- _medicPos = position _medic;
- {
- if(getDammage _x > 0.1) then {
- _injuredUnits pushBack _x;
- };
- } forEach units group player;
- if (count _injuredUnits == 0) exitWith {_medic sideChat "No injured found"};
- _medic sideChat format["Found %1 injured", (count _injuredUnits)];
- _injuredUnitsClosest = [_injuredUnits, [_medic], { _input0 = objNull; _input0 distance _x}, "ASCEND", {canMove _x}] call BIS_fnc_sortBy;
- {
- _injured = _x;
- if(_medic == _injured) then {
- _medic sideChat "Healing myself";
- _medic action["HealSoldierSelf", _injured];
- waitUntil { (getDammage _injured < 0.1) or (!alive _injured)};
- } else {
- if(!isPlayer _injured) then {
- _injured disableAI "MOVE";
- _injured setUnitPos "down";
- };
- _medic sideChat format["Moving to %1", (name _injured)];
- _medic doMove (position _injured);
- while {(_medic distance _injured > 3) and (canMove _medic) and (alive _injured) and (alive _medic)} do {
- sleep 1;
- _medic doMove (position _injured);
- };
- if(!alive _medic) exitWith {player sideChat format["Medic %1 is down!", (name _medic)]};
- if(alive _injured) then {
- _medic sideChat format["Healing %1", (name _injured)];
- _medic disableAI "MOVE";
- _medic setUnitPos "middle";
- _medic action ["HealSoldier", _injured];
- waitUntil { (getDammage _injured < 0.1) or (!alive _injured)};
- sleep 1;
- _medic sideChat format["OK %1, you are good to go", (name _injured)];
- if(!isPlayer _injured) then {
- _injured enableAI "MOVE";
- _injured setUnitPos "auto";
- };
- _medic enableAI "MOVE";
- _medic setUnitPos "auto";
- } else {
- _medic sideChat format["We lost %1!", (name _injured)];
- };
- };
- } forEach _injuredUnitsClosest;
- _medic sideChat "All good now";
- _medic doMove _medicPos;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement