Pick from random container but omitting one of the track

Hi Fmod community,

I’m facing a problem that I will need to play a specific track when the player first enters the map, but then the next time player enters, it will need to pick from a random pool with the track that just played inside of it while omitting it at the some time.

So this is how the logic looks like:
First time player enters: Play track A
Second time: Play random track B or C or D
Third time and on: Play random track from A, B, C or D but not the last played track

Is there anyway to do this in Fmod?

Thanks!

This is honestly a tricky set of requirements. I can think of ways to almost fulfill them, but I think the only way to get exactly the behavior you describe is to create four separate events for your four separate tracks, and to write the logic governing what track to play and which track was played last in your game’s code.

The “Shuffle” playlist selection mode of an instrument does nearly what you want, as it ensures that each time you play an instrument it selects a random new playlist entry to play, excluding the most recently-selected entry. It doesn’t allow you to guarantee that a specific entry always plays first, though.

You can also nearly achieve this by using nested multi instruments: If you create a multi instrument set to “sequential - global scope” playlist selection mode, it will play a new entry from its playlist each time it is triggered; if you populate its playlist with Track A and another multi instrument set to “shuffle” playlist selection mode and populate that second multi instrument’s playlist with tracks B, C, and D, the result will be that the event plays track A the first time it is triggered, whereas on the second it’ll select track B, C, or D at random, and will thereafter play A, B, C, or D, never repeating the same track twice in a row. Unfortunately, this method will always play Track A every odd-numbered time the event is triggered - and while you could work around that issue by using additional nested multi instruments, doing so would also make it possible for the same playlist entry to be selected twice in a row.

Even if you could avoid those issues and create an event that behaved exactly as you describe, it would count the times that it had been triggered starting from when the game was launched, rather than from when your player began a new game, meaning that if a player loaded their game after visiting the area once, the playlist would begin as if they’d never been there before.

So, as I said above, I can only recommend handling this logic in your game’s code.