• 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.

Anthony31 have you tried connecting custom sounds to custom variables? If you have experience, could you tell me where and how to connect this section.
<AnimationTriggers Animation="AKK1">

<EventTrigger NormalizedTime="0.1" Direction="Forward">
<SoundEvent WwiseEvent="tumbler" Action="Play"/>
</EventTrigger>
<EventTrigger NormalizedTime="0.9" Direction="Backward">
<SoundEvent WwiseEvent="tumbler" Action="Play"/>
</EventTrigger>
</AnimationTriggers>

I created my own .PCK with sound tied to Event: tumbler and sound works tied in sound.xml,
<SimVarSounds>
<Sound WwiseEvent="tumbler" Wwisedata="true" SimVar="AKK1" Units="PERCENT" Index="0"/>
<Range LowerBound="1.0"
<Range LowerBound="0.0" />
</Sound>
</SimVarSounds>

the only drawback is that the sound is also triggered when the model is loaded.

And I try to bind to animation through AnimationTriggers, but it does not work

<AnimationSounds>
<Sound WwiseData="true" WwiseEvent="tumbler" ViewPoint="Inside"/>
</AnimationSounds>
 
So is the SDK not up-to-date for the model.xml? I see the way its written appears different to:


That link shows the animations listed as they were in the modeldef for FSX? Or does that method still work?
 
Yes the old FSX method still works, however it is deprecated, and you should use the newer model behaviors if you can.
 
Anthony31 have you tried connecting custom sounds to custom variables? If you have experience, could you tell me where and how to connect this section.
<AnimationTriggers Animation="AKK1">

<EventTrigger NormalizedTime="0.1" Direction="Forward">
<SoundEvent WwiseEvent="tumbler" Action="Play"/>
</EventTrigger>
<EventTrigger NormalizedTime="0.9" Direction="Backward">
<SoundEvent WwiseEvent="tumbler" Action="Play"/>
</EventTrigger>
</AnimationTriggers>

I created my own .PCK with sound tied to Event: tumbler and sound works tied in sound.xml,
<SimVarSounds>
<Sound WwiseEvent="tumbler" Wwisedata="true" SimVar="AKK1" Units="PERCENT" Index="0"/>
<Range LowerBound="1.0"
<Range LowerBound="0.0" />
</Sound>
</SimVarSounds>

the only drawback is that the sound is also triggered when the model is loaded.

And I try to bind to animation through AnimationTriggers, but it does not work

<AnimationSounds>
<Sound WwiseData="true" WwiseEvent="tumbler" ViewPoint="Inside"/>
</AnimationSounds>
Sorry for the delay but I have only just now got to doing sounds. I don't know if you ever solved your issue but here is what I have learnt so far:

AnimationTriggers are a bit buggy I think. Either that or I don't understand exactly how they work. I could not get my magneto switches to work at all and my primer switch would only work on the downpress and not the release. If I use local variables in the animation it seems to work but using simulation variables (A: vars) seems to be an issue. There's something weird going on here and it doesn't make any sense. At least there is a workaround.

Here is an example of a 3 position starter switch, off, battery, starter which works well when added to the model behaviors. I'm using keyframes. 0, 10 and 20 for the positions. Two different types of sounds depending on which way the starter is turning.

Code:
        <AnimationTriggers Animation="a582_Starter">         
            <EventTrigger Frame="1" Direction="Forward">
                <SoundEvent WwiseEvent="Starter_Key_1" Action="Play"/>
            </EventTrigger>
            <EventTrigger Frame="11" Direction="Forward">
                <SoundEvent WwiseEvent="Starter_Key_1" Action="Play"/>
            </EventTrigger>
            <EventTrigger Frame="19" Direction="Backward">
                <SoundEvent WwiseEvent="Starter_Key_2" Action="Play"/>
            </EventTrigger>
            <EventTrigger Frame="9" Direction="Backward">
                <SoundEvent WwiseEvent="Starter_Key_2" Action="Play"/>
            </EventTrigger>
        </AnimationTriggers>

This is the sound.xml code you need to add to link the wwiseevent to your soundpack:

Code:
<AnimationSounds>
    <!--This sound will play every time the event "MySound" is sent through the animation-->
    <Sound WwiseData="true" WwiseEvent="fuel_switch" NodeName="Cockpit_fuses" ViewPoint="Inside"/>
    <Sound WwiseData="true" WwiseEvent="12v_switch" NodeName="12V power" ViewPoint="Inside"/>
    <Sound WwiseData="true" WwiseEvent="Starter_Key_1" NodeName="Gauges_Starter_Base" ViewPoint="Inside"/>
    <Sound WwiseData="true" WwiseEvent="Starter_Key_2" NodeName="Gauges_Starter_Base" ViewPoint="Inside"/>
</AnimationSounds>

The use of NodeName places the sound in the 3D space otherwise it defaults to 0,0,0. It can be any part in your model. EDIT: NodeName may not be necessary. According to the SDK the AnimationSounds are placed at the location of the animation they are attached to. I think you would still need to use NodeName if your are using SimVarSounds as described below.

Due to the issues I was having with the magneto switches sounds I used the sound.xml exclusively. There is no sound code (AnimationTriggers) in the model behaviors for the magneto switches. I added the following code to the <SimVarSounds> section in the sound.xml

Code:
    <Sound WwiseData="true" WwiseEvent="radio_beep" Continuous="false" LocalVar="ANTS_RADIO_BEEP"/>
    <Sound WwiseData="true" WwiseEvent="Mag_Switch_Left" Continuous="false" NodeName="Gauges_Magnetoes" ViewPoint="Inside" SimVar="RECIP ENG LEFT MAGNETO" Units="Bool" Index="1"/>
    <Sound WwiseData="true" WwiseEvent="Mag_Switch_Right" Continuous="false" NodeName="Gauges_Magnetoes" ViewPoint="Inside" SimVar="RECIP ENG RIGHT MAGNETO" Units="Bool" Index="1"/>
    <Sound WwiseData="true" WwiseEvent="Push_In" Continuous="false" NodeName="Panel_Fuel_Primer_Mount" ViewPoint="Inside" SimVar="RECIP ENG PRIMER" Units="Bool" Index="1">
      <Range UpperBound="0.5" />
    </Sound>
    <Sound WwiseData="true" WwiseEvent="Push_Out" Continuous="false" NodeName="Panel_Fuel_Primer_Mount" ViewPoint="Inside" SimVar="RECIP ENG PRIMER" Units="Bool" Index="1">
      <Range LowerBound="0.5" />
    </Sound>

There's a bit going on here so I will go through each line. The radio_beep is a local variable of my own making. Any time L:ANTS_RADIO_BEEP changes it will make a radio_beep. I can control the L: var however I like. Note the continuous="false" to stop the sound repeatedly playing.

The next two lines are the magneto switches. Again, any change to the magneto simvars will trigger the sound.

The last two lines are for the Primer switch. Push_in is when the user presses the key, Push_out will automatically release the key as that is how the primer simvar works, about half a second after the primer activates it releases automatically. Very important to have the continuous="false" to stop the sound repeatedly playing. As A:RECIP ENG PRIMER is only ever 1 or 0 (true or false) I set the upper and lower bounds to 0.5. Upperbound means something has to be below that upper limit to be true. Lowerbound means something has to be above that limit to be true.

As in the SDK example, Range LowerBound="10.0" UpperBound="15.0" is true when the variable is between 10 and 15.

LowerBound="60" is true when the variable is above 60.

For reference see "Sound examples" and "sound definitions" in the SDK
 
Last edited:
Sorry for the delay but I have only just now got to doing sounds. I don't know if you ever solved your issue but here is what I have learnt so far:

AnimationTriggers are a bit buggy I think. Either that or I don't understand exactly how they work. I could not get my magneto switches to work at all and my primer switch would only work on the downpress and not the release. If I use local variables in the animation it seems to work but using simulation variables (A: vars) seems to be an issue. There's something weird going on here and it doesn't make any sense. At least there is a workaround.

Here is an example of a 3 position starter switch, off, battery, starter which works well when added to the model behaviors. I'm using keyframes. 0, 10 and 20 for the positions. Two different types of sounds depending on which way the starter is turning.

Code:
        <AnimationTriggers Animation="a582_Starter">       
            <EventTrigger Frame="1" Direction="Forward">
                <SoundEvent WwiseEvent="Starter_Key_1" Action="Play"/>
            </EventTrigger>
            <EventTrigger Frame="11" Direction="Forward">
                <SoundEvent WwiseEvent="Starter_Key_1" Action="Play"/>
            </EventTrigger>
            <EventTrigger Frame="19" Direction="Backward">
                <SoundEvent WwiseEvent="Starter_Key_2" Action="Play"/>
            </EventTrigger>
            <EventTrigger Frame="9" Direction="Backward">
                <SoundEvent WwiseEvent="Starter_Key_2" Action="Play"/>
            </EventTrigger>
        </AnimationTriggers>

This is the sound.xml code you need to add to link the wwiseevent to your soundpack:

Code:
<AnimationSounds>
    <!--This sound will play every time the event "MySound" is sent through the animation-->
    <Sound WwiseData="true" WwiseEvent="fuel_switch" NodeName="Cockpit_fuses" ViewPoint="Inside"/>
    <Sound WwiseData="true" WwiseEvent="12v_switch" NodeName="12V power" ViewPoint="Inside"/>
    <Sound WwiseData="true" WwiseEvent="Starter_Key_1" NodeName="Gauges_Starter_Base" ViewPoint="Inside"/>
    <Sound WwiseData="true" WwiseEvent="Starter_Key_2" NodeName="Gauges_Starter_Base" ViewPoint="Inside"/>
</AnimationSounds>

The use of NodeName places the sound in the 3D space otherwise it defaults to 0,0,0. It can be any part in your model.

Due to the issues I was having with the magneto switches sounds I used the sound.xml exclusively. There is no sound code (AnimationTriggers) in the model behaviors for the magneto switches. I added the following code to the <SimVarSounds> section in the sound.xml

Code:
    <Sound WwiseData="true" WwiseEvent="radio_beep" Continuous="false" LocalVar="ANTS_RADIO_BEEP"/>
    <Sound WwiseData="true" WwiseEvent="Mag_Switch_Left" Continuous="false" NodeName="Gauges_Magnetoes" ViewPoint="Inside" SimVar="RECIP ENG LEFT MAGNETO" Units="Bool" Index="1"/>
    <Sound WwiseData="true" WwiseEvent="Mag_Switch_Right" Continuous="false" NodeName="Gauges_Magnetoes" ViewPoint="Inside" SimVar="RECIP ENG RIGHT MAGNETO" Units="Bool" Index="1"/>
    <Sound WwiseData="true" WwiseEvent="Push_In" Continuous="false" NodeName="Panel_Fuel_Primer_Mount" ViewPoint="Inside" SimVar="RECIP ENG PRIMER" Units="Bool" Index="1">
      <Range UpperBound="0.5" />
    </Sound>
    <Sound WwiseData="true" WwiseEvent="Push_Out" Continuous="false" NodeName="Panel_Fuel_Primer_Mount" ViewPoint="Inside" SimVar="RECIP ENG PRIMER" Units="Bool" Index="1">
      <Range LowerBound="0.5" />
    </Sound>

There's a bit going on here so I will go through each line. The radio_beep is a local variable of my own making. Any time L:ANTS_RADIO_BEEP changes it will make a radio_beep. I can control the L: var however I like. Note the continuous="false" to stop the sound repeatedly playing.

The next two lines are the magneto switches. Again, any change to the magneto simvars will trigger the sound.

The last two lines are for the Primer switch. Push_in is when the user presses the key, Push_out will automatically release the key as that is how the primer simvar works, about half a second after the primer activates it releases automatically. Very important to have the continuous="false" to stop the sound repeatedly playing. As A:RECIP ENG PRIMER is only ever 1 or 0 (true or false) I set the upper and lower bounds to 0.5. Upperbound means something has to be below that upper limit to be true. Lowerbound means something has to be above that limit to be true.

As in the SDK example, Range LowerBound="10.0" UpperBound="15.0" is true when the variable is between 10 and 15.

LowerBound="60" is true when the variable is above 60.

For reference see "Sound examples" and "sound definitions" in the SDK
I'm working on this right now and just came across your post; fantastic thread by the way thank you for sharing. My findings have been similar with using the templates animation events; even using the derived values for simvars seems pretty dodgy at the moment. Magnetos also did not work for me whereas most of switch templates did

I've used a similar code in my model.xml for animation triggers, however I'm wondering where should the animation triggers be placed? I made a seperate subsection at the end of my xml called <ModelBehaviors> and put my animation triggers in there, however upon doing so it seems to have broken all of my <ModelInfo>.

Is this incorrect?

Code:
<ModelBehaviors>


<AnimationTriggers Animation="AIRFRAME_Door">
    <EventTrigger NormalizedTime="0.1" Direction="Both">
        <SoundEvent WwiseEvent="MetalSwitch1" Action="Play"/>
    </EventTrigger>
    </AnimationTriggers>
  
    <AnimationTriggers Animation="AIRFRAME_DoorHandle">
        <EventTrigger NormalizedTime="0.25" Direction="Forward">
            <SoundEvent WwiseEvent="MetalSwitch2" Action="Play"/>
        </EventTrigger>
        <EventTrigger NormalizedTime="0.3" Direction="Backward">
            <SoundEvent WwiseEvent="MetalSwitch1" Action="Play"/>
        </EventTrigger>
    </AnimationTriggers>
  
</ModelBehaviors>
 
Last edited:
Nevermind, I've just answered my own question. I've placed the code in the wrong place, it should of course go in the component block of the animation that it belongs to, not a seperate <ModelBehavior> section. Again, fantastic thread and thanks for sharing.

If this is helpful to anyone, here is a sample of my aircraft door definition, complete with a custom event call and some simple animation triggers:

XML:
<Component ID="AIRFRAME_DoorHandle" Node="AIRFRAME_DoorHandle">

                <UseTemplate Name="ASOBO_GT_Anim_Code">
                    <ANIM_NAME>AIRFRAME_Door</ANIM_NAME>
                    <PART_ID>AIRFRAME_Door</PART_ID>
                    <ANIM_LENGTH>20</ANIM_LENGTH>
                    <ANIM_CODE>
                        (L:AIRFRAME_DOOR, percent over 100) 20 *
                    </ANIM_CODE>
                    <ANIM_LAG>10</ANIM_LAG>
                </UseTemplate>

                <AnimationTriggers Animation="AIRFRAME_Door">
                <EventTrigger NormalizedTime="0.1" Direction="Both">
                    <SoundEvent WwiseEvent="MetalSwitch1" Action="Play"/>
                </EventTrigger>
                <EventTrigger NormalizedTime="0.25" Direction="Forward">
                    <SoundEvent WwiseEvent="MetalSwitch2" Action="Play"/>
                </EventTrigger>
                <EventTrigger NormalizedTime="0.3" Direction="Backward">
                    <SoundEvent WwiseEvent="MetalSwitch1" Action="Play"/>
                </EventTrigger>
                </AnimationTriggers>

                <UseTemplate Name="ASOBO_GT_MouseRect">
                    <DRAG_SCALAR>0.005</DRAG_SCALAR><!-- for input_actions base sensitivity -->
                    <HIGHLIGHT_NODE_ID>AIRFRAME_DoorHandle</HIGHLIGHT_NODE_ID>
                    <TOOLTIPID>%Toggle Door Lock%</TOOLTIPID>
                    <MOUSEFLAGS>LeftSingle</MOUSEFLAGS>
                    <CURSOR>Grab</CURSOR>
                    <EVENTID>69649</EVENTID>
                </UseTemplate>      
     
            </Component>
 
Last edited:
ADDING CHECKLIST HIGHLIGHTS

I need to add this bit as I've only just got around to creating a checklist for my airplane. To get parts to be highlighted in blue in the checklists you need to add a PartID to the Component.

Code:
        <Component ID="a582_Primer" Node="a582_Primer">   
            <UseTemplate Name="ASOBO_GT_Part_ID">
                <PART_ID>CL_HIGHLIGHT_Primer</PART_ID>
            </UseTemplate>           
        </Component>

Node is the name of the part in Blender (or your modeling program). PART_ID is your unique name and is the reference you use in the checklist. In your checklist.xml you add this to your Checkpoint:

Code:
<Instrument Id="CL_HIGHLIGHT_Primer"/>
<ForceCamera name="Radio"/>

So, the Node matches the model part name, the Instrument Id should match the PART_ID and the ForceCamera matches the Title in the CameraDefinition in cameras.cfg.

Also note that it seems like the Instrument Id needs to exist in your model for the ForceCamera to work. If there is no matching Instrument Id then I have found that the ForceCamera does not show the eye icon in the checklist. Also note, if you use a transparent part as a mouse zone area then this will not highlight because it's transparent.
 
I'm trying to get an animation to play based on player proximity using what's been posted in this thread. MSFS is accepting the script and the console is not throwing any errors, but the animation does not play when the parameters of the ANIM_CODE has been fulfilled in game. I'm currently implementing this as a standard Scenery Object, should I be implementing this as a SimObject instead? If that doesn't matter then what have I done wrong in my code?
Eventually I want to use this for hangar doors, but for now, I'm testing it with a simple bouncing box animation.

Full Script:

XML:
<?xml version="1.0" encoding="utf-8" ?>

<Behaviors>
        <Include ModelBehaviorFile="Asobo\Common.xml"/>
        <Include ModelBehaviorFile="Asobo\Generic.xml"/>
       
</Behaviors>

<ModelInfo version="1.1" guid="{a3f158b2-1484-37d0-3197-b3f3dd9ae02e}">

<Component ID="Box_Bouncing" Node="Box001">

                <UseTemplate Name="ASOBO_GT_Anim_Code">
                    <ANIM_NAME>Box_Bounce</ANIM_NAME>
                    <PART_ID>Box_Bounce</PART_ID>
                    <ANIM_LENGTH>600</ANIM_LENGTH>
                    <ANIM_CODE>
                    (A:PLANE LATITUDE, degrees) 0.60317980207113097713 ;
                    (A:PLANE LATITUDE, degrees) 0.60316811367606859573 &lt;
                    (A:PLANE LONGITUDE, degrees) 2.6317747681133729643 ;
                    (A:PLANE LONGITUDE, degrees) 2.6317880625657732452 &lt;
                    and
                    and
                    and -->
                    </ANIM_CODE>
                </UseTemplate>
   
            </Component>

</ModelInfo>

I've also tried a simpler condition to no avail


XML:
<ANIM_CODE>
(A:PLANE ALTITUDE, METERS) 1000 &lt;
</ANIM_CODE>



Really appreciate help on this to get this to work! Cheers!
 
Converted the asset to a SimObject and was able to successfully implement it in game with no errors. Though I can't get any animation working using this ModelBehaviour method. I can only get the animation to play on a loop using the simple animation implementation. I've tried alternative approaches such as using a BlendTreeState, but the animation won't play at all unless I use the simple animation implementation.

I've simplified the code and removed any conditions and Anim_Code so it SHOULD play by default.



XML:
<ModelInfo version="1.1" guid="{a3f158b2-1484-37d0-3197-b3f3dd9ae02e}">

<LODS>
<LOD MinSize="0" ModelFile="Test_Box_Bounce.gltf"/>
</LODS>
    
<Behaviors>
    
<Include ModelBehaviorFile="Asobo\Common.xml"/>
<Include ModelBehaviorFile="Asobo\Generic.xml"/>
    
        
 <Component ID="Box_Bouncing" Node="Box001">

    <UseTemplate Name="ASOBO_GT_Anim_Code">
     <ANIM_NAME>Box_Bounce</ANIM_NAME>
     <PART_ID>Box_Bounce</PART_ID>
     <ANIM_LENGTH>600</ANIM_LENGTH>

     </UseTemplate>
    
         </Component>
                
    </Behaviors>
    
</ModelInfo>


I've used alternatives such as assigning the GUID myself. Still doesn't work regardless.

XML:
<Animation name="Box_Bounce" guid="1723ffc6-0760-4c84-9ba1-220ffcae533f" type="Standard"/>

I'm clearly missing something, what that is, no idea so I'm left now scratching my head!!
 
Ok, without the data you r using, I cannot help. You can contact me on discord GuidoH4520# if you like and you can send files or screenshots of the folder structure of you Simobject directory and it's sub folders. You'll find the files in the zip that r required for the sim object. In my case the hangar doors of the ch76main object are opening when you hide the helicopter stick (L:SHOW_CYCLIC)
Should look like this:
1630600572266.png
 

Attachments

Last edited:
Converted the asset to a SimObject and was able to successfully implement it in game with no errors. Though I can't get any animation working using this ModelBehaviour method. I can only get the animation to play on a loop using the simple animation implementation. I've tried alternative approaches such as using a BlendTreeState, but the animation won't play at all unless I use the simple animation implementation.

I've simplified the code and removed any conditions and Anim_Code so it SHOULD play by default.



XML:
<ModelInfo version="1.1" guid="{a3f158b2-1484-37d0-3197-b3f3dd9ae02e}">

<LODS>
<LOD MinSize="0" ModelFile="Test_Box_Bounce.gltf"/>
</LODS>
  
<Behaviors>
  
<Include ModelBehaviorFile="Asobo\Common.xml"/>
<Include ModelBehaviorFile="Asobo\Generic.xml"/>
  
      
<Component ID="Box_Bouncing" Node="Box001">

    <UseTemplate Name="ASOBO_GT_Anim_Code">
     <ANIM_NAME>Box_Bounce</ANIM_NAME>
     <PART_ID>Box_Bounce</PART_ID>
     <ANIM_LENGTH>600</ANIM_LENGTH>

     </UseTemplate>
  
         </Component>
              
    </Behaviors>
  
</ModelInfo>


I've used alternatives such as assigning the GUID myself. Still doesn't work regardless.

XML:
<Animation name="Box_Bounce" guid="1723ffc6-0760-4c84-9ba1-220ffcae533f" type="Standard"/>

I'm clearly missing something, what that is, no idea so I'm left now scratching my head!!
What I can tell u right away is, that anim length is a persentage value bitween 1 and 100. It's not the number of frames like in blender or 3DSMax. So change this first.
2nd: <Component ID="Box_Bouncing" Node="Box001"> the names need to be the same names in your blender main objects. So the mesh name must be Box_Bouncing and the name of the highest object in blender must be Box001
 
Converted the asset to a SimObject and was able to successfully implement it in game with no errors. Though I can't get any animation working using this ModelBehaviour method. I can only get the animation to play on a loop using the simple animation implementation. I've tried alternative approaches such as using a BlendTreeState, but the animation won't play at all unless I use the simple animation implementation.

I've simplified the code and removed any conditions and Anim_Code so it SHOULD play by default.



XML:
<ModelInfo version="1.1" guid="{a3f158b2-1484-37d0-3197-b3f3dd9ae02e}">

<LODS>
<LOD MinSize="0" ModelFile="Test_Box_Bounce.gltf"/>
</LODS>
   
<Behaviors>
   
<Include ModelBehaviorFile="Asobo\Common.xml"/>
<Include ModelBehaviorFile="Asobo\Generic.xml"/>
   
       
<Component ID="Box_Bouncing" Node="Box001">

    <UseTemplate Name="ASOBO_GT_Anim_Code">
     <ANIM_NAME>Box_Bounce</ANIM_NAME>
     <PART_ID>Box_Bounce</PART_ID>
     <ANIM_LENGTH>600</ANIM_LENGTH>

     </UseTemplate>
   
         </Component>
               
    </Behaviors>
   
</ModelInfo>


I've used alternatives such as assigning the GUID myself. Still doesn't work regardless.

XML:
<Animation name="Box_Bounce" guid="1723ffc6-0760-4c84-9ba1-220ffcae533f" type="Standard"/>

I'm clearly missing something, what that is, no idea so I'm left now scratching my head!!
Remove PART_ID for a start because it's not used.

Secondly, you don't have any animation code (ANIM_CODE). There needs to be some sort of code otherwise it will show keyframe 0 all the time (ie it won't animate). The result of the ANIM_CODE equals the keyframe. If you want your animation to step through 600 keyframes then you manually need to add some counter to your ANIM_CODE to do that. That's a difference between Standard and Sim animations. Standard automatically handles the counter while Sim doesn't. You code using plane position is only half the solution (there's no counter). Although, I doubt it will work anyway as I doubt it uses the player position and will most likely use the model position instead. Remove the aircraft position and put a counter in there first. Try to get that working first.
 
Hi, I'm doing a stationary aircraft and I want it spawns sometimes with the main door open, and other times closed. What do I need to write inside <ANIM_CODE> to write randomly 0 or 1?

XML:
<UseTemplate Name="ASOBO_GT_Anim_Code" Node="MAIN_DOOR">
    <ANIM_NAME>MAIN_DOOR_ANIM</ANIM_NAME>
    <ANIM_LENGTH>1</ANIM_LENGTH>
    <ANIM_CODE>¿?</ANIM_CODE>
</UseTemplate>
 
Hi, I'm doing a stationary aircraft and I want it spawns sometimes with the main door open, and other times closed. What do I need to write inside <ANIM_CODE> to write randomly 0 or 1?
<ANIM_CODE>Here you write the conditions under which the animation will be produced</ANIM_CODE>
You can set a variable for which the animation will be triggered,
XML:
<ANIM_CODE>(L:MAIN_DOOR_ANIM, bool)</ANIM_CODE>
and write the code of conditions and data separately in the model or right here the entire conditions with the animation trigger code or Mouse
 
Last edited:
Thanks :) I think I'm not very clear with this. There are no conditions neither trigger. The animation with trigger is used when I pilot the aircraft (using model/aircraft.xml). But now I'm trying to do an AI stationary version (using model.ai/aircraft.xml), without triggers, the aircraft only spawns parked, and I'm trying it spawns sometimes with the door open and other times with the door closed.

(MAIN_DOOR_ANIM, bool) Do this returns 0 or 1 randomly?

Like in C++
C++:
int random_number = rand() % 1;

If I write <ANIM_CODE>1</ANIM_CODE> the plane spawns with the door open
If I write <ANIM_CODE>0</ANIM_CODE> the plane spawns with the door closed

I need somthing like <ANIM_CODE>int random_number = rand() % 1;</ANIM_CODE>

Don't know if is possible here.
 
Last edited:
Thanks :) I think I'm not very clear with this. There are no conditions neither trigger. The animation with trigger is used when I pilot the aircraft (using model/aircraft.xml). But now I'm trying to do an AI stationary version (using model.ai/aircraft.xml), without triggers, the aircraft only spawns parked, and I'm trying it spawns sometimes with the door open and other times with the door closed.

(MAIN_DOOR_ANIM, bool) Do this returns 0 or 1 randomly?

I need something like in C++
C++:
int random_number = rand() % 1;

If I write <ANIM_CODE>1</ANIM_CODE> the plane spawns with the door open
If I write <ANIM_CODE>0</ANIM_CODE> the plane spawns with the door closed

Don't know if is possible here.
In any case, you will have to make a variable into which you will set the values to True or False, 0 or 1. In the simulator, this is written to local or global variables with the appropriate grammar and syntax described in the SDK, otherwise the code animation will not work.
If you need a random version, then in any language in which the code will be written, you need to set and pass values to the variable.
 
In any case, you will have to make a variable into which you will set the values to True or False, 0 or 1. In the simulator, this is written to local or global variables with the appropriate grammar and syntax described in the SDK
That's what I tried before write here, using RPN I've tried to generate random value with the special operator "rand", but it only generate float number between 0 and 1 not integer. The operator "seed" it's unclear for me and don't know how to use here. There aren't examples how to use those operators to asign a ramdom value to a variable and I am very lost.

I've open a new thread for not mix with @Anthony31 thread. https://www.fsdeveloper.com/forum/t...r-1-in-xml-for-ai-stationary-aircraft.456552/
 
Is it possible to call with XML or RPN the value of another node? I mean something like this:
XML:
<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>(Node.xxx.value)</ANIM_CODE></UseTemplate>
    <UseTemplate Name="zzz" Node="zzz">.....<ANIM_CODE>(Node.xxx.value)</ANIM_CODE></UseTemplate>
    <UseTemplate Name="uuu" Node="uuu">.....<ANIM_CODE>(Node.xxx.value)</ANIM_CODE></UseTemplate>
</Component>

I've tried this but doesn't work properly:
XML:
<Component ID="Doors">
    <UseTemplate Name="xxx" Node="xxx">.....<ANIM_CODE>A:PLANE LATITUDE, degree latitude) (A:PLANE LONGITUDE, degree longitude) % 5 symb 4 > (&gt;L:myVar)</ANIM_CODE></UseTemplate>
    <UseTemplate Name="yyy" Node="yyy">.....<ANIM_CODE>(L:myVar)</ANIM_CODE></UseTemplate>
    <UseTemplate Name="zzz" Node="zzz">.....<ANIM_CODE>(L:myVar)</ANIM_CODE></UseTemplate>
    <UseTemplate Name="uuu" Node="uuu">.....<ANIM_CODE>(L:myVar)</ANIM_CODE></UseTemplate>
</Component>
 
Is it possible to call with XML or RPN the value of another node? I mean something like this:
XML:
<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>(Node.xxx.value)</ANIM_CODE></UseTemplate>
    <UseTemplate Name="zzz" Node="zzz">.....<ANIM_CODE>(Node.xxx.value)</ANIM_CODE></UseTemplate>
    <UseTemplate Name="uuu" Node="uuu">.....<ANIM_CODE>(Node.xxx.value)</ANIM_CODE></UseTemplate>
</Component>

I've tried this but doesn't work properly:
XML:
<Component ID="Doors">
    <UseTemplate Name="xxx" Node="xxx">.....<ANIM_CODE>A:PLANE LATITUDE, degree latitude) (A:PLANE LONGITUDE, degree longitude) % 5 symb 4 > (&gt;L:myVar)</ANIM_CODE></UseTemplate>
    <UseTemplate Name="yyy" Node="yyy">.....<ANIM_CODE>(L:myVar)</ANIM_CODE></UseTemplate>
    <UseTemplate Name="zzz" Node="zzz">.....<ANIM_CODE>(L:myVar)</ANIM_CODE></UseTemplate>
    <UseTemplate Name="uuu" Node="uuu">.....<ANIM_CODE>(L:myVar)</ANIM_CODE></UseTemplate>
</Component>
I'm not sure what you are trying to do but this has syntax errors:

Code:
<ANIM_CODE>A:PLANE LATITUDE, degree latitude) (A:PLANE LONGITUDE, degree longitude) % 5 symb 4 > (&gt;L:myVar)</ANIM_CODE>

This might work better:
Code:
<ANIM_CODE>(A:PLANE LATITUDE, degree latitude) (A:PLANE LONGITUDE, degree longitude) % 5 symb 4 (&gt;L:myVar)</ANIM_CODE>
 
Back
Top