Jump to content
gc8

Jet auto landing carriers

Recommended Posts

Hi

Today I discovered that the jets can auto land to aircraft carrier. This is super cool, though in some circumstances the landing fails to a crash. My question is how do you use the setAirportSide command?

I placed the carrier in the editor and gave it name "tc" then I have this script line:

 

tc setAirportSide east;

 

But it doesn't seem to work as "airportSide tc" returns "UNKNOWN"

 

So how do you properly use that command, or is it broken?

 

I tried to change the carrier side east because I am playing as west and wanted to prevent the landing on that carrier.

 

Also does anyone know a good way to get the index of the airfields? (used in another form of setAirportSide)

 

thx!

Share this post


Link to post
Share on other sites
2 minutes ago, gc8 said:

Also does anyone know a good way to get the index of the airfields?

 

allAirports

 

Quote

Return Value:

Array - in format [staticAirports, dynamicAirports], where:

staticAirports Array of Numbers - static airports IDs

dynamicAirports Array of Objects - dynamic airports objects (such as aircraft carrier)

 

Share this post


Link to post
Share on other sites
2 minutes ago, sarogahtyp said:

allAirports

 

Yeah I meant what index/number is which airport index on the map?

Share this post


Link to post
Share on other sites

To answer part of my own question it looks like you have to get the carrier object from allAirports in order for it to work


 

(allAirports # 1 # 1) setAirportSide east

 

Share this post


Link to post
Share on other sites

Another question. Why does the jet still auto land on carrier which side I set to east? (Jet is side west)

Share this post


Link to post
Share on other sites

I guess it just lands where you told it to with the landAt command.

setAirportSide/airportSide is just to set/identify who owns the airfield. what the mission designer does with that information  is his own choice.

Share this post


Link to post
Share on other sites

Is the static (map) airport configs somewhere ? I have been looking but haven't yet found where all the map stuff is defined, maybe there's airport IDs there

Share this post


Link to post
Share on other sites

I don't get what u r missing. allAirports should give u all those IDs

Share this post


Link to post
Share on other sites
3 minutes ago, sarogahtyp said:

I don't get what u r missing. allAirports should give u all those IDs

 

yes but where are the airports located at?

Share this post


Link to post
Share on other sites

Found the answer to my question.

The "main" airport's location is in "ilsPosition" of the world cfg

 

So in altis its:

 

configfile >> "CfgWorlds" >> "Altis" >> "ilsPosition"

 

And the "secondary" airports are in:

 

configfile >> "CfgWorlds" >> "Altis" >> "SecondaryAirports"

 

 

More info: https://community.bistudio.com/wiki/Dynamic_Airport_Configuration

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Made this little function to get the nearest AF ID. Useful when you want to use landAt etc commands:

 

 

getNearestAirfieldId =
{
 params ["_nearTo"];
 private _world = configfile >> "CfgWorlds" >> worldname;
 private _index = 0;
 private _closestDist = 1000000;
 private _closestIndex = -1;
 
 _checkAF =
 {
  params ["_ilspos"];
  private _p = getArray _ilspos;
  private _dist = _p distance2D _nearTo;
  if(_dist < _closestDist) then
  {
  _closestIndex = _index;
  _closestDist = _dist;
  };
  _index = _index + 1;
 };
 
 (_world >> "ilsPosition") call _checkAF;
 
 _sec = _world >> "SecondaryAirports";
 
 for "_i" from 0 to (count _sec - 1) do
 {
  _ap = _sec select _i;
  (_ap >> "ilsPosition") call _checkAF;
 };
 
 _closestIndex
};

 

  • Like 4

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

×