The SimConnect_AICreateSimulatedObject function is used to create AI controlled objects other than aircraft.

NOTE
This function is a legacy function and only works with non-modular aircraft. In Microsoft Flight Simulator 2024 we recommend you use SimConnect_AICreateSimulatedObject_EX1, which can be used with legacy and modular aircraft.

 

Syntax
HRESULT SimConnect_AICreateSimulatedObject(
    HANDLE  hSimConnect,
    const char*  szContainerTitle,
    SIMCONNECT_DATA_INITPOSITION  InitPos,
    SIMCONNECT_DATA_REQUEST_ID  RequestID
    );

 

Parameters
ParameterDescriptionType
hSimConnectHandle to a SimConnect object.Integer
szContainerTitle

Null-terminated string containing the container title. The container title is found in the aircraft.cfg file.

IMPORTANT! This title must be in an aircraft Preset.Alternatively, the aircraft title can be obtained via the Aircraft Selector (DevMode->Windows->Aircraft selector). Finally, the information can be found using the SimConnect_EnumerateSimObjectsAndLiveries function.

Examples of aircraft titles:

  1. title=Boeing 747-8f Asobo
  2. title=DA62 Asobo
  3. title=VL3 Asobo
String
InitPosThis a SIMCONNECT_DATA_INITPOSITION struct containing the data referring to the spawn position of the SimObject.Struct
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

This function can be used to create a stationary aircraft (such as an unflyable aircraft on display outside a flight museum), but is typically intended to create simulation objects other than aircraft (such as ground vehicles, boats, and a number of special objects such as humpback whales and hot-air balloons).

 

The following exception can be created by this function (refer to the SIMCONNECT_EXCEPTION enum for more details):

  • SIMCONNECT_EXCEPTION_CREATE_OBJECT_FAILED