SimConnect_AICreateEnrouteATCAircraft_EX1

The SimConnect_AICreateEnrouteATCAircraft_EX1 function is used to create an AI controlled aircraft that is about to start - or has started - its flight plan. This function can be used with both legacy SimObjects, and modular SimObjects.

 

Syntax
HRESULT SimConnect_AICreateEnrouteATCAircraft_EX1(
    HANDLE  hSimConnect,
    const char*  szContainerTitle,
    const char* szLivery,
    const char*  szTailNumber,
    int  iFlightNumber,
    const char*  szFlightPlanPath,
    double  dFlightPlanPosition,
    BOOL  bTouchAndGo,
    SIMCONNECT_DATA_REQUEST_ID  RequestID
    );

 

Parameters
Parameter Description Type
hSimConnect Handle to a SimConnect object. Integer
szContainerTitle

Null-terminated string containing the container title. The container title is found in the title parameter of the aircraft.cfg file, or alternatively, you can find it from the list found in the Aircraft Capture Tool. You may also retrieve the information with SimConnect using the SimConnect_EnumerateSimObjectsAndLiveries function.


Examples of aircraft titles:

  1. title=Boeing 747-8f Asobo
  2. title=DA62 Asobo
  3. title=VL3 Asobo
String
szLivery

Null-terminated string containing the livery name. This field is only required when checking modular SimObjects, since their liveries are dynamically handled and do not have a unique title parameter like legacy aircraft.

This parameter can be set to either the name of the livery as defined in the name parameter of the livery.cfg, or to the folder name of the livery in the package. Note that you can also get the livery name using the SimConnect_EnumerateSimObjectsAndLiveries function.

The function will check for the folder first, then the parameter name second, and if the given name is not found in either location, then the default livery will be used.

String
szTailNumber Null-terminated string containing the tail number. This should have a maximum of 12 characters. String
iFlightNumber Integer containing the flight number. There is no specific maximum length of this number. Any negative number indicates that there is no flight number.
szFlightPlanPath.
Integer
szFlightPlanPath Null-terminated string containing the path to the flight plan file. Flight plans have the extension .pln, but no need to enter an extension here. The easiest way to create flight plans is to create them from within Microsoft Flight Simulator 2024 itself, and then save them off for use with the AI controlled aircraft. String
dFlightPlanPosition Double floating point number containing the flight plan position. The number before the point contains the waypoint index, and the number afterwards how far along the route to the next waypoint the aircraft is to be positioned. The first waypoint index is 0. For example, 0.0 indicates that the aircraft has not started on the flight plan, 2.5 would indicate the aircraft is to be initialized halfway between the third and fourth waypoints (which would have indexes 2 and 3). The waypoints are those recorded in the flight plan, which may just be two airports, and do not include any taxiway points on the ground. Also there is a threshold that will ignore requests to have an aircraft taxiing or taking off, or landing. So set the value after the point to ensure the aircraft will be in level flight. Float
bTouchAndGo Set to True to indicate that landings should be touch and go, and not full stop landings. Bool
RequestID Specifies the client defined request ID. Integer

 

Return Values

The function returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return value Description
S_OK The function succeeded.
E_FAIL The function failed.

 

Remarks

An enroute aircraft can be on the ground or airborne when it is created by this function. Typically this will be an aircraft flying under IFR rules, and in constant radio contact with ATC. The following exceptions can be created by this function (refer to the SIMCONNECT_EXCEPTION enum for more details):

  • SIMCONNECT_EXCEPTION_LOAD_FLIGHTPLAN_FAILED
  • SIMCONNECT_EXCEPTION_CREATE_OBJECT_FAILED

 

A SIMCONNECT_RECV_ID_EVENT_OBJECT_ADDREMOVE event notification can be subscribed to (see the SimConnect_SubscribeToSystemEvent function), which will return a SIMCONNECT_RECV_EVENT_OBJECT_ADDREMOVE structure whenever any client, including the one making the change, successfully adds or removes an AI controlled object.

 

For float-planes the recommended procedure is to control them using waypoints, and not the ATC system, as there is no concept of a "parking space" after a water landing. So, the waypoints of the route of the float-plane should include the route that it should follow before take off and after landing. For all these cases of controlling aircraft using the client, or using waypoints, set up the object using the SimConnect_AICreateNonATCAircraft_EX1 call.