Code:
;*************************************************************************************
;Simple Chopper Extraction Script by Nikiller v0.9b
;Extract a group with a chopper and return to base
;Note: Place a game logic named server on the map
;contact: nikillerofp@hotmail.fr
;[extractedGrpName,pilotGroupName,padName,spawnPosName,baseName] exec "scriptName.sqs"
;*************************************************************************************
if nik_host then {} else {goto "ende"}
_grpe = _this select 0
_grpc = _this select 1
_pad = _this select 2
_pos = _this select 3
_bas = _this select 4
_spawnpos=getPos _pos
_initpilot={this setCaptive true; this setCombatMode "BLUE"; this setBehaviour "CARELESS"; {this disableAI _x} forEach ["TARGET","AUTOTARGET"]}
_sk=1
_ra="CORPORAL"
_pilot="SoldierWPilot"
#spawnpilot
~0.5
_pilot createUnit [_spawnpos,_grpc,_initpilot,_sk,_ra]
if (({alive _x} count (units _grpc))<2) then {goto "spawnpilot"}
#spawnveh
~0.5
_ac="ENGINE ON"
_chop="UH60MG" createVehicle [0,0,0]
_chop setPos [_spawnpos select 0 ,_spawnpos select 1, 1000]
_choppilot=(units _grpc) select 0
_chopgunner=(units _grpc) select 1
_choppilot assignAsDriver _chop
_choppilot moveInDriver _chop
_choppilot action [_ac,_chop]
_chopgunner assignAsGunner _chop
_chopgunner moveInGunner _chop
_chop setVelocity [0,0,0]
_chop flyInHeight 100
~15
_pp=getPos _pad
_dist=200
#movechop
~5
_chop doMove _pp
if ((_chop distance _pad>_dist) && (canMove _chop)) then {goto "movechop"}
if ((canMove _chop)) then {} else {goto "ende"}
~0.5
[_chop] exec "brake.sqs"
_land="GET IN"
_group=units _grpe
~0.5
{_x assignAsCargo _chop} forEach _group
_chop flyInHeight 1
_chop land _land
@ (getPos _chop select 2 < 1.5) || !(canMove _chop)
? !(canMove _chop): goto "ende"
_smoke="smokeShellGreen" createVehicle (getPos _chop)
#getin
~2
_icount = 0
_num=0
"if (alive _x) then {_num=_num+1}" forEach _group
"if (vehicle _x==_chop) then {_icount=_icount+1}" forEach _group
if (_icount==_num) then {} else {goto "getin"}
#movebase
~3
_chop flyInHeight 100
_chop doMove (getPos _bas)
#ende
exit