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

Using the Update component in a non-aircraft simobject

Messages
96
Country
greece
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) (&gt;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 see no reply yet. I wonder if anybody has tried triggering sounds in a simobject using the Local Time variable and if there is an alternative method to the one I am trying here.
 
Just in case anyone has the same issue, I got a great pointer from a kind soul Rotornut44 at the MSFS Dev forum. It seems that the update loop works only in aircraft cockpits to monitor interactions. The trick for other simobjects is to use a worldscript. Details here: https://devsupport.flightsimulator....raft-simobject-trigger-sound-using-lvar/16902

My worldscript looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<SimBase.Document Type="MissionFile" version="1,0" id="{19d1e6bc-a7ea-4f47-abaa-62622430969a}">
<Title>Engine Sound Controller</Title>
<Filename>SR_Sound_WS.xml</Filename>

<WorldBase.Flight>
<SimMission.Calculator InstanceId="{7df8e00d-ba56-4552-a381-d4dc234dc33b}" id="ESD_CTRL">
<CalculatorActions>

<!-- Grabbing Local time value at Lvar EngSound1 -->
<CalculatorAction>
<CalculatorFormula>
(E:LOCAL TIME, Seconds) (&gt;L:EngSound1)
</CalculatorFormula>
</CalculatorAction>

</CalculatorActions>
</SimMission.Calculator>
</WorldBase.Flight>
</SimBase.Document>

The sound.xml entry is still the same but now works!
 
Back
Top