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

rotornut44 avatar image
rotornut44 asked rotornut44 commented

Set LVar value to 1 without update code?

Is there a way that I can set a LocalVar to a value of 1 without relying on update code in the XML?

I need to pass a 1 for an LVar in my scenery simobject when a certain condition is met, to tie it into a Wwise sound, however Update Code does not seem to work outside of aircraft, and those are the only examples I can find, so I'm unsure how to go about setting this value...

Using my current update code, I can see the LVar in the Behaviors menu in sim, but the value is stuck to 0.

<Component ID="CAMPFIRE_LVAR_UPDATE">
<UseTemplate Name="ASOBO_GT_Update">
<FREQUENCY>30</FREQUENCY>
<UPDATE_CODE>
(A:AMBIENT TEMPERATURE, celsius) 10 &lt;=
if{
1 (&gt;L:CAMPFIRE_ACTIVE)
} els{
0 (&gt;L:CAMPFIRE_ACTIVE)
}
</UPDATE_CODE>
</UseTemplate>
</Component>


Any ideas? (I am aware that I can use a SimVar in the Wwise XML for this A:var, but I still need this L:var method to work for other SimObjects!)

Edit: Also, why couldn't you use some code like the following to make this work? Maybe my XML structure isn't right, but even something as simple as this, that I would think would work does not:

<Component ID="CAMPFIRE_WWISE">
<Visibility>
<Parameter>
<Code>(A:AMBIENT TEMPERATURE, celsius) 10 &lt;= if{ 1 (L:CAMPFIRE_ACTIVE) }</Code>
</Parameter>
</Visibility>
</Component>

scenery
10 |10000

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

Boris_ avatar image
Boris_ answered rotornut44 edited

Hello @rotornut44 ,

L:vars are for user only and they have some limitations
You can try with W:vars instead to trigger the wwise event

I don't think there is another option,



Regards,
Boris

1 comment
10 |10000

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

rotornut44 avatar image rotornut44 commented ·

What would be the proper tag to use in the soundai.xml (SimVarSounds, AlwaysPlaySounds, etc.) when you don't want the sound to play unless called? Using <SimVarSounds> with a fake Lvar is seemingly the only way to make the sound not play automatically, but that doesn't seem to work with my current code.

So, what would be the proper way to call the W:var if I want it to only call that var when a E:var condition is met?

<Behaviors>
<Component ID="Bees_Wwise">
<UseTemplate Name="ASOBO_GT_Update">
<FREQUENCY>30</FREQUENCY>
<UPDATE_CODE>
(A:AMBIENT TEMPERATURE, celsius) 10 &lt;= if{ 1 (&gt;W:bees) } els{ 0 (&gt;W:bees) }
</UPDATE_CODE>
</UseTemplate>
</Component>
</Behaviors>


(A:var just used as example)

1 Like 1 ·
kcgb avatar image
kcgb answered rotornut44 commented

Z:Vars work on non aircraft simobjects


1 comment
10 |10000

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

rotornut44 avatar image rotornut44 commented ·

Good to know, but I'm not sure that I can use a Z:var in my current situation, as I still need to call a Wwise event, which seems to only be possible with L & W:vars. Though, L doesn't work for scenery, and W doesn't seem to be documented other than it's basic description under Variable Types in the RPN section of the SDK docs.


1 Like 1 ·

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.