The SimConnect_AISetAircraftFlightPlan function is used to set or change the flight plan of an AI controlled aircraft.

 

Syntax
HRESULT SimConnect_AISetAircraftFlightPlan(
        HANDLE  hSimConnect,
        SIMCONNECT_OBJECT_ID  ObjectID,
        const char*  szFlightPlanPath,
        SIMCONNECT_DATA_REQUEST_ID  RequestID
      );

 

Parameters
ParameterDescriptionType
hSimConnectHandle to a SimConnect object.Integer
ObjectIDSpecifies the server defined object ID.Integer
szFlightPlanPathNull-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 the simulation, and then save them off for use with the AI controlled aircraft.String
RequestIDSpecifies 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 valueDescription
S_OKThe function succeeded.
E_FAILThe function failed.

 

Remarks

The following errors may apply to AI objects (refer to the SIMCONNECT_EXCEPTION enum for more details):

  • SIMCONNECT_EXCEPTION_LOAD_FLIGHTPLAN_FAILED
  • SIMCONNECT_EXCEPTION_OPERATION_INVALID_FOR_OBJECT_TYPE
  • SIMCONNECT_EXCEPTION_ERROR

 

Typically this function would be used some time after the aircraft was created using the SimConnect_AICreateParkedATCAircraft call.