Jump to content
Sign in to follow this  
CaptainBravo

looking for Chopper extraction under fire script

Recommended Posts

Hey everyone,

I know there are tons of extraction scripts out there. But most seem to have an issue if they are landing in hot LZ for extraction, they usually just end up flying around.

You could set behaviour in wp to careless and never fire but that seem unrealitic too.

Any script to allow a chopper to actually land in hot lz (squad being persued by enemy) while providing covering fire to pick up a squad?

Thanks for any help.

Share this post


Link to post
Share on other sites

i will soon update my parareinforce script and it will include a extract option for AI and player groups.

All working in hot lz.

Current released version has insertion in hot lz, you can try to reverse the code yourself to make the extraction.

Share this post


Link to post
Share on other sites

Do you need to use "_group1 setCombatMode "BLUE" for the chooper to land in a hot zone.

Best regards.

Share this post


Link to post
Share on other sites

Thanks guys for your help. I will test and see.

Demonized I look forward to your script for extraction. Please feel free to publish a link here when done.

Cheers.

Share this post


Link to post
Share on other sites
could be a little problem as CARELESS does not work so well

http://forums.bistudio.com/showthread.php?t=88896&highlight=careless+stuck+helicopter

Yes after testing and testing the careless = really stupid.

After testing examples and trying different land, flyinheight 2 etc, I still cannot get chopper to land in exact location in hot LZ while givinig covering fire to squad.

I hope someone has a script designed for landing in hot LZ while engaging nearby enemies and taking off as soon as squad is on board.

Share this post


Link to post
Share on other sites

This is an older script I was working on and gave up at some point. In the demo here the chopper will land at exactly the point you tell it... and even under fire it will still land.

I screwed with this for days and found that the only way was to give the chopper a moveto a point that was about 60-70m after the actual landing point required.

The reason for this was the unitReady command triggers about 60-70m before the actual point..always!

When the unitready command triggers....then bring the helo down with flyInheight.

The script is unfinished because it will simply land the helo where you want it...and then nothing!

I think the landing can be made better (not so vertical) by setting flyinheight based on distance from landing point.

Anyway feel free to chop it up... extract what you need.... whatever. It may not be an elegant solution (half of it anyway) but it does work.

Call with:-

nul = [helo,landobj,false] execVM "landhere.sqf";

helo => is the helicopter

landobj => is an object to land at...I used an object should be a position!

false => false and engine stays on....true and engine off and crew gets out

landhere.sqf

/*

*/

fn_p2r = {
private ["_ang","_dis","_dx","_dy","_rect"];
_dis = _this select 0;
_ang = _this select 1;
_dx = sin(_ang)*_dis;
_dy = cos(_ang)*_dis;
_rect = [_dx,_dy];
_rect

};

fn_getDist = {
private ["_obj1","_obj2","_dx","_dy","_dis"];
_obj1 = _this select 0;
_obj2 = _this select 1;
_dx = ((getpos _obj2 select 0) - (getpos _obj1 select 0));
_dy = ((getpos _obj2 select 1) - (getpos _obj1 select 1));
_dis = sqrt(_dx^2+_dy^2);
_dis
};

fn_getDir = {
private ["_obj1","_obj2","_x1","_y1","_x2","_y2","_dx","_dy","_ang"];
_obj1 = _this select 0;
_obj2 = _this select 1;
_dx = (getPos _obj2 select 0) - (getPos _obj1 select 0);
_dy = (getPos _obj2 select 1) - (getPos _obj1 select 1);
_ang = _dx atan2 _dy;
if (_ang < 0) then {_ang = _ang + 360};
_ang
};

private ["_helo","_lz","_land","_dist","_zvel","_yvel","_hght"];

_helo = _this select 0;
_lz = _this select 1;
_land = _this select 2;

_dir = [_helo,_lz] call fn_getDir;

_fakelz = [];
_fakelz = [70,_dir] call fn_p2r;
_fakelz = [(getpos _lz select 0) + (_fakelz select 0),(getpos _lz select 1) + (_fakelz select 1),0];

driver _helo disableai "AUTOTARGET";
driver _helo setBehaviour "CARELESS";
driver _helo setCombatMode "BLUE";

_helo domove _fakelz;
waituntil {unitready _helo};

while {canmove _helo && (getposATL _helo select 2) > 3} do {

while {(getposATL _helo select 2) > 5 && [_helo,_lz] call fn_getDist < 100} do{
	//_helo setVelocity [(velocity _helo select 0),(velocity _helo select 1),(velocity _helo select 2) - 0.5];
	sleep 1;
	hint format ["_dist = %1\n_yvel = %2\n_zvel = %3",[_helo,_lz] call fn_getDist,(velocity _helo select 1),(velocity _helo select 2)];
	_helo flyinheight 5;
};

_helo setVelocity [0,0,0];

hint "Helo turning";

_dir = getDir _helo;

//turns the helo
for [{_i=0},{_i<180},{_i=_i+1}] do {
	_helo setDir _dir + _i;
	sleep 0.01;
};

sleep 1;

if (_land) then {
	while {(getposATL _helo select 2) > 1 && [_helo,_lz] call fn_getDist < 100 && _land} do{
		//_zvel = _zvel - 0.5;
		//_yvel = _yvel - 1;
		//_helo setVelocity [(velocity _helo select 0),(velocity _helo select 1),(velocity _helo select 2) - 0.1];
		_helo flyinheight 0;
		sleep 1;
		hint "landing";
	};
};

sleep 1;
};

_helo flyinheight 0;

waituntil {unitready _helo};

hint "landed";

if (_land) then {hint "engine off"; _helo engineon false; _helo setfuel 0};

sleep 1;

hint "script done!";

Edited by twirly
Fixed download mission. No longer needs addons!

Share this post


Link to post
Share on other sites

the clue to get AI helis to work is to use whatever mode, combat, careless both work fine, place a invicible h on a good spot free of threes and buildings, now when heli gets near inv h use land "GET IN" or land "GET OUT"

works perfectly under all kinds of fire, well at least while the pilot is alive x) and no rockets find the heli.

Share this post


Link to post
Share on other sites

@twirly: Thanks for teh script. I shall play around with. You think engine off would be better replaced with engine on?

@Demonized: Thanks for the tip. I will try getin command. Any tips how to have chopper take off as soon as squad is onboard?

Share this post


Link to post
Share on other sites
Any tips how to have chopper take off as soon as squad is onboard?

for heli have a hold wp to a position where you want pickup.

place a invicible h on the pickup spot, heli will use this.

in wp put

vehiclename land "GET IN";

have a switch trigger synched to the hold wp.

condition of trigger

({_x in heliname} count [p1,p2,p3,p4]) == 4

now heli will move to the hold wp, land or hover low for troops to getin, then once all 4 units named p1,2,3,4 is in heli heli will move to next wp.

You can ofc modify amount of units to whatever but current condition checks if 4 of the 4 is in the heli.

Share this post


Link to post
Share on other sites
@twirly: You think engine off would be better replaced with engine on?

Not sure mate. I remember I gave up trying to get some troops to board and then fly way again. It just wasn't happening! Will have a look later at it and see if I can improve on it now that I have a bit more skills (hopefully) since that was written.

Edited by twirly
Edited mistake

Share this post


Link to post
Share on other sites

a trick to make sure that all units is entering or exiting a chopper without the chopper going away premature, especially in a hot lz is to use this for every soldier:

unit assignAsCargo heli; [unit] orderGetin true;

or this for whole group:

{_x assignAsCargo heli; [_x] orderGetIn true} foreach units groupname;

Share this post


Link to post
Share on other sites

I think I was having trouble making the chopper stick around. From what I remember as soon as I gave them the assignascargo and ordergetin the chopper takes off and lands again where the pilot thinks he should have landed in the first place and then the troops would try to board. They weren't behaving!!

I'll have a play with it later.

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  

×