• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

MSFS20 Here's how to write you own ModelBehavior code.

I'm not sure what you are trying to do but this has syntax errors:
Thanks, sorry for my english. It will be a code for the AI version of an aircraft, to spawn every aircraft with different nodes (objects: Doors, chocks, covers...) And, to optimize it a little bit, I'm trying to write the long instruction only once at the begginin of the xml, and use the result of that long instruction, at all other nodes (animations and visibility). The long instruction returns 0 or 1 depending the AI spawned plane position, so every plane spawns with different position objects.

If I place the long instruction on every node, it yes works properly, but it is not optimal for performance. I've tried to put that value inside myVar to optimize it a little bit, but doesn't work properly, every spawned plane uses the first spawned plane value (position coords).

So I'm trying another method to call the long instrucion value:

<Component ID="Doors">
<UseTemplate Name="xxx" Node="xxx">.....<ANIM_CODE>A:PLANE LATITUDE, degree latitude) (A:PLANE LONGITUDE, degree longitude) % 5 symb 4 ></ANIM_CODE></UseTemplate>
<UseTemplate Name="yyy" Node="yyy">.....<ANIM_CODE>valueNodexxx</ANIM_CODE></UseTemplate>
<UseTemplate Name="zzz" Node="zzz">.....<ANIM_CODE>valueNodexxx</ANIM_CODE></UseTemplate>
<UseTemplate Name="uuu" Node="uuu">.....<ANIM_CODE>valueNodexxx</ANIM_CODE></UseTemplate>
</Component>

Is there someway to call the value of another node?
 
L: variables only work on the user aircraft. I'd use the longer code because a) it works and b) the performance impact will be so small that you couldn't even measure it.
 
Sorry to come back to this old post by Anthony but while wanting to use it, I noticed that warnings/errors had appeared in the DEV mod Console when loading the aircraft with these codes.
By loading similar codes in the basic installation of MSFS, I found some in MSFS\Official\OneStore\fs-base-aircraft-common\Asobo\Generic\Interactions.xml.

While comparing the codes, I noticed a few differences, which I corrected and now the code no longer produces any warnings/errors during its loading.
If it can help other people or even allow Anthony to correct the XML files that include these lines.

Details: in fact it is missing the tags DefaultTemplateParameters and a closing parenthesis (7 are needed, not 6) just before the first instruction quit
Maybe it’s due to the parser of'Asobo which has been hardened since the first version of 2020

Code:
<Template Name = "ZZZ_XXX">
        <DefaultTemplateParameters>
           <DRAG_DELTA>0.002</DRAG_DELTA>
           <DRAG_SPEED>0.5</DRAG_SPEED>
        </DefaultTemplateParameters>
        <UseTemplate Name="ASOBO_GT_MouseRect">
            <TOOLTIPID>TT:COCKPIT.TOOLTIPS.THROTTLE_CONTROL</TOOLTIPID>
            <CURSOR>Hand</CURSOR>
            <MOUSEFLAGS_DEFAULT_IM>LeftSingle+LeftRelease+LeftDrag+WheelUp+WheelDown</MOUSEFLAGS_DEFAULT_IM>
            <MouseFlags>LeftAll+WheelUp+WheelDown</MouseFlags>
            <CALLBACKCODE>
                (M:Event) 'WheelDown'    scmi 0 == if{ g1 } els{
                (M:Event) 'WheelUp'  scmi 0 == if{ g2 } els{
                (M:Event) 'LeftSingle' scmi 0 == if{ (M:RelativeY) (&gt;O:_LastY) } els{
                (M:Event) 'LeftDrag'   scmi 0 == if{
                    (O:_LastY) (M:RelativeY) -  #DRAG_DELTA# / abs (&gt;O:DragFactor)
                    (O:_LastY) (M:RelativeY) -  -#DRAG_DELTA# &lt;
                    if{
                        (M:RelativeY) (&gt;O:_LastY)
                        g1
                    }
                    els{
                        (O:_LastY) (M:RelativeY) -  #DRAG_DELTA# &gt;
                        if{
                        (M:RelativeY) (&gt;O:_LastY)
                        g2
                        }
                        els{
                        }
                    }
                } } } } }
                quit
             
                :1 (&gt;K:THROTTLE_DECR_SMALL)
                quit
             
                :2 (&gt;K:THROTTLE_INCR_SMALL)
                quit
            </CALLBACKCODE>
        </UseTemplate>
    </Template>

As I use this template for Throttle, Mixture and Prop pitch, I have also add 2 macros àt the beginning of my file and include theses macros in each template.
Code:
<Macro Name="DRAGDELTA"> 0.002 </Macro>
<Macro Name="DRAGSPEED"> 0.5 </Macro>

<Template Name = "Template_XXX">
        <DefaultTemplateParameters>
            <DRAG_DELTA>@DRAGDELTA</DRAG_DELTA>
            <DRAG_SPEED>@DRAGSPEED</DRAG_SPEED>
        </DefaultTemplateParameters>
....
 
Last edited:
Back
Top