Jump to content
darrent

ai heli making a combat landing

Recommended Posts

my plan was to have a huey  make a combat landing as in vietnam, as we all know the ai  are not up to it, so i attempted the unit capture/play route, no luck there could never get the script to work.so is there any other way to make the huey make a combat landing?

Share this post


Link to post
Share on other sites

 

To make heli land and unload you can do two things , in script:


 

// First create the landing position

private _lz = "Land_HelipadEmpty_F" createVehicle _lzpos;


// Add landing waypoint for heli group

_wp = _heloGrp addwaypoint [_lzpos,0];
_wp setWaypointType "TR UNLOAD";

 

Those codes wont work without modifying for your heli setup. But that's how you do it.

 

 

 

EDIT: Or in editor place invisible helipad and add Transport unload waypoint on top of that. should work

 

 

Share this post


Link to post
Share on other sites

but does that still make the heli do a lazy slow landing ? getting them to land is not a problem  ,they just take so damn long to land. been away from the game for a few yrs,forgotten loads of it.wondered if any 1 had cracked the secret of quick landings yet

 

Share this post


Link to post
Share on other sites
4 minutes ago, darrent said:

but does that still make the heli do a lazy slow landing ? getting them to land is not a problem  ,they just take so damn long to land. been away from the game for a few yrs,forgotten loads of it.wondered if any 1 had cracked the secret of quick landings yet

 

 

Yes it's quite slow landing compared to real combat landings

Share this post


Link to post
Share on other sites

so no ones cracked the code for quick ai landings yet then  😞   i had hoped the unitcapture/unitplay would solve it, but 7 hrs in and it still wont work.. slow landings it is then

 

Share this post


Link to post
Share on other sites

If not enough, use brute force. I'm doing so in Hermes Airlift Services script using this function:

 

RYD_HAS_AutoGuideB = 
	{
	if (RYD_TI_ControlTI) exitWith {};
	
	params ["_heli","_lvl","_var","_refPos","_tol","_vMpl","_frc"];
		
	private _vel = velocity RYD_HAS_Chopper;
	private _lvl2 = (getPos RYD_HAS_Chopper) select 2;

	private _vel0 = random ((random (2 * _var)) - _var);
	private _vel1 = random ((random (2 * _var)) - _var);
	private _vel2 = random ((random (2 * _var)) - _var);
	
	private _dst = _heli distance2D _refPos;
	
	if (_dst > _tol) then
		{
		private _vect = (position _heli) vectorFromTo _refPos;
		private _spd = ((_dst - 1) max 1) min 10;
		_vel0 = _vel0 + ((_vect select 0) * _spd * _vMpl);
		_vel1 = _vel1 + ((_vect select 1) * _spd * _vMpl);
		};
		
	_heli setVelocity [((_vel select 0) * _frc) + (_vel0 * (1 - _frc)),((_vel select 1) * _frc) + (_vel1 * (1 - _frc)),((_vel select 2) * _frc) + ((_vel2 + ((((_lvl - _lvl2) max (-(_lvl2 * 0.5) max (-2 min -((_lvl2^0.6)/3)))) min (((_vel select 2) max 0) * 1.1)) * _vMpl)) * (1 - _frc))]	
	};

 

Not 100% realistic in terms of aerodynamics, but IMO tolerable. Example call:

 

[RYD_HAS_Chopper,0.5,0,RYD_HAS_clickedPos,2,3,_frc] call RYD_HAS_AutoGuideB;

 

RYD_HAS_Chopper - your chopper.

0.5 - target altitude

0 - some randomness factor

RYD_HAS_clickedPos - a position to touch down at

2 - miss spot tolerance (if above this number of meters, will adjust horizontal positioning along with altitude

3 - descent velocity multiplier

_frc - a number between 0 and 1 - how fast current velocity is turned into target descent velocity (smoothness). 

 

It should be called constantly (say in the waitUntil loop with 0.1 sleep or maybe even per frame, although that may be too fast) till heli is and as long should stay "landed". Example from HAS context (no for standalone usage!):

 

			_frc = 0.9;
			waitUntil 
				{
				sleep 0.1;
				_alive = (alive RYD_HAS_Chopper) and {(canMove RYD_HAS_Chopper)};
				
				if not (_alive) exitWith {true};
				if not ([] call RYD_HAS_ifChopperReady) exitWith {_unable = true;true};
				
				if (RYD_HAS_FastRoping) then
					{
					[RYD_HAS_Chopper,_minLvl,0,RYD_HAS_clickedPos,2,1] call RYD_HAS_AutoGuide;
					}
				else
					{
					[RYD_HAS_Chopper,0.5,0,RYD_HAS_clickedPos,2,3,_frc] call RYD_HAS_AutoGuideB;
					_frc = (_frc - 0.025) max 0;
					};
				
				((((getPos RYD_HAS_Chopper) select 2) < (_minLvl * 1.1)) and {((RYD_HAS_Chopper distance2D RYD_HAS_clickedPos) < 4)})
				};

 

 

 

  • Like 3

Share this post


Link to post
Share on other sites

I once wrote a script that made heli land quick and accurate but I had problems getting the player camera working as it would jitter around. @Rydygier did you have any problems with camera?

Share this post


Link to post
Share on other sites

I didn't noticed such issues so far. 

Share this post


Link to post
Share on other sites
Just now, Rydygier said:

I didn't noticed such issues so far. 

 

oh ok that's good to hear. had to ditch my script because of that 

Share this post


Link to post
Share on other sites
2 hours ago, darrent said:

my plan was to have a huey  make a combat landing as in vietnam, as we all know the ai  are not up to it, so i attempted the unit capture/play route, no luck there could never get the script to work.so is there any other way to make the huey make a combat landing?

 

Go onto Youtube, and watch some of the videos of how to use the unit capture/unit play function. 

  • Like 1

Share this post


Link to post
Share on other sites

been there done that 7hrs later no dice, just will not work, followed to the letter

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

×