The website and forum will be intermittently unavailable while we're making some security updates.
File uploads to the download hangar are also disabled until further notice.

AI HELI NOSE GUN XML???

Discussion, tutorials,hints and tips relating to designing military ai aircraft.
Post Reply
mins
Captain
Captain
Posts: 244
Joined: 21 Mar 2008, 04:54
Version: FS9

AI HELI NOSE GUN XML???

Post by mins »

Hello.

I'm practicing making AI helicopters.

I have a question.

It is a problem with the nose gun animation on the circle in the picture below.

I want to make it move(KEY FRAME) only during the flight. (ENG START)

I tried different XML codes but failed.

EX) With the application of TICK18 it moves all day long. ^ ^;;

Ask for help.

Thanks.
Attachments
-2018-jan-17-002.jpg
User avatar
clickclickdoh
MAIW Developer
MAIW Developer
Posts: 1568
Joined: 03 Mar 2009, 03:04

Re: AI HELI NOSE GUN XML???

Post by clickclickdoh »

I think the trick would be to use a radar altimeter reading instead of the engine start variable....but the .xml specialists should know for certain.
User avatar
Fokket50
MAIW Developer
MAIW Developer
Posts: 212
Joined: 31 Aug 2006, 13:38
Version: FS9
Location: The Netherlands

Re: AI HELI NOSE GUN XML???

Post by Fokket50 »

one solution you can use, is too clone the nose gun, and use one as static that shows on the ground, and the second animated for in the air.
If you use 1 dummy part with visibility coding on the ground, and connect (make the dummy the parent) the static nose gun to this dummy part, then it will show on the ground only.
Then have the second dummy part with visibility coding in the air, and connect the tick18 moving nose gun to this dummy part, then it will show airborne.
The dummy part can be hidden in another part, so you will not see it. A small box can be sufficient.

The coding you can use would look like:

<part>
<name>dummypartground</name>
<visible_in_range>
<parameter>
<code>(A:LIGHT STROBE, bool) </code>
</parameter>
<minvalue>-1</minvalue>
<maxvalue>0</maxvalue>
</visible_in_range>
</part>


<part>
<name>dummypartairborne</name>
<visible_in_range>
<parameter>
<code>(A:LIGHT STROBE, bool) </code>
</parameter>
<minvalue>1</minvalue>
<maxvalue>1</maxvalue>
</visible_in_range>
</part>

I hope this is helpfull.
Menno
mins
Captain
Captain
Posts: 244
Joined: 21 Mar 2008, 04:54
Version: FS9

Re: AI HELI NOSE GUN XML???

Post by mins »

Fokket50 wrote: 17 Jan 2018, 10:47 one solution you can use, is too clone the nose gun, and use one as static that shows on the ground, and the second animated for in the air.
If you use 1 dummy part with visibility coding on the ground, and connect (make the dummy the parent) the static nose gun to this dummy part, then it will show on the ground only.
Then have the second dummy part with visibility coding in the air, and connect the tick18 moving nose gun to this dummy part, then it will show airborne.
The dummy part can be hidden in another part, so you will not see it. A small box can be sufficient.

The coding you can use would look like:

<part>
<name>dummypartground</name>
<visible_in_range>
<parameter>
<code>(A:LIGHT STROBE, bool) </code>
</parameter>
<minvalue>-1</minvalue>
<maxvalue>0</maxvalue>
</visible_in_range>
</part>


<part>
<name>dummypartairborne</name>
<visible_in_range>
<parameter>
<code>(A:LIGHT STROBE, bool) </code>
</parameter>
<minvalue>1</minvalue>
<maxvalue>1</maxvalue>
</visible_in_range>
</part>

I hope this is helpfull.
Menno
Dear Menno.

Thank you very much.

It works very well.

It's great.
User avatar
Victory103
Colonel
Colonel
Posts: 3977
Joined: 13 Aug 2007, 03:35
Version: P3D
Location: KPHX

Re: AI HELI NOSE GUN XML???

Post by Victory103 »

mins, is that a first look at a special project in work?
DUSTOFF
ARMY PROPS
NAVY SAR

-Chris
User avatar
Weescotty
MAIW Developer
MAIW Developer
Posts: 2770
Joined: 11 Aug 2006, 22:15
Version: FS9
Location: Sydney

Re: AI HELI NOSE GUN XML???

Post by Weescotty »

Forget about cloning it just adds polys when they aren't needed.
Use (A:RADIO HEIGHT,feet), also instead of tick 18 use a looped animation (first and last keyframe must be the same).
So assuming 100 frames with 0 and 100 the same

<part>
<name>YOU_PART_NAME_HERE</name>
<animation>
<parameter>
<code>
(A:RADIO HEIGHT,feet) 500 &lt;
if{ 0 (&gt;G:Var1) 0 }
els{ (G:Var1) ++ 100 % (&gt;G:Var1) (G:Var1) }
</code>
<lag>50</lag>
</parameter>
</animation>
</part>

Under 500ft the gun would be at keyframe 0 (parked position I would guess).
Over 500ft it would continuosly loop through keyframes 0 to 100 over and over again.
Change the 500 on the first line of code to change when it starts looping.

Lag controls how fast the animation 'runs' you just have to experiment to find the best value as it changes with each animation.
mins
Captain
Captain
Posts: 244
Joined: 21 Mar 2008, 04:54
Version: FS9

Re: AI HELI NOSE GUN XML???

Post by mins »

Victory103 wrote: 17 Jan 2018, 18:41 mins, is that a first look at a special project in work?
No. No.

This is just to practice the FSDS.

I don't have the skills to do a project. :smt021
mins
Captain
Captain
Posts: 244
Joined: 21 Mar 2008, 04:54
Version: FS9

Re: AI HELI NOSE GUN XML???

Post by mins »

Weescotty wrote: 17 Jan 2018, 21:20 Forget about cloning it just adds polys when they aren't needed.
Use (A:RADIO HEIGHT,feet), also instead of tick 18 use a looped animation (first and last keyframe must be the same).
So assuming 100 frames with 0 and 100 the same

<part>
<name>YOU_PART_NAME_HERE</name>
<animation>
<parameter>
<code>
(A:RADIO HEIGHT,feet) 500 &lt;
if{ 0 (&gt;G:Var1) 0 }
els{ (G:Var1) ++ 100 % (&gt;G:Var1) (G:Var1) }
</code>
<lag>50</lag>
</parameter>
</animation>
</part>

Under 500ft the gun would be at keyframe 0 (parked position I would guess).
Over 500ft it would continuosly loop through keyframes 0 to 100 over and over again.
Change the 500 on the first line of code to change when it starts looping.

Lag controls how fast the animation 'runs' you just have to experiment to find the best value as it changes with each animation.
Thank very much Weescotty.

That's a great way to do it.

and I don't know why, but it goes well up and down, but it doesn't go well on the left and right.

Sway to one side(left).

I'll have to study it a little bit more.

Thank you all very much for being so helpful anyway.
User avatar
Weescotty
MAIW Developer
MAIW Developer
Posts: 2770
Joined: 11 Aug 2006, 22:15
Version: FS9
Location: Sydney

Re: AI HELI NOSE GUN XML???

Post by Weescotty »

You have to keyframe the positions you would like it to go through.
It will then go from one position to the next over and over. Same as you would keyframe a tick18 animation.

Big difference is it ONLY runs when the aircraft is over the height you choose, and when it drops back under that height it returns to keyframe 0 (parked position).
tick18 using visibility it jumps back.

You can also increase the length of the animation by changing the 100 on the els line to -
for example 200 and keyframing to 200.

I think I know what your problem might be...
Its two seperate parts? One for left to right and the gun up and down?

If you called them -

cobra_gun.turret - keyframe that left and right
cobra_gun.barrel - keyframe that up and down

on the XML change the name to -
<name>cobra_gun</name>

The one piece of code runs both animations.
Post Reply