MV Battle Music Fadeout

Hi People,
Is there any way to slowly fadeout the battle music after victory/defeat?
And I mean the battle music, not victory or defeat music (i'm not using those).
It's just very annoying when it stops immediately.
Moved to: Plugin Requests
The trick with this is knowing when to do it. So by default the victory music plays until the player hits the button to exit the battle aftermath screen, at which point the map loads back in, which starts the map BGM, which automatically cuts off the victory music.

So, as far as I can think, you have two options:
1) Play a predefined short amount of the victory music with a fade built in. This might result in the player looking at their leveled up stats or the loot they got and the music has already stopped.

2) You add some code (essentially an extra miniature scene) which gets triggered when they confirm on the aftermath, and fades out the screen as well as the music, waiting for the latter to complete before calling the map scene.
I've moved this thread to Plugin Requests. Thank you.
Well, there's a reason why I haven't posted that in plugin requests myself. A plugin is always a last resort for me. I prefer to avoid them.


I was thinking more of something I could place in a battle event. A simple fadeout BGM works in there (I checked it for a specific battle turn)
But I need a good condition for it.
I've tried "if enemy state is 'knocked out'" but it's too late for fadeout.
I'm not sure if a condition with variable checking enemy's HP when it hits 0 will be any different or is the knocked out state set immediately in the same time.

Or maybe there's a better idea for a condition in the battle event I haven't thought of?
Well, there's a reason why I haven't posted that in plugin requests myself. A plugin is always a last resort for me. I prefer to avoid them.
The reason it was moved is because this isn't something you can do via eventing. By the time you've finished the battle and victory music is playing, that's a separate scene in the game that you have no control over with events.
Well, there's a reason why I haven't posted that in plugin requests myself. A plugin is always a last resort for me. I prefer to avoid them.
If we know something can only be done via plugins, we will move it, even if you didn't ask for a plugin.
Pardon me then. It seemed like an obvious thing to achieve by using basic options...

I did some research and I've found a script for that in VX Ace.

Code:
module BattleManager

 FADE_TIME = 15 #number of seconds to fade out

 def self.play_battle_end_me

RPG::BGM.fade(FADE_TIME * 1000)

end

end

Any idea how to "translate" it for MV?
Bump.

Original thread: https://forums.rpgmakerweb.com/threads/battle-music-fadeout.142138/