Jump to content
Sign in to follow this  
spartanhoplite

Evacuation

Recommended Posts

Hi,

I was wondering that can a helicopter evacuate a remaining of a squad.

If so, how can I do it?

Thanks for your patience

Share this post


Link to post
Share on other sites

It is possible with scripting, but OFP helicopter AI is notoriously troublesome. Under exactly what conditions do you want the helicopter to arrive, to land, to leave, etc? Is the evacuated squad player or AI controlled? Is the mission SP or MP?

Share this post


Link to post
Share on other sites
It is possible with scripting, but OFP helicopter AI is notoriously troublesome. Under exactly what conditions do you want the helicopter to arrive, to land, to leave, etc? Is the evacuated squad player or AI controlled? Is the mission SP or MP?

I want it to:

1) Arrive

2) Land

3) And return to base

I am one of the squad and the rest are AI.

It is in the Mission Editor so SP

Share this post


Link to post
Share on other sites

hi,

I want it to:

1) Arrive

2) Land

3) And return to base

I am one of the squad and the rest are AI.

It is in the Mission Editor so SP

Here it is. I wrote a simple chopper extraction script MP/SP compatible. Chopper lands, wait that every alive soldiers get in and return to base.

init.sqs

;********************************
;init Script by Nikiller v0.9b
;contact: nikillerofp@hotm{ail.fr
;[] exec "scriptName.sqs}"
;********************************

nik_host=local server

;-----------------------------------------------------------------------------------------
; Chopper extraction
;-----------------------------------------------------------------------------------------
[WestGrp1,WestPilotGrp1,gl_pad1,gl_base1,gl_base1] exec "chopper_extraction.sqs"

exit

extraction_chopper.sqs

;*************************************************************************************
;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

I also wrote a smooth brake script to help the chopper to land without braking and turning like mad.

brake.sqs

if nik_host then {} else {goto "ende"}

_u = _this select 0

_i = 0

#loop
_speed=speed _u
? _speed<90: goto "ende"
_factor=((_speed-10)/_speed)
_velocity=velocity _u
_u setVelocity [(_velocity select 0)*_factor,(_velocity select 1)*_factor,(_velocity select 2)*_factor]
~0.1
_i=_i+0.1
? _i<3:goto "loop"

#ende

exit

Here's a demo to show how it works: DEMO LINK

cya.

Nikiller.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×