I added an engine sound to AI tow airplanes and it's cool. However, there is a problem with turning off the engine sound. When I call fgcommand with "unload-scenario" the engine sound is still playing - this is annoying, especially when I run several AI aircraft, then the engine sounds are duplicated.
To the <fx> tag I tried adding a condition:
- Code: Select all
<PropertyList>
<fx>
<engine>
<name>engine</name>
<mode>looped</mode>
<path>wasp.wav</path>
<property>velocities/true-airspeed-kt</property>
<volume>
<offset>-0.80</offset>
</volume>
<pitch>
<property>velocities/true-airspeed-kt</property>
<factor>0.012</factor>
<offset>0.3</offset>
<min>0.3</min>
<max>1.0</max>
</pitch>
<reference-dist>150.0</reference-dist>
<max-dist>5000.0</max-dist>
<condition> <!-- <---------------------------------- my extra condition here -->
<property>/addons/by-id/org.flightgear.addons.Aerotow/addon-devel/sound/enable</property>
</condition>
</engine>
</fx>
</PropertyList>
I set the property correctly to true when I call the aircraft, and to false when I disable the scenario, but the condition only works for turning the sound on, not for turning it off. Does anyone know a solution to disable the sound of the AI model when it started playing?