plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.


Please take a moment to read the platform’s guidelines before you get started!


question

Yoan_pesim avatar image
Yoan_pesim asked Flysimware edited

How to activate 2 lights on a button in the xml

Hello

I would like to make the beacon light and the strobe light assigned to the same button in my plane.

The problem is that in the XML, if I add the line below, it does not work.

"

<UseTemplate Name="ASOBO_LIGHTING_Switch_Light_Beacon_Template">
<NODE_ID>BEACON_LIGHT_SWITCH</NODE_ID>
<ANIM_NAME>BEACON_Light</ANIM_NAME>
<LIGHT_TYPE>BEACON</LIGHT_TYPE>
<LIGHT_TYPE>STROBE</LIGHT_TYPE>
</UseTemplate>
"


Same when I add a new template with the same name of node and anim for my button.

"
<UseTemplate Name="ASOBO_LIGHTING_Switch_Light_Strobe_Template">
<NODE_ID>BEACON_LIGHT_SWITCH</NODE_ID>
<ANIM_NAME>BEACON</ANIM_NAME>
<LIGHT_TYPE>STROBE</LIGHT_TYPE>
</UseTemplate>
"


I was told that I would have to make a custom code but I don't know how to code and currently I don't have anyone to make one.

sincerely.

aircraftlight
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

1 Answer

·
Flysimware avatar image
Flysimware answered Flysimware edited

There are two methods you can go here. A third method I do not suggest which is to write logic to turn on two switches from a Lvar. The reason is the user can't assign hardware. So here are the two methods I suggest.

Methods:

1. Under the systems.cfg you can setup a light for the strobes and then add an extra line that uses the same type but points to a beacon effect. Then the user can assign strobes and get both lights. But for the electrical there will only be strobes. Which would be normal as you only need 1 circuit. So set the battery draw accordingly for both totaled.

2. Use an update code below to ask if the strobe are ON and the beacon is OFF then turn ON the beacon. And vice versa for turning the beacon OFF. This will have 2 circuits both controlled by 1 switch. So make sure to have both in the electrical section and set the battery draw accordingly for each.

Place this in your interior.xml

                <UseTemplate Name="ASOBO_GT_Update">
                    <FREQUENCY>4</FREQUENCY>
                    <UPDATE_CODE>
(A:LIGHT STROBE, Bool) 1 == (A:LIGHT BEACON, Bool) 0 == and if{ (&gt;K:BEACON_LIGHTS_ON) }
(A:LIGHT STROBE, Bool) 0 == (A:LIGHT BEACON, Bool) 1 == and if{ (&gt;K:BEACON_LIGHTS_OFF) }
                    </UPDATE_CODE>
                </UseTemplate>


Also make sure at the top of the interior.xml and after the </LODS> you have these entries.

<Include ModelBehaviorFile="ASOBO\Generic.xml"/>

<Include ModelBehaviorFile="ASOBO\Common.xml"/>

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 19.1 MiB each and 23.8 MiB total.