Choose music per troop like the Mother series?

Sorry for clunky title but it's the quickest way I can think to put my question. I'm just wondering how it might be possible to change the battle music depending on the troop you encounter? I remember years ago first messing around with making an RPG (in VX Ace, specifically) where I tried to do it but all it did was change the music for the NEXT encounter, lol.
Can I change music midway through an encounter, ergo change the music at the very start of the encounter? Would this be buggy at all or is this basically foolproof? Will it be a seamless effect or will it sound a little off, like a second of the previous battle music before the new song takes over? Thank you to anyone who reads.
The only way I can think of to have fine-tuned timing controls over music is to use NRP Parallel common event in Battle and control it with conditional statements
no need for parallels here.

for evented battles this is as easy as changing the BGM by event command before the battle processing command.

for random battles or when you want to change BGM during battle, you'll need two commands in a troop event:
first a change BGM event command as usual, but you need to follow that with a script command to force the engine to reset the battlemusic.

Unfortunately I don't remember that script command at the moment.
it has been given in several cases of this question in the past, so you can try to search for it.
otherwise you'll have to wait for someone else to post it.
I was responding to this. The only way I can think of is with parallels. Or I guess action phase plugin.
Can I change music midway through an encounter,
Sorry for clunky title but it's the quickest way I can think to put my question. I'm just wondering how it might be possible to change the battle music depending on the troop you encounter? I remember years ago first messing around with making an RPG (in VX Ace, specifically) where I tried to do it but all it did was change the music for the NEXT encounter, lol.
Can I change music midway through an encounter, ergo change the music at the very start of the encounter? Would this be buggy at all or is this basically foolproof? Will it be a seamless effect or will it sound a little off, like a second of the previous battle music before the new song takes over? Thank you to anyone who reads.

I've been playing through the "Earthbound Beginnings" port of Mother on the Switch and noticed that music changes depending on the troop just this morning. It's a very nice touch.

In 2k/3 you can change the battle theme using the "Change Battle BGM" command at will within events. You can also use this command within the "Groups" or "Troops" tab and set conditions that cause it to trigger during a battle with that enemy group.

I'm not sure how that translates to later versions.
he only way I can think of is with parallels.
the problem isn't changing the setting, the problem is that the BGM setting for battles is a map-property and not referenced after the battle has moved to the battlescreen.
as such even the parallels will do nothing

and as soon as you force the battlescreen to reload its music settings with the script function, that change can be done from any place, including troop events or skill common events - no need for special timing.
Will it be a seamless effect or will it sound a little off, like a second of the previous battle music before the new song takes over?
if you leave your game's standard battle theme to "none", you can start every battle with a troop event to play a specific track for the troop. additionally, if you own yanfly's plugins, theres a plugin thatll let you assign themes to individual troops thatll override the default one.
As for your other question, there doesn't seem to be a fool proof method to do a seemless transition.
You can check some older threads,
Using Coelacanth's random encounters plugin you can have random encounters launch a common event, instead of immediately starting the battle. In that event, you can put a script or such that changes the battle music to a certain one depending on the troop number.

You could also do as was said above, ie not select a general battle music, then at the very start of each troop put an event that changes the music. If you do that, you can still use the plugin i linked to reset the battle music after each encounter
And to change the battle music in the troop event, you don't have to script, just using the regular "change battle bgm" event command during the battle will work
INV_TrackTroop.js by Victor does this too. I have tested in MZ and it does not appear to conflict visustella core. The plugin states that it also works in MV.
sorry for slow reply lol just got busy
Using Coelacanth's random encounters plugin you can have random encounters launch a common event
thank you for the recommendation, but it seems like the script is lost... it says "The system is down." when i click the link 🙁
if you have a mirror anywhere please let me know, this seems perfect for what i was going for otherwise
additionally, if you own yanfly's plugins, theres a plugin thatll let you assign themes to individual troops thatll override the default one
this should do perfectly, purchased it just now!

thank you to everyone for your help 😀

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/choose-music-per-troop-like-the-mother-series.175928/