Jump to content
Sign in to follow this  
Factor

Helo extraction

Recommended Posts

hello, whats the procedure in scripting a helo extraction at the end of missions. ive learning this editor from scratch and apprciate any feedback.

looked on the wiki about triggers. but it didnt explain much.

Share this post


Link to post
Share on other sites

bump, please help, im at the end of making my first mission and this is all that is keeping me from completing it. i tried several things that was in a ofp editing guide i found online, but i cant get it to work.

i want a blackhawk helo to come pick up my squad and i after i radio for it at a degsignated LZ.

PLEASE HELP, this has me getting very frustrated.

Share this post


Link to post
Share on other sites

If i get you right you like to call a Chopper with the Radio? Right?

use this Script:

land_chopper.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?!(local server) : exit

; force a chopper to land v1.3

; changes:

; 1.4 - removed the double check to ensure the waypoint is not activated. was causing issues.

; 1.3 - added the variables var_getout, var_unload and var_eject which will make the units

; in the chopper either getout (all units), unload (all units bar driver and gunner) or

; eject (all units bail out at one second intervals, gunner and driver last)

; 1.2 - script can be cancelled at any time by setting 'var_cancel_landing' equal to the chopper

; 1.2 - the 'fly out height' can be set via the variable '_flyouthgt'

; 1.1 - added the velocity check to ensure the chopper has slowed before touching down

; 1.1 - added the check for Ch47D so the bigger chopper lands well

; by snYpir

; can be called with:

; [unit to land,position where it is to land (should be a waypoint)] exec "land_chopper.sqs"

; to cancel a landing:

; set 'var_cancel_landing = choppername' in the on-activation field of the waypoint previously passed

; into this script

; to force all to disembark from the chopper

; set 'var_getout = choppername' in the on-activation field of the waypoint previously passed

; into this script

; to force cargo units to disembark from the chopper

; set 'var_unload = choppername' in the on-activation field of the waypoint previously passed

; into this script

; to force all to eject from the chopper

; set 'var_eject = choppername' in the on-activation field of the waypoint previously passed

; into this script or anywhere for that matter

; this is the unit we want to force to land

_unit = _this select 0

; this is a position where the chopper will land (expected to be the chopper's waypoint)

_landingpos = _this select 1

; this is the distance away from _landingpos to make the chopper drop to earth

; needs to be big for larger, less manouverable choppers (40 for chinooks)

; 30 is good for blackhawks and 20 is good for hueys. Default is 30

_mindis = 20

; this is the height the chopper will hover once 'landed' (minimum is 2). If you increase this value,

; the chopper will hover off the ground

_minheight = 2

; this is the maximum speed that the chopper will touch down at. it will not touch down until it is

; going slower than this speed. increase for flare landings (to around 25). careful, some choppers (such

; as blackhawks) don't do flare landings very well. The default for this value is 15.

_landvel = 10

; this is the 'fly out height' if the landing is cancelled

_flyouthgt = 30

; this check can be taken out if you wish. it simply increases the landing distance and slows the

; landing speed for chinooks. you could add other 'big' helicopter types if you wish

? "Ch47D" counttype [_unit] == 1 : _mindis = _mindis * 2; _landvel = _landvel / 2

; ----------- edit beyond here at own risk ------------

; get initial height of chopper

_hgt = getpos _unit select 2

_driver = driver _unit

;_gunner = gunner _unit

;_grp = group _driver

_grp1 = {alive _x} count units grp1

_grp2 = {alive _x} count units grp2

_toboard = _grp3 + _grp4

_driver lockwp true

_getout = false

_eject = false

_cancel = false

_unload = false

_load = false

? _minheight < 2 : _minheight = 2

; get distance chopper to landing pos at start

_x1 = _landingpos select 0

_y1 = _landingpos select 1

_x2 = getPos _unit select 0

_y2 = getPos _unit select 1

_dis = sqrt( (_x1-_x2)^2 + (_y1-_y2)^2 )

; determine ratio

_ratio = _dis / _hgt

#loop

_x1 = _landingpos select 0

_y1 = _landingpos select 1

_x2 = getPos _unit select 0

_y2 = getPos _unit select 1

_dis = sqrt( (_x1-_x2)^2 + (_y1-_y2)^2 )

_unit flyinheight (_dis / _ratio)

~0.1

? _dis < _mindis : goto "end"

? var_cancel_landing == _unit : _cancel = true; var_cancel_landing = nil; goto "end2"

? var_eject == _unit : _eject = true; var_eject = nil; goto "end2"

? var_getout == _unit : _getout = true; var_getout = nil

? var_unload == _unit : _unload = true; var_unload = nil

? var_load == _unit : _load = true; var_load = nil

? !alive _driver : exit

; has the unit slowed (maybe missed the waypoint?) drop the unit where it is

_x = ((velocity _unit select 0) * sin (getdir _unit)) * 3.445

_y = ((velocity _unit select 1) * cos (getdir _unit)) * 3.445

? (_x + _y) < 20 : goto "end"

goto "loop"

#end

; drop the chopper close to the ground

_unit flyinheight _minheight * 2

; pause until the chopper has almost stopped

#velloop

~0.1

? var_cancel_landing == _unit : _cancel = true; var_cancel_landing = nil; goto "end2"

? var_eject == _unit : _eject = true; var_eject = nil; goto "end2"

? var_getout == _unit : _getout = true; var_getout = nil

? var_unload == _unit : _unload = true; var_unload = nil

? var_load == _unit : _load = true; var_load = nil

_dir = getdir _unit

_x = ((velocity _unit select 0) * sin _dir) * 3.445

_y = ((velocity _unit select 1) * cos _dir) * 3.445

_xy = _x + _y

? _xy > _landvel : goto "velloop"

; put the chopper on the ground

_unit flyinheight _minheight

#endloop

? var_cancel_landing == _unit : _cancel = true; var_cancel_landing = nil; goto "end2"

? var_eject == _unit : _eject = true; var_eject = nil; goto "end2"

? var_getout == _unit && !_getout : _getout = true; var_getout = nil; goto "end2"

? _getout : goto "end2"

? var_unload == _unit && !_unload : _unload = true; var_unload = nil; goto "end2"

? _unload : goto "end2"

? var_load == _unit && !_load : _load = true; var_load = nil; goto "end2"

? _load : goto "end2";

? !(alive _driver) : exit

~0.1

goto "endloop"

#end2

; added in 1.3 - force all of the occupants of _unit to get out?

? _cancel : goto "nogetout"

? _eject : goto "ejectnow"

; wait until the chopper is on the ground?

@getpos _unit select 2 < 2

; get units out of chopper

#ejectnow

_ejectpause = 1

;? _eject : _ejectpause = 1

; eject units or board units

_i = 0

#for1

; make the chopper wait until the whole squad is in

~0.5

? !(alive _unit) : exit

_temparray1 = units grp1

_temparray2 = units grp2

_playerArr = _temparray1 + _temparray2

_num = (count _temparray1) + (count _temparray2)

_inchopper = count units _unit

;only seen by host

cuttext [format ["Inside: %1 - To board: %2", _inchopper, _num], "Plain", 2];

_incount = 0

_tmp = 0

#for2

? vehicle (_playerArr select _tmp) == _unit : _incount = _incount + 1

? _tmp < (_num - 1) : _tmp = _tmp + 1; goto "for2"

? _incount != _num : goto "for1"

#for2

? vehicle (_playerArr select _tmp) == _chopper : _incount = _incount + 1

? _tmp < (_num - 1) : _tmp = _tmp + 1; goto "for2"

? _incount != _num : goto "for1"

#nogetout

; make sure the message gets through and the waypoint is unlocked

_pos = getpos _driver

#stupidailoop

_unit flyinheight _flyouthgt

_driver lockwp false

~0.5

exit

Okay!

First in your init.sqs write this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">publicVariable ""extraction""

Than create a folder in your Mission folder called: Scripts put the

land_chopper.sqs in there.

Create a empty Chopper ( Name Chopper )

In the Init of the Chopper = this setcaptive true

Create a Pilot ( Name Pilot )

In the Init of the Pilot = this setcaptive true

Create a Trigger:

Activatet = None

Condition = extraction

On Active = Pilot moveindriver Chopper; hint "Chopper on the way"

Give the Pilot 3 Waypoint's the the 2. Waypoint is the Point, where the Chopper should land and the 3. or 4. is the way the Chopper should fly after you get into the Chopper.

In the 2. Waypoint write this:

Description: wp3

On Condition: true

On Activate: var_load = Chopper; PublicVariable "var_load";

Okay now create a Trigger on the way the Chopper is flying shortly bevore the 2. Waypoint is reached.

On Condition: This

On Activate: [Chopper,wp3] exec "Scripts\land_chopper.sqs";

And connect the Trigger with the Chopper with the GROUPS button.

Okay now the trigger call's the Chopper when you activated it.

Activated by: West ( or Alpha for Radio )

On Condition: this

On Activation: extraction = true; publicVariable "extraction";

Well this should work. wink_o.gif

I just hope i did not forget something...

Greeting's SNK

Share this post


Link to post
Share on other sites

thats way too much info for me to comprehend. ive only messed with this editor for about a week. i need to know what kind of trigger to make, what to type into the activation and condition fields for both chopper and  the trigger, and possibly the unit.

if someone could help me with explaining, "in steps", on how to do this, i would be very grateful.

by the way, in the above post, do i have to make some sort of file to put in my script folder in my ARMA folder. i downloaded the kronzkys urban script so the enemy would patrol a given town, but it was allready made. if so, then how do i make this.....

thanks for any help from a confused and getting frustrated new mission editor.

Share this post


Link to post
Share on other sites

The missions you save are in My Documents\arma\missions\mission name

Say for example when you saved your mission you called it extraction. The path would be My Documents\arma\missions\extraction.Sara

It is in this folder that you would want to create the script files\folders for your mission as per the previous post.

Create your scripts folder eg. My Documents\arma\missions\extraction.Sara\scripts

Startup notepad and copy paste the code sample. Click on file save and navigate to you extraction.sara\scripts folder in My Documents. At the bottom of the save dialog box you will see Save as Type: text documents. Click on the drop down list and select All Files. Click on the file name: field and type land_chopper.sqs

Click save.

Click on File New to start a new text document and copy past the one line of code for init.sqs

Save as above except save the file in the mission folder, not the mission\scripts folder.

eg. My Documents\arma\missions\extraction.Sara\init.sqs

Finish editing the mission as per SNKMAN's post and all should work well.

Share this post


Link to post
Share on other sites

Okay here's the easy way: smile_o.gif

Create a trigger:

Activated by Alpha

Trigger Radius ca. 30 - 50

On Condition: this and alive UH60;

On Activate: UH60 doMove getPos p1; UH60 land "land"; UH60 SideChat "(UH60) Rodger! On the way to Extraction Point.";

Connect the Chopper with the Trigger.

Now Create the Trigger, where the Chopper should fly to to end the mission:

Activated by Bravo

Trigger Radius ca. 30 - 50

Name: End

Text: End

On Condition: this and alive UH60;

On Activate: UH60 doMove getPos End; UH60 land "land"; UH60 SideChat "(UH60) Okay let's get out here!";

Now you can call the Chopper to your position with Alpha and order him to fly to the place, where you like to End the Mission with Bravo.

Share this post


Link to post
Share on other sites

ok, ill try this out later tonite, i found the SP/MP support pack by snypir by doing a google search, is this compatable with ARMA, i sure it would  be.

i started out just wanting to make a single mission using the Kronzky's urban patrol script because i was so dissapointed in the game. now, i want to make a full campaign. i think ive caught the editing bug.

agian, thanks for all the help.

Share this post


Link to post
Share on other sites

okay, ive created a trigger, activated by alpha, i put the UH60 in the trigger circle and typed in the condition and activation codes.

now, do i connect the chopper to the trigger using the groups tool, because when i do, the activation box switchs from radio alpha, to vehicle. it want give me the option to go to alpha. so therefore there is no alpha button.

i created the end trigger as mentioned above, activated by bravo.

so, when i preview, since there is no alpha button on the radio, the chopper takes off when the mission starts and flys to my location and just hovers, (about 100 meters past me). i can switch the bravo channel, and the chopper flys to the end trigger, but, still cannot land.

what am i doing wrong. thanks alot for your time.

just to add, if i dont connect any thing with the group tool, then the chopper comes to me after calling alpha, but still does not land.

Share this post


Link to post
Share on other sites

Ok, I'm only a week old as far as scripting is concerned, but this worked for me so far, with only 2 simple triggers and no waypoint needed or invisible H. Quite flexible. From memory :

note :

"player" is whatever you name your player

"chopper1" is your helicopter - name accordingly

Create a trigger 1 : landing (set to radio alpha, repeatedly)

condition : alive (chopper1) and not (player in chopper1)

on act : chopper1 domove getpos player ; chopper1 land "land" ; chopper1 flyinheight 0 ;

Note1 : The chopper will come and get you whenever and wherever you need it, as many times as you want it. No waypoint needed. In put the flyinheight 0 so that it stays on the ground all the time, otherwise it does a "touch and go"...

Create trigger 2 : take-off (activation set to none - but I don't think it matters - and repeateldy)

condition : player in chopper1

on act : chopper flyinheight 50 ;

Note2 : Once you are in the chopper, it will take off and climb to 50m automatically. Add other conditions if you have more men to board before takeoff. Then you can add a Domove action to get anywhere.

Question : Does anyone know why the chopper lands and take off immediately when ordering to land ? Even if I'm assigned to the chopper as cargo ? I found a workaround but still...

Share this post


Link to post
Share on other sites
Quote[/b] ]Question : Does anyone know why the chopper lands and take off immediately when ordering to land ? Even if I'm assigned to the chopper as cargo ? I found a workaround but still...

Well i have no clue about that but this is happening to me too.

B.t.w. the same thing was in OFP too...

Sometimes i have to call the copper to land 3 - 4 times till he finally stands still on the ground.

You can play around with "setBehaviour "Save", setBehaviour "Combat" in the init of the Chopper maybee it will slowe the problem just a little bit.

Share this post


Link to post
Share on other sites

ok, ive got it. finally. but i had to do it with three triggers, because the chopper was not landing at my position. so i made trigger2 (radio bravo),  to flyinheight 0, so it landed at my positon. to take off i radio charlie to go back to base. now, i have one more question. the trigger where i call in bravo is when he is hovering over me. when i push bravo he lands. so, instead, is there a way and whats the proper way to make trigger two, which is bravo radio now, be trigged when i pop smoke.

i think that would be more relistic. when the chopper is hovering over the player, pop smoke, chopper lands!!!

any ideas

thanks for all the help guys.

matt@actionsportsinc.com

Share this post


Link to post
Share on other sites

you rock man! thanks abunch for all the help. i promise to make some killer missions in the future. lol.  

anyway i edited my above post. i got it working right before i checked back here.  any ideas on the smoke.

thanks again buddy notworthy.gif

Share this post


Link to post
Share on other sites

Hey Factor,

Your welcome. wink_o.gif

Well about this Smoke thing... I was thinking about that too but the only way to do this well is to create a Script.

I saw something like that in a Mission but i don't know how to separate the Script becouse there are way to much Script's used.

Here's the mission "by Jander" take a look at it it's really impressive: Dynamic_Transportation_Demo

Share this post


Link to post
Share on other sites

EricM, always use invisible H's, that should solve your problem, and I don't get your reluctance to use them in the first place. FlyInHeight is not suitible to use unless the aircraft is already on the ground (in which case it's useful for keeping them there), because it forces the AI to drop their altitude regardless of their position and velocity (and their safety) and they could hit the ground (or an obstacle) while moving or too fast, resulting in a crash (or damage).

I've found the best way to do things is to keep it simple, and to avoid scripts where triggers will suffice.

Here's an example using the players group (called grp1).

Trigger1:

Activation: Radio Alpha

Condition: this

On Activation: LZ = "HeliHEmpty" createvehicle (getpos leader grp1); heli domove (getpos LZ)

Trigger2:

Condition: heli distance LZ < 100

On Activation: dostop heli; heli land "GET IN"

Assuming there is a marker called "base" somewhere:

Trigger3:

Condition: {_X in crew heli} count (units grp1) >= {alive _X} count (units grp1)

On Activation: heli domove (getmarkerpos "base")

Of course you can make it more complex, but then you should really use scripts.

Share this post


Link to post
Share on other sites

It's not that I don't want to use invisible H, it's just that most of the time I don't need it. It works without it, so why bother ?

But I like the idea to create the invisible H dynamicaly, whenever and wherever you need it... If it smoothes the process then...

Note that I use de flyinheight AFTER the land order, when the helo is already on the ground. It's only to make it stick there.

Thanks for your ideas, I guess there's always a better way.

Bye

Eric

Share this post


Link to post
Share on other sites

Hi guys.

Nice info here. I needed something like this for a rescue mission currently in progress...However I ended up moulding your ideas for my purpose a bit so I involved into first trigger which calls the chopper into players position a line which also joins it to players group. Then with another radio command for landing I set a timeout for 10 secs and order everybody in. I f I get in last as leader then it'll go ok.

Then I just order it to any location I want and use the land trigger again , exit and tell it to "wait for me". There's also a third option trigger which releases it again from my group....

I'm just so lowsy with scripting so this is not so fancy but it works also. smile_o.gif

Share this post


Link to post
Share on other sites

btw how do i make it if i want 2 groups that the triggers support KyleSarnik? Like i got a team of pilots that need to get rescued and also a SF team that is going in to help them out.

Also when i have gotten extracted by the helo wich is hairy cause im using some of the small islands in north west of the main island as area of operations. tounge2.gif yeah the chopper dont fly to the base marker somehow, it flies away just outside the islands after pick up and holds above the water.

Share this post


Link to post
Share on other sites

Hey guys. I've had the stress of trying to get a heli extraction to end a mission as well, tried to do it the same way as with the training mission "commander", pulled it apart, understood it, got the chopper to land to the smoke, but couldn't get the script to hold the heli down so the squad could get in to work banghead.gif .

Tried PLENTY of user made missions for the task, and searched forums galore but couldn't find one that suited what I wanted, and I really don't want a fixed WP, radio alpha, basic style one, been playing this game too long to be doing that. If anyone knows what I'm talking about and has a working script for it, please post it on this thread, and if it is MP compatible too, that would be a big plus.

Hope someone can help me stop banging my head against the wall soon.

Happy hunting all.

P.S.

SNKMAN, havn't tried your script yet, is it good for MP?

Share this post


Link to post
Share on other sites

Hi SNKMAN... a quest and some help:

is there something wrong or forget in your script's explanation?

I'm trying to make workin' it but all is right since the chopper approach to the 2th trigger....and it go back without landing.

thanks

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  

×