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

FSXA Gun animation custom code

Messages
246
Country
southafrica
Hi there,
In FS9, I've had a code that had a visibility condition that show a certain set of parts when the tailhook was at key 99. How do Iincorportae that(and custom codes in general) in FSXA?

Here is my code:
Code:
<!-- Gun animation   -->

	<part> 
		<name>Optic_animater</name>
          <visible_in_range>
         <parameter>
			<code>

(A:TAILHOOK POSITION,percent) 99 &gt;

			</code>
         </parameter>
        <minvalue>1</minvalue>  
      </visible_in_range>
		</part> 
		
	 <part>
		 <name>Gun_animater</name> 
		 <Copy>Optic_animater</Copy>
	 </part>
	 
	<part> 
		<name>Static_optics</name>
       <visible_in_range>
         <parameter>
			<code>
(A:TAILHOOK POSITION,percent) 99 &lt;

			</code>
         </parameter>
        <minvalue>1</minvalue>  
      </visible_in_range>
	</part> 
	
	 <part>
		 <name>Static_Gun</name> 
		 <Copy>Static_optics</Copy>
	 </part>
 
Translate the existing script into the FSX format...

Here is a "generic" <Visibility> script for FSX. Substitute your own names as necessary:

Code:
  <PartInfo>
    <Name>MyPart_vis</Name>
    <Visibility>
      <Parameter>
        <Code>
          (A:MyCondition,bool)
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

Your first one for example:

Code:
  <PartInfo>
    <Name>Optic_animater</Name>
    <Visibility>
      <Parameter>
        <Code>
          (A:TAILHOOK POSITION,percent) 99 &gt;
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

NOTE: Since the above entries have only a <Visibility> section, they do not need a corresponding
<Animation name=xxx, guid=yyy,.../> section at all!
 
Last edited:
Thank you Mr Bill,

Where do I add that code, as the FSX SDK don't have the MakeMDL.xml?
 
Your parts XML sheet will be in the FSX SDK.

Mine for instance is located here;

C:\Program Files\Microsoft Games\Microsoft Flight Simulator X SDK\SDK\Environment Kit\Modeling SDK\bin

Name of the file is modeldef.xml



Note, this is where you must have GUID's ready and they must be fresh, not copied as that will crash the system.

You will have two entries. Top is the GUID and basics with the amount of KF's in the animation. Bottom section is the code blocks. I place my 'new' scripts at the top of the code blocks so that if they are wrong, it crashes the entire sheet, letting me know its not working.


Be sure to use custom section notes so that you keep your planes special animations divided. Helps me alot when setting up a plane.



Bill



EXAMPLE OF TOP SECTION IN PARTS SHEET


<Animation name="ave_pilot_selector" guid="25CD48DC-E813-4817-902E-0E8D2C229521" length="100" type="Sim" typeParam2="lhc_pilot_selector" typeParam="AutoPlay" />


EXAMPLE OF THE BOTTOM SCRIPT SECTION; same part


<!-- AVELINA PARTS SECTION -->

<PartInfo>
<Name>ave_pilot_selector</Name>
<Animation>
<Parameter>
<Code>
(L:AVEpilot press,bool) 10 *
</Code>
<Lag>100</Lag>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>Pilot Selector System (%((L:AVE PILOT SHOW,enum))%{case}%{:0}Male)%{:1}Female)%{:2}Couple)%{:3}Empty)%{End}</TooltipText>
<MouseFlags>LeftSingle+LeftRelease</MouseFlags>
<CallbackCode>(M:Event) 'LeftSingle' scmp 0 == if{ (L:PILOT SHOW,enum) 1 + 4 % (>L:PILOT SHOW,enum) 1 (>L:XMLSND38,enum) 1 (>L:AVEpilot press,bool) } (M:Event) 'LeftRelease' scmp 0 == if{ (>L:AVEpilot press,bool) }</CallbackCode>
</MouseRect>
</PartInfo>
 
And always always always keep backups of your XML sheet, especially with FSX. And keep copies somewhere, like on a flash drive, etc.

What I do is copy the file, and rename it with the date at the end so that I can go back to certain dates if needed.
 
Just to make it crystal clear, if you only have a <Visibility> condition, you do not need any GUID at all!

Also, there's no reason why all the <Animation.../> entries have to be at the top of the file either. You can -if you wish- keep 'em just above the <PartInfo> entries. Some folks find it more convenient than having to constantly scroll up and down in a very long file:
Code:
<!-- AVELINA PARTS SECTION -->

<Animation name="ave_pilot_selector" guid="25CD48DC-E813-4817-902E-0E8D2C229521" length="100" type="Sim" typeParam2="lhc_pilot_selector" typeParam="AutoPlay" />

<PartInfo>
     <Name>ave_pilot_selector</Name>
     ...
     et cetera
</PartInfo>
 
Last edited:
Thanks for all the helpfull info!

in FSX, is the tailhook condition still the same as in FS9, like this:

(A:TAILHOOK POSITION,percent) 99 &lt;
 
Hi,

They are all listed in the FSX SDK, just as they were for FS9. I would look there.

That said, there are VERY few that are different for FSX (one or two). There are some new ones for FSX though.
 
Hi,

They are all listed in the FSX SDK, just as they were for FS9. I would look there.

That said, there are VERY few that are different for FSX (one or two). There are some new ones for FSX though.

Thank you Sir,
I have checked the SDK, and the tailhook variable are the same (TAILHOOK POSITION Percent tail hook extended Percent Over 100 Y ) but for some reason my anination dont work. I will double check it and see if I can figure something out :)

EDIT
It may be because my animation is rotational. Maybe it is because I dont tag the rotation correctly with the animation tool?

Cheers,

Jakes
 
Last edited:
Ok, found the problem why my animation didn't work - Had no hydraulic value in the aircraft.cfg. I've set it to 500 and now it works.
BUT now my Tick18 animations don't work. I have tried to tag them with the ambient tag, with the keyframes from 0 to 1000, with no luck. I also tried to use the Tick19 > Ambient button in the animation manager, also didn't work :(
any help perhaps?
 
FSX requires more than a start/stop key being set. You need to set several "in-between" keys before the animations will work, especially when using the "Ambient" animation tag.
 
FSX requires more than a start/stop key being set. You need to set several "in-between" keys before the animations will work, especially when using the "Ambient" animation tag.

Thanks for the reply. I have almost 10 keys inbetween. DO I have to somehow tag the in the animation manager?
 
Back
Top