How to create a chance that set number of layers might play?

Hi,

First of all, I am very new to FMOD so I apologize if this is an elementary question but…
I am trying to create the following scenario:

I have 4 layers that make up one whole track. When the character is walking around the main world, I want Layer 1 to always be audible, but I also want there a chance to have layer 2, layer 3, and/or layer 4 audible. So after the loop point there may be 1, 2, 3 or 4 total layers being audible.

THEN

When the player enters a puzzle room, I want to reduce the total number of possible audible tracks to 3 instead of 4. I still want layer 1 to always be audible, but I only want a max of 2 other layers to be audible at any given time. This will allow the music to be more mellow when a player is focusing on a puzzle.

I understand how to make the first portion happen, I can simply give layer 2, 3, and 4 some probability that they will play when the character is in the main world. I don’t get how to simply then reduce the total audible layers to 3 max while still allowing there to be a chance for any 2 of the other 3 layers to be audible. Hopefully that makes sense.

Thanks in advance!

It would probably be easiest to handle this through your game’s code, since that would allow you to more easily track how many of your three optional tracks are currently playing.

However, if you do want to build this logic in FMOD Studio, I imagine you’d want to have your three optional tracks all controlled by a single parameter such that every possible combination of playing tracks is represented along its length, and use two different command instruments to randomize the value of that parameter: One that sets it to any possible value, and another that sets it only to values that play zero, one, or two tracks. Then you’d just need to make the triggering of those command instruments dependent on the value of your “is player focusing on a puzzle” parameter.