Hello to all!
I am trying to accomplish what seems like a simple task but failing so far.
I have a static simobject (Landmark) to which I would like to assign sounds to be played at specific time of day. Local Time is an E: (Environment variable) and so far I've managed to use it to trigger animations or effects. Sound however needs SimVars, or alternatively Lvars.
So I thought, why not define an Lvar and use it to grab the value of E: LOCAL TIME in it and use it as the simulation variable to trigger the sound in the sound.xml.
Searching the known sites I found a suggestion to use the update component in the Behaviors. So my code looks like this:
<Behaviors>
<Include ModelBehaviorFile="Asobo\Generic\FX.xml"/>
<Include Path="Asobo\Generic.xml"/>
<!--Setting sound Lvar-->
<Component ID="GRAB_LOCAL_TIME">
<UseTemplate Name="ASOBO_GT_Update">
<FREQUENCY>18</FREQUENCY>
<UPDATE_CODE>
(E:LOCAL TIME, Seconds) (>L:Sound1)
</UPDATE_CODE>
</UseTemplate>
</Component>
and the sound.xml entry like this:
<SimVarSounds>
<Sound WwiseData="true" WwiseEvent="eng_intake_whistle" Continuous="true" LocalVar="Sound1">
<Range LowerBound="84600" UpperBound="84840"/>
</Sound>
</SimVarSounds>
Normally this would trigger the sound at 23:30 and play it for 4 minutes. This never happens. Using the "Behavior" tool in the sim dev mode I check the value of the Lvar and it is always 0. If I manually set it to 84600 in the tool the sound does trigger.
The model is for 2024 and I understand that the above shows 2020 templates but they should normally work. I have tried also with the 2024 update template "Asobo_Update_Template" instead of "ASOBO_GT_Update" and it did not make a difference. I need to stick to 2020 templates as I am using some 2020 effects templates too.
I have seen the "ASOBO_GT_Update" used in modelbehavior files of aircraft cockpits so I'm starting to think it may not work in a "Landmark" simobject, but that would be strange.
Any help or suggestion would be deeply appreciated.
I am trying to accomplish what seems like a simple task but failing so far.
I have a static simobject (Landmark) to which I would like to assign sounds to be played at specific time of day. Local Time is an E: (Environment variable) and so far I've managed to use it to trigger animations or effects. Sound however needs SimVars, or alternatively Lvars.
So I thought, why not define an Lvar and use it to grab the value of E: LOCAL TIME in it and use it as the simulation variable to trigger the sound in the sound.xml.
Searching the known sites I found a suggestion to use the update component in the Behaviors. So my code looks like this:
<Behaviors>
<Include ModelBehaviorFile="Asobo\Generic\FX.xml"/>
<Include Path="Asobo\Generic.xml"/>
<!--Setting sound Lvar-->
<Component ID="GRAB_LOCAL_TIME">
<UseTemplate Name="ASOBO_GT_Update">
<FREQUENCY>18</FREQUENCY>
<UPDATE_CODE>
(E:LOCAL TIME, Seconds) (>L:Sound1)
</UPDATE_CODE>
</UseTemplate>
</Component>
and the sound.xml entry like this:
<SimVarSounds>
<Sound WwiseData="true" WwiseEvent="eng_intake_whistle" Continuous="true" LocalVar="Sound1">
<Range LowerBound="84600" UpperBound="84840"/>
</Sound>
</SimVarSounds>
Normally this would trigger the sound at 23:30 and play it for 4 minutes. This never happens. Using the "Behavior" tool in the sim dev mode I check the value of the Lvar and it is always 0. If I manually set it to 84600 in the tool the sound does trigger.
The model is for 2024 and I understand that the above shows 2020 templates but they should normally work. I have tried also with the 2024 update template "Asobo_Update_Template" instead of "ASOBO_GT_Update" and it did not make a difference. I need to stick to 2020 templates as I am using some 2020 effects templates too.
I have seen the "ASOBO_GT_Update" used in modelbehavior files of aircraft cockpits so I'm starting to think it may not work in a "Landmark" simobject, but that would be strange.
Any help or suggestion would be deeply appreciated.
