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

Pulsating light

euroastar350

Resource contributor
Messages
863
Country
us-delaware
Hi all,

Does anyone know where I can get a pulsating light code or have one they be willing to share? The helicopter I am working on has them and I would like to add this feature in my freeware redention. Here is a video of the helicopter with the lights. On the nose are the lights in question. I know the Eaglesoft Citation II and Dreamfleet Piper Dakota has this feature. Any help is appreciated. The model will be for FS2004 and FSX.
 
For the Citation II (and the CJ1+ and CX2.0) the controlling code is in a C gauge.

However, it is really much simpler to accomplish in XML script!

The basic requirement is that you set up a timer that will flip-flop a variable every second.

I keep these "notes" in my modeldef.xml file at the very top as a quick reminder:

Code:
<!--
With this universal code it's very simple to control not only the length of the cycle but the frequency of the 
blink itself:
Pseudocode:<Visble>(P:Absolute time,seconds) "seed" % "blink lapse" > !</Visible>
The seed parameter is the total length of the blinking cycle. For example, if you want something to blink on every 
second, you use 1, if you want it blink every half a second, use 0.5 , every two seconds, 2 ,etc.

For each seed, you can determine how long would be the duration of both the visible and invisible part.
Then:
(P:Absolute time,seconds) 1 % 0.5 > ! 
this will make the visible and invisible parts of half a second both.
(P:Absolute time,seconds) 1 % 0.7 > ! 
this will make the visible part 70% of the cycle (0.7 secs) and invisible parts of 30 % (0.3 secs).
(P:Absolute time,seconds) 0.5 % 0.25 > ! 
this will make the visible and invisible parts a quarter of second both.
You can invert the cycle by removing the "!" char.
-->

Using the above as a guide then, it's easy to see that the following will create your "flip-flop" variable at a 1 second rate:

Code:
(P:Absolute time,seconds) 1 % 1 >
     if{ 1 (>L:FlipFlop,bool) } 
    els{ 0 (>L:FlipFlop,bool) }

Now, simply use (L:FlipFlop,bool) to control the <Visibility> of your lights!
 
This is what i used in the Dakota


PartInfo>
<Name>POS FLASH</Name>
<AnimLength>100</AnimLength>
<Visibility>
<Parameter>
<Code>(L:flash, bool) (P:absolute time, number) 1 % 0.1 &amp;gt; * </Code>
</Parameter>
</Visibility>
</PartInfo>
 
Sorry to dig up an old topic, but I decided to try out the pulsating light codes posted in this thred and have found out 2 things:

1.) Using Bill's code, I yield no results, even by adding it in correctly to the script.

2.) Using Chuck's code, I get a somewhat working light....but not the way I expect it.

I decided to combine parts from both codes to see what comes into play and nada. Here is the script I am using:

Code:
<PartInfo>
    <Name>Pulse_Flash</Name>
    <AnimLength>100</AnimLength>
    <Visibility>
      <Parameter>
        <Code>(L:pulse_flash, bool) (P:Absolute time,seconds) 1 % 0.7 > ! * </Code>
      </Parameter>
    </Visibility>
  </PartInfo>


Since I pretty much have the Bell 206 done, I want to concentrate all my efforts into my Bell 222 before working on other projects....some of which is with other developers.

Any help is appreciated in getting this code functional.
 
*Update*

I got a more functional code now, problem is that both lights flash on/off at the same time. What I did is add to land light triangles without the landing light properties attached and have both triangles using the same pulse light code. Am I supposed to create 2 separate codes for each part? Here is the updated light code I am using.

Code:
<PartInfo>
    <Name>Pulse_Flash</Name>
    <AnimLength>100</AnimLength>
    <Visibility>
      <Parameter>
        <Code>(L:pulse_flash, bool) (P:Absolute time,seconds) 1 % 0.7 > </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

Any help is appreciated
 
You will need three <Visibility> scripts to make this work for you:

  1. Control Logic
  2. Left Light
  3. Right Light

You need to create a tiny polygon in your model to which you can Attach the "Pulse Controller" XML script.

You can adjust the timer as desired. This is a 1 second pulse rate.
Code:
<PartInfo>
  <Name>Pulse Controller</Name>
  <Visibility>
    <Parameter>
      <Code>
      <!-- Because values of zero will always be displayed in a -->
      <!-- <Visibility) condition, we need to use 1 and 2 as values -->
      (L:Pulse Lights,bool)
      if{
        (P:Absolute time,seconds) 2 % 1 >
        if{ 1 (>L:WigWag,enum) }
        els{ 2 (>L:WigWag,enum) }
        }
      </Code>
    </Parameter>
  </Visibility>
</PartInfo>

<PartInfo>
  <Name>Left Light</Name>
  <Visibility>
    <Parameter>
      <Code>
        (L:WigWag,enum) 1 ==
      </Code>
    </Parameter>
  </Visibility>
</PartInfo>

<PartInfo>
  <Name>Right Light</Name>
  <Visibility>
    <Parameter>
      <Code>
        (L:WigWag,enum) 2 ==
      </Code>
    </Parameter>
  </Visibility>
</PartInfo>
 
Last edited:
Bill,

Tried the code and still no go.

What I did:

is create 3 small polys, 1 for the pulse controller, 1 for the left light and 1 for the right light

I attached the 2 light attachpoints to the respective places

I didn't change the part names to match your scripts, is this necessary?
 
I hope you mean by "Attach" that you opened the Attachpoint Tool and tagged 'em with the <Visibility> condition...

Names of the "parts" don't matter, but did you remember to build a switch to turn 'em on?

1 (>L:Pulse Lights,bool)
 
Bill,

Did everything that needs to be done including attach using visibility, built a switch and still nada. I'm stumped on this one:confused:
 
Hm, try this version then:

Code:
<PartInfo>
  <Name>Left Light</Name>
  <Visibility>
    <Parameter>
      <Code>
        (L:WigWag,enum) 1 ==
        if{ 1 } els{ 0 }
      </Code>
    </Parameter>
  </Visibility>
</PartInfo>

<PartInfo>
  <Name>Right Light</Name>
  <Visibility>
    <Parameter>
      <Code>
        (L:WigWag,enum) 2 ==
        if{ 1 } els{ 0 }
      </Code>
    </Parameter>
  </Visibility>
</PartInfo>
 
I didn't see a tiny polygon with "Pulse Controller" Attached as a <Visibility> condition.

Also, I'm not at all sure whether any of this will work at all if you "Group" it. I long ago forgot about the whole "Group/Ungroup" business, having had numerous issues with it causing OBED Scaling Errors. :eek:

I cloned your landing light triangles, moved them into proper position, then changed the Attachpoint for <Visibility> of "light_taxi_vis" and Effect of light_landing.fx. I then Linked the left side to the poly tagged as "Left Light" and the right side to the poly tagged as "Right Light."

See your PM for a link to the .gmax file w/changes.

This script works just fine:

Code:
<PartInfo>
  <Name>Pulse Controller</Name>
  <Visibility>
    <Parameter>
      <Code>
      <!-- Because values of zero will always be displayed in a -->
      <!-- <Visibility) condition, we need to use 1 and 2 as values -->
        (L:Pulse Light,bool)
        if{
          (P:Absolute time,seconds) 1.4 % 0.7 >
            if{ 1 (>L:WigWag,enum) }
            els{ 2 (>L:WigWag,enum) }
        }
      </Code>
    </Parameter>
  </Visibility>
</PartInfo>

<PartInfo>
  <Name>Left Light</Name>
  <Visibility>
    <Parameter>
      <Code>
        (L:WigWag,enum) 1 ==
        if{ 1 } els{ 0 }
      </Code>
    </Parameter>
  </Visibility>
</PartInfo>

<PartInfo>
  <Name>Right Light</Name>
  <Visibility>
    <Parameter>
      <Code>
        (L:WigWag,enum) 2 ==
        if{ 1 } els{ 0 }
      </Code>
    </Parameter>
  </Visibility>
</PartInfo>
 
OY!!!!!!!!!!!!!!!!!! Works like a charm Bill, you are truly a gentlemen and a scholar:cool:

No problem. BTW, you can adjust the timing if you wish. The critical point is that the generic formula is:

(P:Absolute time,seconds) x % x/2 >

Where x is the total number of seconds. In this case since we want the wig/wag to be evenly divided between left and right, we divide x by 2 for the second parameter.

I arbitrarily chose 1.4 seconds, therefore the second parameter is 0.7 seconds. :)
 
I didn't see a tiny polygon with "Pulse Controller" Attached as a <Visibility> condition.

Also, I'm not at all sure whether any of this will work at all if you "Group" it. I long ago forgot about the whole "Group/Ungroup" business, having had numerous issues with it causing OBED Scaling Errors. :eek:

I cloned your landing light triangles, moved them into proper position, then changed the Attachpoint for <Visibility> of "light_taxi_vis" and Effect of light_landing.fx. I then Linked the left side to the poly tagged as "Left Light" and the right side to the poly tagged as "Right Light."

See your PM for a link to the .gmax file w/changes.

This script works just fine:

Code:
<PartInfo>
  <Name>Pulse Controller</Name>
  <Visibility>
    <Parameter>
      <Code>
      <!-- Because values of zero will always be displayed in a -->
      <!-- <Visibility) condition, we need to use 1 and 2 as values -->
        (L:Pulse Light,bool)
        if{
          (P:Absolute time,seconds) 1.4 % 0.7 >
            if{ 1 (>L:WigWag,enum) }
            els{ 2 (>L:WigWag,enum) }
        }
      </Code>
    </Parameter>
  </Visibility>
</PartInfo>

<PartInfo>
  <Name>Left Light</Name>
  <Visibility>
    <Parameter>
      <Code>
        (L:WigWag,enum) 1 ==
        if{ 1 } els{ 0 }
      </Code>
    </Parameter>
  </Visibility>
</PartInfo>

<PartInfo>
  <Name>Right Light</Name>
  <Visibility>
    <Parameter>
      <Code>
        (L:WigWag,enum) 2 ==
        if{ 1 } els{ 0 }
      </Code>
    </Parameter>
  </Visibility>
</PartInfo>

Using just the timers I had somewhat of a pulse but one stayed on longer than the other. Where I think I'm going wrong is my lack of understanding what you "linked"? I do not use the fx.landing & fx.taxi.vis for my lights so I'm hoping that isn't a limit or requirement.
Poly#1 : Pulse Controller, hide it somewhere and put the visibility code with the appropriate light command IE. Pulse Light
Poly#2 & Poly #3: Left and Right visibility attachments and link to (in my case) splashes?

I tried linking to the splashes made for the pulse lights and still nothing. As mentioned above I only had something close using just the timing code but couldn't get it synchronized.

If anyone with patience can help me here I will greatly appreciate it.
 
Back
Top