Unique music by Troop Type?

So I am using RPG Maker XP for a project for school, and I need help with something.  In my game I want to have random encounters with unique battle music.  For example if the player encounters a Bubble and a Slime via random encounter, it'll play different music than just a Bubble.

I already know how to create events on the overworld that trigger a battle with unique music, it's just random encounters I need help with.
If your random encounters change on each map, you can just use a Change Battle BGM command in a parallel processing event on each map, with an Erase Event command afterwards. That will make the battle music change each time you enter a different map.


If you want it to change on the same map and the enemies are in specific areas, and the entrance to each area is narrow enough to not require too many events, you can do the same thing with a Player Touch event along each tile on the entrance.


If there are several different types of enemies on a single map, and the entrance to each area is too big to make it logical to use events, or the enemy types are not constrained to specific areas, then you will need a script. Have a look around, as I know there were Ace scripts that did this, so there might be something similar for XP.
Are you asking about altering battle music on a map by map basis, or a troop by troop basis. Because if you want each troop to play their own kind of music, couldn't that be set up in the database troop events?
I'm looking for by troop type.  I tried setting it up in the troop database, but it didn't seem to affect it at all and kept using the previously used song.  (ex. in the previous room, I has an event fight and it changed the battle BGM to, say, song1.  During a random encounter in the next room, I wanted it to play song2, but instead it played song1.)
You can set a blank default music to your battle BGM in the System tab (i don't remember if (none) is available), then use the Play BGM command at turn 0 of every troop. That way, you can select the music you want per troop.
I've heard it works in newer versions, but I just tried that in XP and it doesn't seem to work.  I keep running into the problem described above.
Best way would be for touch encounters, that way you can alter them in the event with the battlers. You can also still have random troops in the event touch encounters, and depending on which troop decide the music. But with random encounters in the database, I haven't tried the blank BGM approach, but I recall trying to change the music once in battle, and it got all sorts of confusing. Not sure why BGM's have to be so sensitive, when that should be easiest thing to work with.

Original thread: https://forums.rpgmakerweb.com/threads/unique-music-by-troop-type.54293/