GENERAL TEMPLATE DEFINITIONS

On this page you can find a list of the general model behavior XML that is used within the <Behaviors> element of the [model].xml file associated with a SimObject. For an overview of the contents of this page please see the following section:

 

 

<Macro>

This element creates a global-scope macro that can be used to name values, strings and code which will then be substituted in at runtime wherever the macro is called. The macro has a "name" attribute, which is the name that should be called in the rest of the model behavior XML to use the macro, and the contents of the element are what will be substituted in instead. Note that when calling a macro name it should be preceded by an @. Macros are usually defined at the top of the XML, directly under the <Behaviors> element, and would look something like this:

<Macro Name="IsUsingRelativePos">(M:InputType) 1 ==</Macro>
<Macro Name="DragLockResetTimer">0.05 0.10 @IsUsingRelativePos ?</Macro>
<Macro Name="MyCompany">'TT_COMPANY_NAME_LOCALISED'</Macro>

 

Attribute Description Type Required
Name The name of the macro, which will be used to call the macro in the rest of the XML. Use the @ symbol before the macro to use it, eg: @on_off_condition String Yes

 

 

<Include />

This element is used to read and register the InputEvents, Macros, Templates and Parameter Functions included within the file given in the chosen attribute. This is a self-closing element that is used within the <Behaviors> element or - for library files - within the <ModelBehaviors> element. It must have one of the following attributes, and should always be listed at the top of the XML file, or directly after the <Behaviors> or <ModelBehaviors> element: 

 

Attribute Description Type Required
ModelBehaviorFile This tells the models.xml to include one of the Microsoft Flight Simulator core model behavior definition files. The path will be relative to the ModelBehaviorDefs folder. For example, to include the "Engine.xml" file, then the path supplied to this attribute would be: "Asobo\Common\Engine.xml". String No
Path This is an alias for the ModelBehaviorFile attribute. String No
RelativeFile This is for including a file from a path relative to the [model].xml file location. String No
File This is an alias for the RelativeFile attribute. String No

 

 

<IncludeBase />

This element is used to include the <Behaviors> from another [model].xml file. For example, if you have an aircraft already defined that is very similar to the one you are currently working on, then you can use this element to include the <Behaviors> from the first aircraft and then modify only those model behaviors that differ in the current aircraft [model].xml. This is a self-closing element and should be defined at the top of the XML file, or directly after the <Behaviors> element. It has the following attribute:

 

Attribute Description Type Required
RelativeFile This is for including a file from a path relative to the [model].xml file location. String Yes

 

Optionally you may use these attributes instead of the RelativeFile attribute, although these are not generally required:

 

Attribute Description Type Required
ModelBehaviorFile This tells the models.xml to include one of the Microsoft Flight Simulator core model behavior definition files. The path will be relative to the ModelBehaviorDefs folder. For example, to include the "Engine.xml" file, then the path supplied to this attribute would be: "Asobo\Common\Engine.xml". String No
Path This is an alias for the ModelBehaviorFile attribute. String No
File This is an alias for the RelativeFile attribute. String No

 

 

<Component>

With this element you can define a component behavior. The contents of this element will depend on the component being defined and the purpose that it is being created for, and can include <Parameters><UseTemplate><Condition> and other elements (like the ones that are custom to the template, as explained in the Templates section of the Model Behaviors page). This element has the following attributes:

 

Attribute Description Type Required
ID The unique ID for the component.  String Yes
Node This is the name of the model node (part) that the component should affect. String No
CameraTitle This is the name of a camera to use to highlight an instrument when evaluating a checklist. String No
OverrideID When using an <IncludeBase />  as part of the XML, this lets you create a component that overrides a previously defined component with a a given ID,  redefining everything it used to define. String No

 

Note that you may see in some of the XML templates the element <RootComponent>. This is a deprecated element that is now considered an alias for the <component> element as such should not be used for new model behaviors.

 

<PartID>

This node defines an ID used in a checklist for highlighting instruments. Essentially this creates a link between a name (the PartID) and a node (the component node ID). You may have multiple part IDs for a single component ID. This element has no attributes.

 

<UpdateFrequencyPreset>

This element permits you to change which update frequency preset a component should be using and is a sub-element of the <Component> element. These presets define how often an animation, VFX, etc... should be updated based on the size on screen of the model (calculated as a Percent Over 100). The frequency itself will be 1 update per game frame for the maximum and 1 update every 30 game frames for the minimum, and the update frequency for models between the min and max size will have an interpolated frequency between 1:1 and 1:30.


The default preset for the update frequency is "Asobo_Default", which will be used if this sub-element is omitted. The presets available by default to you are:

 

Name Size On Screen For
Max Update Frequency
Size On Screen For
Min Update Frequency
Size On Screen
To Stop Update
Asobo_Default 1.0 0.01 0.01
Asobo_FrequentWhenSmall 0.01 0.001 0.001
Asobo_RareWhenSmall 1.0 0.1 0.1
Asobo_Default_NeverStop 0.1 0.01 0.0

 

You can find information on how to create your own presets from the following section:

 

 

<Template>

With this element we initialise a template definition and give it a name. This can then be called using the <UseTemplate> element elsewhere in the XML. The element is used as a container for the template data, which can include <Component>, <Parameters>, <UseParametersFn><UseTemplate><Condition>, and other elements (like the ones that are custom to the template, as explained in the Templates section of the Model Behaviors page). This element has the following attributes:

 

Attribute Description Type Required
Name This is the name of the template, and is what will be used when calling the <UseTemplate> element. String Yes

 

<TemplateAlias>

You can use this element as a sub-element of <Template> and is used to define an alias for the template that is using it. This element has no attributes, and requires a string to be used correctly, for example:

<Template Name="DEPRECATED_Propeller_Anim_Rotation_Template">
    <TemplateAlias>Propeller_Anim_Rotation_Template</TemplateAlias>
</Template>

 

 

<UseTemplate>

This element is used to reference another template. This element has no fixed sub-elements and will generally require the use of the parameters that are created in the template being referenced, some of which may be optional. It has the following attributes:

 

Attribute Description Type Required
Name This is for including a file from a path relative to the [model].xml file location. String Yes

 

 

<InputEvent>

This element is used to retrieve input from the user. The element is used as a container element for <Presets> that will be used to create the the different inputs. It has the following attributes:

 

Attribute Description Type Required
ID The ID (name) of the Input Event being defined. This ID is then used in the <UseInputEvent> element to call the event. String Yes

 

This contents of this element are explained in full on the following page:

 

 

<UseInputEvent>

This element will call an input event that has been defined already from a template or from the [model].xml using the <InputEvent> element. It has the following attributes:

 

Attribute Description Type Required
ID The ID (name) of the Input Event to use, as defined by the ID attribute of the <InputEvent> element. String Yes

 

For more information on input events, please see the following page:

 

 

<Parameters>

This sub-element is essentially a container for any number of parameters required by other elements - like <Template>, <Component>, or within <Presets> - and it can also be used when working with the XML Programs elements. The element does not require any additional attributes, although it does have the following optional attributes:

 

Attribute Description Type Required
Type When this attribute is included, you are saying that the parameter sub-elements contained in this element will either be used as default parameters or will override existing parameters. 

String:

  • "Default"
  • "Override"
No
Lifetime This attribute establishes the lifetime of the parameters, and is only relevant when the element is used within a <Loop>. When the attribute is set to "Iteration", the parameters will be created and discarded on each iteration of the loop, while setting it to "Loop" the parameter will be created at the start of the loop, and discarded at the end of all iterations.

String:

  • "Loop"
  • "Iteration"
No

 

It should be noted that in older iterations of the model behavior files and templates the elements <DefaultTemplateParameters> and <OverrideTemplateParameters> were used to contain default and override parameters. However these two elements are now deprecated and you should use the <Parameters> element with the appropriate Type attribute.

 

Any user created parameters called within this element can also have a special Process attribute added to them. This attribute is explained here:

 

 

<ParametersFn>

This element is similar to the <Template> element, in that it permits you to create a reusable XML for use in your model behaviors. The element can takes a list of parameters as the input, perform operations on these inputs using XML Programs, and then return one or more parameters as the ouput. This is a container element for <Parameters>, <ReturnParameters>, and XML Programing elements, and requires a unique name, and you can have multiple parameter functions defined. This name is what would be used to reference the function in other parts of the model behavior XML.

 

Attribute Description Type Required
Name This is the name of the parameter function, and is what will be used when calling the <UseParametersFn> element. String Yes

 

For more information on how to use this element please see the following section:

And for examples of use, please see here:

 

<ReturnParameters>

This element is used to define one or more return parameters from a <ParametersFn> element. This element can also contain further parameter function calls using the <UseParametersFn> as well as XML Programing elements.

 

 

<UseParametersFn>

This element is used to call a previously defined parameter function, and can itself serve as a container for parameters. The function named by this element should have been created already using the <ParametersFn> element.

 

Attribute Description Type Required
Name This is the name of the previosly deinfed parameter function that is being used String Yes

 

 

<AnimationTriggers>

This element is used within the model behaviors as a trigger for generating a sound effect, es explained in the Animation Sounds Example. It will contain one or more <EventTrigger> elements and requires one attribute:

 

Attribute Description Type Required
Animation The name of the animation that the sound should play on. String Yes

 

<EventTrigger>

This is a sub-element of <AnimationTriggers> and is a container for the <SoundEvent /> element (which plays a sound) or the <EffectEvent /> element(). This element has the following attributes:

 

Attribute Description Type Required
NormalizedTime This is the normalized time of the animation from which the sound will play. It's going from 0 to 1. This attribute must be used alone, without a Count or Frame attribute. Float No
Count

This attribute divides the animation timeline in equal segments by the value given. Sounds will play at the middle of each segment. e.g:

  • If the value is 2 the sound will play when the animation timeline reaches 25% and 75%.
  • If the value is 5 the sound will play when the animation timeline reaches 10%, 30%, 50%, 70 and 90%.

This attribute must be used alone, without a NormalizedTime or Frame attribute.

Integer No
Frame This is the frame of the animation where the sound will be played. This attribute must be used alone, without a Count or NormalizedTime attribute. Integer No
Direction This attribute determines the direction of the animation timeline in which the sound will be played.

String:

"Forward"

"Backward"

"Both"

Yes

 

<SoundEvent />

This is a self-closing sub-element of <EventTrigger> and is what sets the sound to be triggered. This element has the following attributes:

 

Attribute Description Type Required
WwiseEvent This is the event that the sound is triggered on and should be the same as that defined for the sound in the sound.xml. String Yes
Action Whether to play or stop the sound. The stop value is useful when dealing with looping sounds.

String:

"Play"

"Stop"

Yes

 

<EffectEvent />

This is a self-closing sub-element of <EventTrigger> and is used to trigger a camera event. This element has the following attribute:

 

Attribute Description Type Required
Name The name of the camera event to trigger. String Yes