MSFS Mission Script - Sim Objects: Difference between revisions

From FSDeveloper Wiki
Jump to navigationJump to search
m (Added mission navbox)
(Added explanation for the container element and AI properties)
Line 21: Line 21:
| XP9 = false
| XP9 = false
}}
}}
You can add planes and other simobjects to your mission.
{{:Transclusion_MSFS_Mission_Script}}
== Container ==
{{Infobox-MSFS-Script-Element
| category    = SimObjects
| name        = Container
| short-descr = Container for a SimObject
}}
!ContainerTitle
|Name of the container, link with SimObject.
|-
!MDLGuid
|GUID of the SimObject.
|-
!ContainerID
|A number ID used to link with the Flight File.
|-
!UseRegionContainerType
|Is the SimObject adapted to the region (for airport vehicles).
|-
!SimplifiedSimMode
|You can set the level of simulation for this SimObject.
|-
!EngineStarted
|You can easily toggle the engines.
|-
!IdentificationNumber
|Plane registration?
|-
!LabelMode
|Only for FSX.
|-
!DontCreateSimSound
|You can make the SimObject silent.
|-
!Effect
|Attach an effect to the SimObject.
|-
!World Position
|You can set the initial position.
|-
!Orientation
|You can set the initial orientation.
|-
!Velocity
|You can set the initial velocity.
|-
!TrafficDB
|Link to a traffic database file?
|-
!Add(Co)Pilot
|
{{Infobox-MSFS-Script-Element-End}}


{{:Transclusion_MSFS_Mission_Script}}
=== Setting up a container ===
All simobjects have to be set up with a container element. Add a container in the [[MSFS_Script_Editor|Script Editor]]. You have to link the container to a simobject. Open the simobjects panel by clicking <code>Script Editor > View > Sim Objects</code>. Link the ''ContainerTitle'' by clicking the box and, while keeping the mouse pressed, drag it to the simobject you want to select:
 
[[File:Container_-_link_container_title.png|700px]]
 
Do the same for the ''MDLGuid'':
 
[[File:Container_-_link_MDLGuid.png|700px]]
 
 
==== Flight File Definitions ====
For planes, you can add further definitions in the [[Flight_file_(MSFS)|Flight File]]. Pick a number for the ''ContainerID'', for example we'll use <code>40923</code>. In the flight file, you can add definitions for the same variables as the player's plane, but instead of <code>.0</code>, you use the ''ContainerID'':
 
[Sim.40923]
Sim=Savage Cub 01 Livery
SimFile=taxi.flt
[Payload.40923]
PayloadList= 300.0


== AI ==
== AI ==
You can set the AI of your simobject. In the container, choose an ''AIType'' and select an AI:
{|class="wikitable"
!AI name
!Description
|-
![[#AircraftAI|AircraftAI]]
|Most extensive AI. Used for planes.
|-
![[#ParameterAI|AircraftAI]]
|Simpler AI. Used for all AI types.
|-
![[#IdleWorkerAI|IdleWorkerAI]]
|Simpler AI. Used for walking human AI.
|-
|[[#HumanPilotAI|HumanPilotAI]]
|Used for human models piloting a SimObject. No effect on the vehicle itself.
|-
|[[#AirplanePlaybackAI|AirplanePlaybackAI]]
|Used for playing back a flight recording. Not really AI.
|}
=== Basic AI elements ===
{|class="wikitable"
!Property name
!Description
|-
|Unit_Mode
|Determines the current AI mode.
|-
|WaypointList
|List of waypoints to follow.
|-
|GroundCruiseSpeed
|Cruise speed in knots for taxiing.
|-
|GroundTurnSpeed
|Speed in knots to slow to when making sharp turns.
|-
|GroundTurnTime
|Seconds to take for making a 90 degree turn.
|-
|YieldToUser
|Determine if the AI stops when the player is in the way.
|-
|WaypointTouchDistance
|Distance in meters at which Aircraft AI considers waypoint to be reached.
|-
|KeepLastHeading
|The AI should arrive with the same heading as the heading between last and before last waypoint.
|-
|CanReverse
|Determines if the waypoint AI reverses if it missed its waypoint.
|}
=== AircraftAI ===
{|class="wikitable"
!Property name
!Description
|-
|Schedule
|Create a schedule for AI flights.
|-
|ICAOIdent
|
|-
|[[#List_of_Aircraft_AI_States|AircraftAIState]]
|Extensive states for the AI, corresponding to flight stages.
|-
|SimDisableTimer
|
|-
|RunwayIndex
|Index of the runway.
|-
|Flags
|
|-
|MaxBank
|Maximum bank used when turning between waypoints in degrees.
|-
|Pattern_Entry
|
|-
|PendingMenuSelection
|
|-
|TimeToTransmit
|
|-
|DistanceToDestination
|
|-
|LegLength
|
|-
|AssignedHeading
|
|-
|AssignedAltitude
|
|-
|AssignedAirspeed
|
|-
|FinalApproachCourse
|
|-
|CirclingAltitude
|
|-
|ParkingIndex
|Index of the parking spot.
|-
|RunwayPatternAlt
|
|-
|CTAFAnnouncementTimer
|
|}
You can also add some parameters for the ''TaxiAI'', ''TakeoffAI'', and ''LandingAI''.
==== TaxiAI ====
{|class="wikitable"
!Property name
!Description
|-
|TaxiRoute
|Taxi route at a specific airport.
|-
|NextWaypoint
|Next taxi waypoint.
|-
|CurrentWaypoint
|Waypoint the AI is now taxiing towards
|-
|CurrentWaypointLLA
|Coordinates of the current waypoint.
|-
|PrevWaypoint
|Previous taxi waypoint.
|-
|Destination
|Coordinates of the destination.
|-
|HoldClearPoint
|Taxipoint at which to hold.
|-
|HoldShortPoint
|Taxipoint at which to hold.
|-
|HoldFlags
|
|-
|HoldStartTime
|
|-
|HasRunwayHeading
|Is the plane aligned with the runway?
|-
|IsPushingBack
|Is the plane currently pushing back?
|-
|PassOncoming
|Can we pass oncoming traffic on the right? (For road vehicles)
|-
|PauseAtHoldshort
|Pause at holdshort before crossing a runway
|-
|NoConflict
|Ignore and is ignored by the traffic conflict system
|}
==== TakeoffAI ====
{|class="wikitable"
!Property name
!Description
|-
|RunwayHeading
|Runway Heading in degrees.
|-
|AITakeoffMode
|Current state of the takeoff.
|}
==== LandingAI ====
{|class="wikitable"
!Property name
!Description
|-
|AILandingMode
|Current state of the landing.
|-
|InitialFlaps
|Minimum flaps position to use during landing.
|-
|ThresholdLLA
|Coordinates of the point where we want to touch down.
|-
|RunwayLength
|Length of Runway in Nautical Miles
|-
|RunwayAlt
|Runway Altitude in feet MSL
|-
|ApproachSlope
|
|-
|InitialAlt
|Approach altitude Feet AGL
|-
|MaxInterceptAngle
|
|}
=== HumanPilotAI ===
=== AirplanePlaybackAI ===
{|class="wikitable"
!Property name
!Description
|-
|Playing
|Whether or not the recorded flight is being played back by the [[Play_Flight_Recording_Action|PlayFlightRecordingAction]] or not.
|-
|filename
|Filename of the playback file.
|-
|TimeStamp
|Time offset of playback when saved.
|}


=== List of Aircraft AI States ===
=== List of Aircraft AI States ===
Line 89: Line 392:
|-
|-
|}
|}


{{Template:Navbox-Mission-Creation-MSFS}}
{{Template:Navbox-Mission-Creation-MSFS}}

Revision as of 11:25, 11 December 2021


You can add planes and other simobjects to your mission. See MSFS Mission Script for general information about creating a mission script.

Container

Container

Container for a SimObject


ContainerTitle Name of the container, link with SimObject.
MDLGuid GUID of the SimObject.
ContainerID A number ID used to link with the Flight File.
UseRegionContainerType Is the SimObject adapted to the region (for airport vehicles).
SimplifiedSimMode You can set the level of simulation for this SimObject.
EngineStarted You can easily toggle the engines.
IdentificationNumber Plane registration?
LabelMode Only for FSX.
DontCreateSimSound You can make the SimObject silent.
Effect Attach an effect to the SimObject.
World Position You can set the initial position.
Orientation You can set the initial orientation.
Velocity You can set the initial velocity.
TrafficDB Link to a traffic database file?
Add(Co)Pilot

Setting up a container

All simobjects have to be set up with a container element. Add a container in the Script Editor. You have to link the container to a simobject. Open the simobjects panel by clicking Script Editor > View > Sim Objects. Link the ContainerTitle by clicking the box and, while keeping the mouse pressed, drag it to the simobject you want to select:

Do the same for the MDLGuid:


Flight File Definitions

For planes, you can add further definitions in the Flight File. Pick a number for the ContainerID, for example we'll use 40923. In the flight file, you can add definitions for the same variables as the player's plane, but instead of .0, you use the ContainerID:

[Sim.40923]
Sim=Savage Cub 01 Livery
SimFile=taxi.flt

[Payload.40923]
PayloadList= 300.0

AI

You can set the AI of your simobject. In the container, choose an AIType and select an AI:

AI name Description
AircraftAI Most extensive AI. Used for planes.
AircraftAI Simpler AI. Used for all AI types.
IdleWorkerAI Simpler AI. Used for walking human AI.
HumanPilotAI Used for human models piloting a SimObject. No effect on the vehicle itself.
AirplanePlaybackAI Used for playing back a flight recording. Not really AI.

Basic AI elements

Property name Description
Unit_Mode Determines the current AI mode.
WaypointList List of waypoints to follow.
GroundCruiseSpeed Cruise speed in knots for taxiing.
GroundTurnSpeed Speed in knots to slow to when making sharp turns.
GroundTurnTime Seconds to take for making a 90 degree turn.
YieldToUser Determine if the AI stops when the player is in the way.
WaypointTouchDistance Distance in meters at which Aircraft AI considers waypoint to be reached.
KeepLastHeading The AI should arrive with the same heading as the heading between last and before last waypoint.
CanReverse Determines if the waypoint AI reverses if it missed its waypoint.

AircraftAI

Property name Description
Schedule Create a schedule for AI flights.
ICAOIdent
AircraftAIState Extensive states for the AI, corresponding to flight stages.
SimDisableTimer
RunwayIndex Index of the runway.
Flags
MaxBank Maximum bank used when turning between waypoints in degrees.
Pattern_Entry
PendingMenuSelection
TimeToTransmit
DistanceToDestination
LegLength
AssignedHeading
AssignedAltitude
AssignedAirspeed
FinalApproachCourse
CirclingAltitude
ParkingIndex Index of the parking spot.
RunwayPatternAlt
CTAFAnnouncementTimer

You can also add some parameters for the TaxiAI, TakeoffAI, and LandingAI.

TaxiAI

Property name Description
TaxiRoute Taxi route at a specific airport.
NextWaypoint Next taxi waypoint.
CurrentWaypoint Waypoint the AI is now taxiing towards
CurrentWaypointLLA Coordinates of the current waypoint.
PrevWaypoint Previous taxi waypoint.
Destination Coordinates of the destination.
HoldClearPoint Taxipoint at which to hold.
HoldShortPoint Taxipoint at which to hold.
HoldFlags
HoldStartTime
HasRunwayHeading Is the plane aligned with the runway?
IsPushingBack Is the plane currently pushing back?
PassOncoming Can we pass oncoming traffic on the right? (For road vehicles)
PauseAtHoldshort Pause at holdshort before crossing a runway
NoConflict Ignore and is ignored by the traffic conflict system

TakeoffAI

Property name Description
RunwayHeading Runway Heading in degrees.
AITakeoffMode Current state of the takeoff.

LandingAI

Property name Description
AILandingMode Current state of the landing.
InitialFlaps Minimum flaps position to use during landing.
ThresholdLLA Coordinates of the point where we want to touch down.
RunwayLength Length of Runway in Nautical Miles
RunwayAlt Runway Altitude in feet MSL
ApproachSlope
InitialAlt Approach altitude Feet AGL
MaxInterceptAngle

HumanPilotAI

AirplanePlaybackAI

Property name Description
Playing Whether or not the recorded flight is being played back by the PlayFlightRecordingAction or not.
filename Filename of the playback file.
TimeStamp Time offset of playback when saved.

List of Aircraft AI States

Aircraft AI State Name
WAIT_INIT_CONFIRM
SLEEP
FILE_FLIGHT_PLAN
SUPPORT_PREFLIGHT
IFR_CLEARANCE
PUSH_BACK_BEGIN
PUSH_BACK_CONTINUE
ENGINE_START
PRE_TAXI_FOR_TAKEOFF
TAXI_FOR_TAKEOFF
TAXI_ONTO_RUNWAY
TAKEOFF
TOUCH_AND_GO_DEPARTURE
ENROUTE_AS_FILED
TRAFFIC_PATTERN
LANDING
LANDING_ROLLOUT
GO_AROUND
TAXI_TO_PARKING
ENGINE_SHUTDOWN
SUPPORT_POSTFLIGHT
TAXI_TO_REFUEL
SIMPLE_FLIGHT
SIMPLE_LANDING
SIMPLE_TAKEOFF
WAIT_FOR_ENGINE_START
TAXI_HOLDSHORT
FLY_UNTIL_NEXT_EVENT
WAIT_FOR_ENGINE_SHUTDOWN
Pages relevant to mission creation for MSFS.

Mission structure

Flightplan
Weather definitions
Flight file
Mission script
Triggers
AirportLandingTrigger & AreaLandingTrigger · CounterTrigger · PropertyTrigger · ProximityTrigger · TimerTrigger
Actions
ObjectActivationAction · DialogAction · AdjustPayloadAction · ChangeAssistanceItemAction · FadeToColorAction · RandomAction · RequestTeleportAction · CountAction · ResetTimerAction · TimerAdjustAction · GoalResolutionAction & SubGoalResolutionAction · GrantRewardAction · PointOfInterestActivationAction · ActivateWaypointsAction · AITakeControlsAction · SendMessageToAIAction
Mission objects
Mission definition · Goal · LivingWorldExclusion · Camera
Calculator
Flow states
Events
Areas
Rectangle Area · Cylinder Area · Polygon Area · Corridor Area · InGameMarker
Library objects
Sim objects
RTC

Mission tools

MSFS Script Editor · BushTripInjector · BushMissionGen · MSFSLocalizer · SPB2XML · Little Navmap

Other

Example mission files
Porting FSX Missions to MSFS
Localisation
Click the links to access the topic pages (Default - Opens in same window).