Random Battle BGM

Random Battle BGM ​
by Karberus​
 ​
 ​
 ​
Versions:
Current Version: 1.2

Spoiler
v1.0        25 Oct 2015 -  Initial Release.v1.1        25 Oct 2015 -  Added Plugin Commands to override random battle bgm and be able to set it through an event.v1.11 25 Oct 2015 - Cleaned up a tiny bit of the code.v1.2 26 Oct 2015 - Fixed a bug that caused other scripts plugin commands to affect this script's plugin commands. (lol) v2.0 07 Dec 2015 - Almost completely rewritten. Fixed issues with Yanfly's Party System.
 
 ​
Introduction:
Whenever battle starts, this plugin will randomly play one of the BGM's that you choose.
 
 
Features:

  • You may declare up to 30 BGM's 
  • One of those BGM's will be chosen at random before each battle 
  • You may turn this plugin on or off at any time through plugin commands.

How to use:

  • Add the plugin to your game and set up what battle BGM's you wish to use by typing the filename in the parameter settings.

Plugin Commands:

  • RandomBGM on/off             //Turns this plugin on or off 
Plugin:
RandomBattleBGM
 
 
Dependencies:
None
 
 
Known Bugs:
Changing the battle's bgm through an event doesn't work.

Yanfly's Party System would cause the bgm to change in the middle of battle 
 
 
Credit/Terms of use:
No need to credit me or anything, and it may be used however you wish; commercial or non-commercial.
 
 
Author's Notes
This is my first plugin ever, I've never coded before. I'm still learning and I am quite sure I made tons of mistakes so any help is appreciated lol. Hopefully it works as intended at least 🙂
Thanks a lot 😀
Wwhile it's not that hard to set up in maker, it's a nice thing to have as plugin 🙂
Imma use it because it reminded me that I should have this.
I remember "The world ends with you" having random bgms in battle out of like 5.
It was refreshing to hear different ones playing.
Anyway u'll get credited because I can't live with myself without crediting people xd
Hey I'm glad you find it useful xD

I actually did this just to practice the little I've learned of Javascript and how to make plugins for MV.

Hopefully I'll make better plugins in the future when I learn more 😛

and Thanks! lol
Hey Karberus, love this plugin. It makes random battles always a different tone.

There is one little bug/inconvenience thing so I thought I'd ask.

If I use this with yanfly's formation menu (his/her party system) The song would randomly change once you go back to the battle. They made a fix that would preserve the same song but it didn't have an effect.

I tried to use your plugin commands in order to choose a specific song , although it crashes and can't load it. I made sure that I wrote the name of it correctly.

Normally it's fine, although for boss fights I wouldn't want it to change the music because it becomes one of the randomly designated songs for normal battles.

Thanks for the plugin though, it's really helpful 🙂
@Myst Desdemona - When I tried out Yanfly's Party System, that's the first thing I noticed and I was like "Noooooooooo" but I think I finally fixed it.

I will update this asap. EDIT: updated.

Thank you so much for your feedback 🙂
Happy to help! Thank you for updating it 🙂
I can't get this to work for the life of me. It says 'Failed to load undefined.ogg'. I'm using exact filenames from audio/bgm/. What am I doing wrong?
I can't get this to work for the life of me. It says 'Failed to load undefined.ogg'. I'm using exact filenames from audio/bgm/. What am I doing wrong?

Do you have your audio files saved as .m4a and .ogg in your bgm folder?
Ja! For example, "Battle 1" and "Battle 2" are m4a and .ogg in the bgm folder...but I list them in the activated plugin settings and get the "undefined" message in game. Do all 30 slots need to be filled?
Ja! For example, "Battle 1" and "Battle 2" are m4a and .ogg in the bgm folder...but I list them in the activated plugin settings and get the "undefined" message in game. Do all 30 slots need to be filled?

No they don't.
The only thing I know you could check would be spell checking, but I guess in this case you would have got a proper error message.
Try to remove spaces in your filenames and see if that works, I think newer versions of the engine doesnt work with spaces in filenames anymore.
Yeah, I still can't get it to work. Damn, I have no idea what's wrong with it.

[EDIT] I had an extra space in the .js filename. You gotta have it RandomBattleBGM.js. Yes, I'm an idiot.

Original thread: https://forums.rpgmakerweb.com/threads/random-battle-bgm.47188/