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:
Spoiler
[statedef-2]
[State -2, PlaySnd]
type = PlaySnd
triggerall = time = 0 && roundstate != 2 && !win && !lose
trigger1 = StageVar(info.name) = "stagename" ; Name of stage in between the quotation marks
value = F5001,random%2 ; the numbers after F is your song of choice and random%X will be the number of songs you want to be randomized. Please add your music to Common.snd or anything similar. Not all of your character's snd files.
volumescale = 2000 ;If your music is too loud.
persistent = 0
channel = -1
;lowpriority = -1
freqmul = 1.0
loop = 0
pan = 0
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!
Spoiler
[State 5900, BGM Randomizer]
type = VarSet
trigger1 = roundno = 1 && time = 0
sysvar(2) = random%2
[State 5900, BGM]
type = PlaySnd
trigger1 = time = 0
trigger1 = StageVar(info.name) = "Training Room 720"
value = F5000,sysvar(2)
persistent = 1
ignorehitpause = 1
Question
LunarDash
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!
3 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now