Hi everyone, I posted a thread about this elsewhere but figured I would try here as well to see if anyone had any input.
I am trying to utilize some code meant to go in common1.cns that I found from a thread on Mugen Archive while browsing for a solution to using randomized BGM on stages. I implemented it and it sort of worked as described, however I noticed that the songs don't continue after the round ends. I figure this has to do with PlaySnd or something along those lines, but here's the original code I am working from:
I've tried a few things such as moving it into State 5900 (I did this because I saw somewhere that negative states should be avoided when editing common1.cns as they can easily be overridden) and also having the song be chosen by a VarSet prior to PlaySnd being triggered (more on this later in the post.) However, my issues still persist. Is there a way to have a PlaySnd state fully act as BGM? If not, is there a way for me to set a specific start time based on a variable that tracks the amount of ticks that go by in a battle?
As for my other issue, I've noticed that when a battle starts, sometimes both sounds will play at once. I've tried resolving this by having a VarSet generate a random number before the PlaySnd and then use that variable to choose the sound from common.snd. However, it still occurs about 33% of the time. I tried rounding the random number thinking there may be some funky decimals going on there or something, but given how modulus works, this makes no sense. I going to leave the code that I'm working on myself below. Thanks to anyone who takes a look!