Not tested...but give this a shot. Add the lines in RED. You might want to change the damage values.
This will halt execution of whatever script is running (this script) until the pilot is healed! That may not have desirable effects depending on what's next in the script.
Code:
_grp1 = createGroup tfor_friendly_side;
_pilot = _grp1 createUnit [tfor_rescuepilot_pilottype, _pos, [], 0, "FORM"];
_pilot setRank "CAPTAIN";
_pilot setCaptive true;
_pilot allowFleeing 0;
_pilot setDamage 0.6;
waituntil {damage _pilot <= 0.1};
_pilot setVehicleInit "this addAction ['Rescue','scripts\capture.sqf'];";
processInitCommands;
EDIT: If that's the case.... do it this way....
Code:
_grp1 = createGroup tfor_friendly_side;
_pilot = _grp1 createUnit [tfor_rescuepilot_pilottype, _pos, [], 0, "FORM"];
_pilot setRank "CAPTAIN";
_pilot setCaptive true;
_pilot allowFleeing 0;
_pilot setDamage 0.6;
nul = [_pilot] spawn {
private ["_pilot"];
_pilot = _this select 0;
waituntil {sleep 1;damage _pilot <= 0.1};
_pilot setVehicleInit "this addAction ['Rescue','scripts\capture.sqf'];";
processInitCommands;
};
//...script carries on here
//...blah...blah...blah