Basically, turn based RPG. When combat is initiated, Play [Combat_Music] from the beginning. While the player is still in combat, always loop [This_Region]. When the enemy is defeated and the battle is won, detect the next Bar and transition to the End.
This is what I have right now.
How do I go about it?
- Move your “4564_Outro” instrument slightly to the right. It doesn’t matter exactly how far, as long as there’s a gap between the end of the loop region and the start of the outro instrument. This gap will prevent the end of the loop region from capturing and looping the playback position when it jumps to the start of the outro.
- Add a destination marker to the event, and put it at the very start of the “4564_Outro” instrument.
- Add a transition region to your event, and set its destination to the destination marker you created in the previous step. Stretch this transition region to overlap your loop region. (You might also want to drag it up or down a little so that you can see both the loop region and the transition region at the same time.) The transition region gives your event the ability to jump to the outro from any point in the loop.
- Select the transition region. In the deck, click the “Add Condition” button, then select “Add Event Condition” from the menu. This adds a condition called “Event state.” Open the condition’s dropdown menu, and select “Stopping.” This condition ensures that the event only jumps to the outro when the event is stopping. (Event states were added to FMOD Studio in version 2.01.00. If you’re using an earlier version, you’ll have to use a parameter condition instead.)
- Still in the deck, look at the “Quantization Interval” buttons for the transition region. By default, the “off” button is highlighted. Click on the “1” button to antiquate the transition to 1 bar intervals. This ensures that the event only jumps to the outro at the start of a bar.
Try auditioning the event. If you’ve followed the above steps, you should find that the event loops until you press the stop button, at which point it finishes playing the current bar, then jumps to the outro. When the outro is finished, the event ends. (In versions of FMOD Studio prior to 2.01.00, the event will loop until the parameter condition ceases to be met instead of when you click the stop button.)
It’s perfect. Thank you, that’s exactly what I wanted. 10/10.
Now… How do I make it play inside Unity?
Information on how to play an FMOD Studio event in a Unity game can be found in our Unity Integration documentation.