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

Plese Help

Messages
8
Country
us-california
I need to know how people get "parts" of an aircraft to disappear using key commands. Seems I remember seeing an aircraft that had wheel chocks that would disappear when a key was hit. I'm using gmax. Can someone help me on this?

Doc
 
This Code is made by Bill Leaming for a door they needed by Bill (the man with a) Lionheart - a little changes made by me, maybe that it will work:

It (maybe) works with a switch.

Code:
<part>
   <name>wheel_chocks_switch</name>
      <animation>
	<parameter>
	  <code>(L:wheel_chocks_visible, bool) 50 *</code>
 	  <lag>400</lag>
	</parameter>
      </animation>
   <mouserect>
	<cursor>Hand</cursor>
   <tooltip_text>Hide Wheel Chocks</tooltip_text>
   <callback_code>(L:wheel_chocks_visible, bool) ! (>L:wheel_chocks_visible, bool)</callback_code>
   </mouserect>
</part>

<part> 
 <name>wheel_chocks</name>
    <visible_in_range>
       <parameter>
          <code>(L:wheel_chocks_visible, bool)</code>
       </parameter>
       <minvalue>-1</minvalue>
       <maxvalue>0</maxvalue>
    </visible_in_range>
</part>

The Code is from here:
http://www.fsdeveloper.com/forum/showthread.php?t=11721&highlight=disappear

Maybe *Father* Bill will wrote one or two lines additional
if it will not work. :o
 
Last edited:
Hi Sandra,

Thanks for the response!! One question though, where would I be adding this code? Object properties? And does this assign a switch? I've got some, but very little progamming experience and I've only used gmax in it's native state, without modifiying any parameters.

Thanks,

Doc
 
Last edited:
So far as I know....
you must edit the makemdl.parts.xml,
make a copy of them to anywhere and then open with Editor,

scroll down to the last row
hit ENTER 2 Times and paste the code from above at this Position in the
xml and close them, hit yes when asking you.

And then...
Huuuu I dont know.

:teacher: *Papa* Bill Leaming help us please. :o :rotfl:
 
Hi Sandra,

I put the code into the makendl.xml and attempted to create several switches with no luck. Not much of a vc guy! lol Anyhow, I'm still lost on how to get this part to disappear by a via key command.

docII
 
Hi Sandra,

I put the code into the makendl.xml and attempted to create several switches with no luck. Not much of a vc guy! lol Anyhow, I'm still lost on how to get this part to disappear by a via key command.

docII

Okay, let us start with something very, very simple. Once this is working, then we can move on to something more complex...

Here is a simple XML script that will cause your chocks to disappear when the engine is started:
Code:
   <part>
	<name>no_chocks</name>
	    <visible_in_range>
		<parameter>
			<code>(A:GENERAL ENG PCT MAX RPM:1, percent)</code>
		</parameter>
		<minvalue>-1</minvalue>
		<maxvalue>1</maxvalue>
     	    </visible_in_range>
   </part>

Understand that this is valid for FS2004 (FS9) only. FSX's XML script is much different.

First, in GMax create a tiny box in the center of your a/c using the keyboard entry method. Make the dimensions 0.01m x 0.01m x 0.01m. NAME the box "no_chocks" (without the quote marks of course).

This box named no_chocks will be the "control node" for the XML script. When compiled, the XML script in makemdl.parts.xml will be added to this "control node" and everything Linked to it as children will be made visible/invisible based on the conditions set in the XML script.

In GMax, select your chock objects, click on the Link button, then select the no_chocks object as the parent. Be sure to click on the Select Arrow button to disable the Link operation! ;)

Now, after exporting to a new model, your chocks should disappear as soon as you start the engine!

When you've successfully manage to get this working, come back and I'll explain WHY and HOW it works. Only then can we move on to the next lesson... :teacher:
 
DocII....

I seriously suggest that you do this in the order presented.

Already I'm (re)learning this!
 
Understand that this is valid for FS2004 (FS9) only. FSX's XML script is much different.
Would you mind demonstrating an FSX version with this to show the differences? Might save trouble in the future for someone trying to accomplish the same thing, but with FSX instead of FS9... :)
 
Ok, since this seems to be a little more complicated that I originally thought, I should fully explain exactly what I'm trying to accomplish.

The part I want to disappear is a missle. What I want to do is have the missle disappear after I hit a launch button. I will then have an effect leave the point where the missle was and shoot out from there. I'm sorry for not explaining this earlier, but I didn't want trouble anyone with the specifics. I thought that if I could just get the missle to disappear like some aircraft I've seen with wheel chocks that would be simple enough.

So after saying all of that, how would I get the missle to disappear via key stroke?

BTW: The missle is on a ship, and it I've already got it coming up out of the deck {via spoiler tag} and linked to the missle rails when they turn {via flaps key} So I've got everything working up to this point.

Thanks for your time on this folks!!

Doc
 
Would you mind demonstrating an FSX version with this to show the differences? Might save trouble in the future for someone trying to accomplish the same thing, but with FSX instead of FS9... :)
Okay. Here are examples of XML script that will hide/show the pilot's yoke in a virtual cockpit. Both examples have two scripts.

The first script is for the object to which the "mouse click" is assigned. It can be anything you wish to use. Typically I will pick a non-functional part such as an air vent, but it could just as easily be anything else that remains in view all the time.

The second script is for the yoke object (and all it's dependent parts) itself, which will hide/show the object.

FS9 Version:
Code:
<!--          Pilot's Yoke XML Scripts     -->
<part> 
	<name>hide_pilots_yoke</name> 
		<mouserect>
			<cursor>Hand</cursor>
			<tooltip_text>Hide Pilot's Yoke</tooltip_text>
			<callback_code>
				(L:YokePilot,bool) ! (&gt;L:YokePilot,bool)
			</callback_code>
		</mouserect>
   </part> 
   <part> 
	    <name>yoke_pilot</name>
	    <visible_in_range>
	     	<parameter>
			<code>(L:YokePilot,bool)</code>
	     	</parameter>
	  <minvalue>-1</minvalue>
	  <maxvalue>0</maxvalue>
	    </visible_in_range>
   </part>
FSX Version:
The most obvious difference between the FS9 and FSX versions is the requirement in FSX of having an "Animation/GUID Name" entry for every "animation control name" that is scripted. Technically, any script that is no more than a simple <Visibility> does not require a corresponding "Animation/GUID Name," but I've included it here anyway for the sake of consistency. :D

Related to the above, but not evident from the script alone is this:

In FS9, the script's <name> is also the part's name in the 3d source file (Max/GMax/FSDS).

In FSX, the script's <Name> is associated with the part's name using the Animation Tool. The actual part's name can be anything at all. It is unimportant except for human consumption/understanding!

The next most obvious difference is the strict requirement of Capitalization for the various <Tag> entries, as well as the names and/or spelling differences...

...for example, <part> is now <PartInfo>, <mouserect> is now <MouseRect>, and so forth.

The least obvious difference is more subtle. The <visible_in_range> does not work in FSX despite the insistence of the FSK SDK that it does!

On the other hand, the FSX solution is actually simpler and easier to understand, so I think it's a pretty fair exchange, all thing considered. More on this after the FSX script example.
Code:
<!--          Pilot's Yoke Animation/GUID Name Definitions     -->
    <Animation name="hide_pilots_yoke" guid="54647385-cff7-679c-a657-9b9cd33e4f12" length="100" type="Sim" typeParam2="hide_pilots_yoke" typeParam="AutoPlay" />
    <Animation name="yoke_pilot" guid="54577386-cff7-679c-a658-ab9cd33e4f13" length="100" type="Sim" typeParam2="yoke_pilot" typeParam="AutoPlay" />

<!--          Pilot's Yoke XML Scripts     -->
   <PartInfo> 
	<Name>hide_pilots_yoke</Name> 
		<MouseRect>
			<Cursor>Hand</Cursor>
			<TooltipText>Hide Pilot's Yoke</TooltipText>
			<CallbackCode>
				(L:YokePilot,bool) ! (&gt;L:YokePilot,bool)
			</CallbackCode>
		</MouseRect>
   </PartInfo> 

   <PartInfo> 
   	<Name>yoke_pilot</Name>
    	<Visibility>
           	<Parameter>
      		<Code>(L:YokePilot,bool) 0 &gt; if{ 0 } els{ 1 }</Code>
           	</Parameter>
    	</Visibility>
   </PartInfo>

Now, what about the actual visibility conditions, I hear folks asking...

In FS9, we are required to define a range within which something will be valid, hence:
Code:
	    <visible_in_range>
	     	<parameter>
			<code>(L:YokePilot,bool)</code>
	     	</parameter>
	  <minvalue>-1</minvalue>
	  <maxvalue>0</maxvalue>
	    </visible_in_range>

In the above, the "part" will appear only if the control variable (L:YokePilot,bool) is zero. As a result, we must set the minimum value to -1 and the maximum value to 0 (zero). This ackward situation is because we cannot have a <maxvalue> tag by itself.

In FSX, we use a different means to achieve the same end result.
Code:
    	<Visibility>
           	<Parameter>
      		<Code>(L:YokePilot,bool) 0 &gt; if{ 0 } els{ 1 }</Code>
           	</Parameter>
    	</Visibility>
In this case, we are explicitly setting the result to either 0 (zero) or 1 (one) based on the value of the (L:YokePilot,bool) variable.

If (L:YokePilot,bool) is greater than 0 (zero), then the <Visibility> tag is set to 0 (zero).

If (L:YokePilot,bool) is NOT greater than 0 (zero), then the <Visibility> tag is set to 1 (one).

Now this might seem a bit bass-ackwards, but trust me it is required... You see, by default all (L:variable,unit)s are initialized to 0 (zero) when the aircraft is first loaded. If we didn't have the <Visibility> tag scriptrd this way, then the pilot's yoke would be invisible when the user first sees the virtual cockpit, which could be very, very disconcerting to say the least...:rotfl:

I certainly hope that the above is useful, and that I've explained it well... :teacher:
 
your check is in the mail... ;)

I presume that the list of conditions is in the SDK? (*as far as AI modeling goes, it'd be a simple list of engine on/off, lights on/off, etc -- right?*)
 
your check is in the mail... ;)

I presume that the list of conditions is in the SDK? (*as far as AI modeling goes, it'd be a simple list of engine on/off, lights on/off, etc -- right?*)

Yes, the list of read variables is in the SDK's Core Utilities\Variables folder, or that path if you have the .chm version from the Acceleration SDK.

You are correct, there are only a few variables that may be used with AI a/c.
 
Back
Top