Military AI Works • AI KC-30A - Page 2
Page 2 of 6

Re: AI KC-30A

Posted: 31 Dec 2009, 04:51
by MIKE JG
Hang in there, we'll see if one of the other guys knows a better code to use.

Re: AI KC-30A

Posted: 31 Dec 2009, 09:00
by Firebird
OK, now I may be throwing some confusion in here, if so tell me to shut up, but I had a look at Nick's makemdl in particular at his apache flir.
he actually has two entries :-

Code: Select all

<part>
<name>apache_flir</name>
<visible_in_range>
<parameter>
<code>
(A:LIGHT NAV,number)
</code>
</parameter> 
<minvalue>-1</minvalue>
<maxvalue>0</maxvalue>
</visible_in_range>
</part>

<part>
<name>apache_flir</name>
<visible_in_range>
<parameter>
<code>
(A:LIGHT NAV,number)
</code>
</parameter> 
<minvalue>1</minvalue>
<maxvalue>1</maxvalue>
</visible_in_range>
</part>
Which seems to indicate that you need to entries, one to determine when the anim is on and one when the other is on. Now obviously there must be a way in FSDS that you determine which conditional part is on and which is off.
Does this ring any bells with anybody?

Re: AI KC-30A

Posted: 31 Dec 2009, 10:06
by Bell 209
Not me (but I've already said I know nothing about xml)!

Re: AI KC-30A

Posted: 31 Dec 2009, 10:12
by Firebird
Rob, I am the opposite, a little bit about XML and naff all about modeling. :D

Re: AI KC-30A

Posted: 31 Dec 2009, 16:13
by MIKE JG
But in that example code the condition is based off of the nav light. We don't want that in this case, we want it based off of a variable condition (velocity) instead of a boolean condition (off=0, on=1).

I'm trying to get a code that displays the static prop any time the z body velocity is less than 35 knots. My thinking is that we get that code working for that part. Then all we have to do is reverse the code for the spinning part version.

So IOW, master the first part, THEN we'll worry about the second bit.

Re: AI KC-30A

Posted: 31 Dec 2009, 18:48
by Firebird
Yep, completely understand everything you said.
What I was wondering is if its a conditional part that you need to define entries for both conditional parts. However, as a non-modeler I am happy to keep quiet about things that I know nothing about. :)

Re: AI KC-30A

Posted: 31 Dec 2009, 21:43
by MIKE JG
Ahh, gotcha. Yea you may be right about that.

Rob if you want, we can at least get you a working XML code for preflight items like chocks, engine covers, etc. If we can get you to try that out and get that working, we'll at least know that you are compiling the model correctly.

Re: AI KC-30A

Posted: 01 Jan 2010, 00:26
by Bell 209
Yeah, no worries. I'll do some chocks for it first.

Re: AI KC-30A

Posted: 01 Jan 2010, 00:45
by MIKE JG
Ok Rob, I KNOW this one works. :D It was the first one that I ever got to work.

This is a conditional visibility code for anything that you want to be visible when the selected light source is NOT ON. In this example, the part "Your_Part" would be the parent part of all the rest of the preflight stuff. Just use this code once, for one part and make all the other preflight bits, child parts of the primary. This code uses the beacon but you can use anything you want to. I later changed this to make use of the nav lights. The difference is that using the nav lights will make the parts disappear, up to 15 minutes prior to departure and they won't show back up until 15 minutes after the AI parks. If you use LIGHT BEACON, the parts will be visible any time the beacon is not on, which would be any time the engines are not on. If you want to use the nav lights as the trigger, just change the "LIGHT BEACON" part to "LIGHT NAV".

<part>
<name>Your_Part</name>
<visible_in_range>
<parameter>
<code>(A:LIGHT BEACON,number)</code>
</parameter>
<minvalue>-1</minvalue>
<maxvalue>0</maxvalue>
</visible_in_range>
</part>

If you want me to explain the logic behind this code so you know what it's doing, just say so.

Re: AI KC-30A

Posted: 01 Jan 2010, 00:55
by Dark Morelia
Steve - I can't see any way that code would work, it's just two entries for the same part name. As far as I know MakeMDL will just ignore the second one.
You'd need two differently named parts in the model linked to two differently named <part> entries in order for it to work.

For starters though Rob, just try linking something highly visible to this code, compile your model with the code in place in the xml file, load 'er up as UI, and hit the L key a few times to see if it works.

Code: Select all

<part>    
<name>test_box</name>    
<visible_in_range>    
<parameter>    
<code>
(A:LIGHT NAV, bool) !
</code>  
</parameter>
<minvalue>1</minvalue>  
</visible_in_range>  
</part>
(I use a giant red cube sitting just above the aircraft for testing xml)

EDIT: Mike beat me to it, that's what I get for leaving the reply window open while I get a drink :lol:

Re: AI KC-30A

Posted: 01 Jan 2010, 01:58
by MIKE JG
LOL! Yea but it does show the two different ways to do the same thing. You used a code with the "bool" code. I used "number", either one will work Rob.

Re: AI KC-30A

Posted: 01 Jan 2010, 03:47
by Bell 209
Okay, the first one worked. The part becomes visible just as the aircraft starts to move forward. Now comes the tricky bit...

Re: AI KC-30A

Posted: 01 Jan 2010, 04:08
by MIKE JG
You mean the z body velocity one??

Re: AI KC-30A

Posted: 01 Jan 2010, 07:39
by Bell 209
This one:

<part>
<name>Refuelling_pod_turbine</name>
<visible_in_range>
<parameter>
<code>(A:LIGHT BEACON, bool)</code>
</parameter>
<minvalue>1</minvalue>
</visible_in_range>
</part>

Re: AI KC-30A

Posted: 01 Jan 2010, 11:02
by nickblack423
Sorry I've missed this one guys. Below is the code I have implemented for the Growler and Super Hornet Buddy refueller.

<part>
<name>tank_motor</name>
<visible_in_range>
<parameter>
<code>
(A:VELOCITY BODY Z, knots) 90 > </code>
</parameter>
<minvalue>-1</minvalue>
<maxvalue>0</maxvalue>
</visible_in_range>
</part>

<part>
<name>tank_motor</name>
<visible_in_range>
<parameter>
<code>
(A:VELOCITY BODY Z, knots) 90 > </code>
</parameter>
<minvalue>1</minvalue>
<maxvalue>1</maxvalue>
</visible_in_range>
</part>

<part>
<name>tick18_tank_motor</name>
<visible_in_range>
<parameter>
<code>
(A:VELOCITY BODY Z, knots) 90 > </code>
</parameter>
<minvalue>1</minvalue>
<maxvalue>1</maxvalue>
</visible_in_range>
</part>

<part>
<name>tick18_tank_motor</name>
<visible_in_range>
<parameter>
<code>
(A:VELOCITY BODY Z, knots) 90 > </code>
</parameter>
<minvalue>-1</minvalue>
<maxvalue>0</maxvalue>
</visible_in_range>
</part>

This will have the part look like it is not moving when below 90 knots and then come to life and spin above that.

Nick

Re: AI KC-30A

Posted: 02 Jan 2010, 11:31
by Bell 209
You legend! Thanks, Nick!
So do I term the static part "Tank_Motor" and the moving one "Tick18_Tank_Motor"?

Re: AI KC-30A

Posted: 02 Jan 2010, 16:10
by MIKE JG
Rob, Nick's code is assuming that you are using Tick18 animation for your spinning prop. If that's the case, then that part, the spinning one, must start with "Tick18" per the standard FS2004 naming conventions. You can use whatever names you want to as those part names he has used (to my knowledge) are not recognized by MakeMDL. They are just what he used in this example.

You should be able to swap in your part name for the static bit, then "Tick18_........" whatever for your other part name and change the 90 to whatever speed value you want to and that should work.

Re: AI KC-30A

Posted: 02 Jan 2010, 22:38
by nickblack423
Thats right Rob and Mike thanks for that. Just animate the Tick18 part to have a keyframe at each 90 degrees and then it will spin. Use a bit of trial and error to get the speed right but I used 0, 5, 10 and 15 and it worked fine.

Nick

Re: AI KC-30A

Posted: 03 Jan 2010, 06:53
by Dark Morelia
Now I'm the confused one :lol: ... why two entries for each part? you only need one :|

Re: AI KC-30A

Posted: 03 Jan 2010, 08:17
by nickblack423
If you are wanting a part to animate on a Tick18 part then yes. But if you want a Tick18 part that will only show when the aircraft is in flight or over a certain speed or altitude etc then you need to have conditionally appearing parts as per the code above. Part "tank_motor" will only show below 90kts and part "Tick18_tank_motor" will show and animate above 90kts.
Much the same as "Prop" models. To animate props with the normal FS animation you need 3 parts for each one. "Prop_still", "Prop_Slow" and "Prop_Blurred"

Nick