Stopping a loop after a parameter is met

Hi, I’m a student currently doing an assignment using Fmod to implement sfx for a simple game. There is one enemy in the game that needs to be hit 3 times to be destroyed, and on the second hit, it catches fire. There is a parameter sheet for hits (1-3). I have created a looping fire sound in the timeline sheet on the condition to play only on the second hit. However, the loop continues infinitely, even after the enemy is destroyed, and i can’t find a way to make this stop. Can anyone help?

Hi!

The simplest way to get the loop to stop would be to add a transition condition to the loop, and set it so when your Hit parameter is at 3 hits, it will no longer loop.

However, this means that the remainder of the fire sound will still continue to play out. If you need the fire sound to instantly stop, then you should instead add a transition region occupying the same region as the loop, and set it to transition to a marker outside the loop with a transition condition of the Hit parameter reaching 3 hits.

If you’d like to exit the loop immediately like the above example, but still have the fire sound fade out, you can add a transition timeline to the transition region by either right clicking and selecting “Add Transition Timeline”, or double clicking on the transition region. If you drag the leftmost tab in the transition timeline (“Source”) to the right, you’ll be able to add a volume curve to it finishing playback. The result looks like this:

Hope this helps!

1 Like