Keeping music through encounters (Mainly victory screen)

Hello I am just curious how you keep music playing seamlessly through encounters. (example like the outer part of Zanarkand in FFX )
It sound's simple enough, but for some reason the victory music despite having the exact same volume settings as the map and battle theme and the same file, it restarts and plays slightly quieter which just sounds awkward. I have also tried choosing no file but that just changes the victory music to default.
Just an example of the code used, tested again and still same issue. (I would show video proof however i am on phone internet so that is not possible right now 🙁 )
1710512806577.png


Thank you for any assistance if possible.
I'm not sure if there's some specific trickery in the editor that will allow this; failing that, you can paste all the below into a text editor, save as a *.js file, include as a plugin.

Code:
Scene_Map.prototype.updateEncounterEffect = function() {
    if (this._encounterEffectDuration > 0) {
        this._encounterEffectDuration--;
        var speed = this.encounterEffectSpeed();
        var n = speed - this._encounterEffectDuration;
        var p = n / speed;
        var q = ((p - 1) * 20 * p + 5) * p + 1;
        var zoomX = $gamePlayer.screenX();
        var zoomY = $gamePlayer.screenY() - 24;
        if (n === 2) {
            $gameScreen.setZoom(zoomX, zoomY, 1);
            this.snapForBattleBackground();
            this.startFlashForEncounter(speed / 2);
        }
        $gameScreen.setZoom(zoomX, zoomY, q);
        if (n === Math.floor(speed / 6)) {
            this.startFlashForEncounter(speed / 2);
        }
        if (n === Math.floor(speed / 2)) {
            if (!$gameSwitches.value(69))
                BattleManager.playBattleBgm();
            this.startFadeOut(this.fadeSpeed());
        }
    }
};

BattleManager.playVictoryMe = function() {
    if (!$gameSwitches.value(69))
        AudioManager.playMe($gameSystem.victoryMe());
};

BattleManager.replayBgmAndBgs = function() {
    if (this._mapBgm) {
        if (!$gameSwitches.value(69))
            AudioManager.replayBgm(this._mapBgm);
    } else {
        AudioManager.stopBgm();
    }
    if (this._mapBgs) {
        AudioManager.replayBgs(this._mapBgs);
    }
};

You'd set the BGM on your map, then so long as switch 69 is turned on, it will not play the battle or victory music, nor reload the map music.

Change all instances of 69 to whatever switch ID you want.
Thank you for this. Just 1 question ( I answered my first one myself lol ) is there a specific place to be putting the JS plugin? ( as in what order to list them in to not cause too much issues)

Original thread: https://forums.rpgmakerweb.com/threads/keeping-music-through-encounters-mainly-victory-screen.166824/