keeping a BGM playing when entering battle processing

So I start a scene where a BGM starts playing, and after a few lines of dialogue, I run a battle processing event.  I want the BGM to flow continuously into the battle - not start over from the beginning of the track.  Is there a way to do this?    It seems that in XP, BGM's stop playing by default when a battle processing event runs, and I'm not sure how to make this not be the case.


Thanks in advance.
Does this apply to just this one battle only, or to all battles?  What about random battles?  


Do the above answers also apply to the battle start SE?
I just want it for one specific battle, which occurs after/during a cut scene...I want the BGM of the cutscene to also be the BGM of the battle, but i don't want the track to randomly restart when the battle starts (otherwise i'd obviously just use the change battle BGM event command).


The SE during the transition to battle processing still occurs but I'm fine with that.
And the SE for battle start?
I''d prefer the SE stay the same as always, but if there's an easy way to have the BGM stay continuous that disables the SE, I might be able to live with that.  


After doing some digging I think I found a script to accomplish this.  Surprised this couldn't be accomplished through regular eventing, but in case someone else comes across this same problem:

Code:
[COLOR=rgb(136,0,0)]#===================================[/COLOR][COLOR=rgb(0,0,0)]
[/COLOR][COLOR=rgb(136,0,0)]#  Leon's battle BGM Fix[/COLOR][COLOR=rgb(0,0,0)]
[/COLOR][COLOR=rgb(136,0,0)]#----------------------------------------------------------------------[/COLOR][COLOR=rgb(0,0,0)]
[/COLOR][COLOR=rgb(136,0,0)]#  Feature:[/COLOR][COLOR=rgb(0,0,0)]
[/COLOR][COLOR=rgb(136,0,0)]#    You can turn off the battle music for battles, and let the[/COLOR][COLOR=rgb(0,0,0)]
[/COLOR][COLOR=rgb(136,0,0)]#    bgm play through.  It will only be interupted by the music[/COLOR][COLOR=rgb(0,0,0)]
[/COLOR][COLOR=rgb(136,0,0)]#    effect of battle, then the music fades back in.[/COLOR][COLOR=rgb(0,0,0)]
[/COLOR][COLOR=rgb(136,0,0)]#[/COLOR][COLOR=rgb(0,0,0)]
[/COLOR][COLOR=rgb(136,0,0)]#  Instructions:[/COLOR][COLOR=rgb(0,0,0)]
[/COLOR][COLOR=rgb(136,0,0)]#    Place after Scene_Debug, but before Main[/COLOR][COLOR=rgb(0,0,0)]
[/COLOR][COLOR=rgb(136,0,0)]#    set SWITCH_TO_BYPASS equal to the switch that needs[/COLOR][COLOR=rgb(0,0,0)]
[/COLOR][COLOR=rgb(136,0,0)]#    to be on for this to work.  So, if SWITCH_TO_BYPASS equalled 1,[/COLOR][COLOR=rgb(0,0,0)]
[/COLOR][COLOR=rgb(136,0,0)]#    and switch 1 is on, the BGM plays through battle.  When switch[/COLOR][COLOR=rgb(0,0,0)]
[/COLOR][COLOR=rgb(136,0,0)]#    1 is off, it will turn on the battle background music.[/COLOR][COLOR=rgb(0,0,0)]
[/COLOR][COLOR=rgb(136,0,0)]#===================================[/COLOR][COLOR=rgb(0,0,0)]

[/COLOR][COLOR=rgb(0,0,136)]class[/COLOR][COLOR=rgb(0,0,0)] [/COLOR][COLOR=rgb(102,0,102)]Scene_Map[/COLOR][COLOR=rgb(0,0,0)]
  [/COLOR][COLOR=rgb(0,0,136)]alias[/COLOR][COLOR=rgb(0,0,0)] leon_bgmfix_scenemap_callbattle call_battle
  SWITCH_TO_BYPASS [/COLOR][COLOR=rgb(102,102,0)]=[/COLOR][COLOR=rgb(0,0,0)] [/COLOR][COLOR=rgb(0,102,102)]12[/COLOR][COLOR=rgb(0,0,0)]

  [/COLOR][COLOR=rgb(0,0,136)]def[/COLOR][COLOR=rgb(0,0,0)] call_battle
    $game_temp[/COLOR][COLOR=rgb(102,102,0)].[/COLOR][COLOR=rgb(0,0,0)]battle_calling [/COLOR][COLOR=rgb(102,102,0)]=[/COLOR][COLOR=rgb(0,0,0)] [/COLOR][COLOR=rgb(0,0,136)]false[/COLOR][COLOR=rgb(0,0,0)]
    $game_temp[/COLOR][COLOR=rgb(102,102,0)].[/COLOR][COLOR=rgb(0,0,0)]menu_calling [/COLOR][COLOR=rgb(102,102,0)]=[/COLOR][COLOR=rgb(0,0,0)] [/COLOR][COLOR=rgb(0,0,136)]false[/COLOR][COLOR=rgb(0,0,0)]
    $game_temp[/COLOR][COLOR=rgb(102,102,0)].[/COLOR][COLOR=rgb(0,0,0)]menu_beep [/COLOR][COLOR=rgb(102,102,0)]=[/COLOR][COLOR=rgb(0,0,0)] [/COLOR][COLOR=rgb(0,0,136)]false[/COLOR][COLOR=rgb(0,0,0)]
    $game_player[/COLOR][COLOR=rgb(102,102,0)].[/COLOR][COLOR=rgb(0,0,0)]make_encounter_count
    $game_temp[/COLOR][COLOR=rgb(102,102,0)].[/COLOR][COLOR=rgb(0,0,0)]map_bgm [/COLOR][COLOR=rgb(102,102,0)]=[/COLOR][COLOR=rgb(0,0,0)] $game_system[/COLOR][COLOR=rgb(102,102,0)].[/COLOR][COLOR=rgb(0,0,0)]playing_bgm
    $game_system[/COLOR][COLOR=rgb(102,102,0)].[/COLOR][COLOR=rgb(0,0,0)]se_play[/COLOR][COLOR=rgb(102,102,0)]([/COLOR][COLOR=rgb(0,0,0)]$data_system[/COLOR][COLOR=rgb(102,102,0)].[/COLOR][COLOR=rgb(0,0,0)]battle_start_se[/COLOR][COLOR=rgb(102,102,0)])[/COLOR][COLOR=rgb(0,0,0)]
    [/COLOR][COLOR=rgb(0,0,136)]unless[/COLOR][COLOR=rgb(0,0,0)] $game_switches[/COLOR][COLOR=rgb(102,102,0)][[/COLOR][COLOR=rgb(0,0,0)]SWITCH_TO_BYPASS[/COLOR][COLOR=rgb(102,102,0)]][/COLOR][COLOR=rgb(0,0,0)] [/COLOR][COLOR=rgb(102,102,0)]==[/COLOR][COLOR=rgb(0,0,0)] [/COLOR][COLOR=rgb(0,0,136)]true[/COLOR][COLOR=rgb(0,0,0)]
      $game_system[/COLOR][COLOR=rgb(102,102,0)].[/COLOR][COLOR=rgb(0,0,0)]bgm_stop
      $game_system[/COLOR][COLOR=rgb(102,102,0)].[/COLOR][COLOR=rgb(0,0,0)]bgm_play[/COLOR][COLOR=rgb(102,102,0)]([/COLOR][COLOR=rgb(0,0,0)]$game_system[/COLOR][COLOR=rgb(102,102,0)].[/COLOR][COLOR=rgb(0,0,0)]battle_bgm[/COLOR][COLOR=rgb(102,102,0)])[/COLOR][COLOR=rgb(0,0,0)]
    [/COLOR][COLOR=rgb(0,0,136)]end[/COLOR][COLOR=rgb(0,0,0)]
    $game_player[/COLOR][COLOR=rgb(102,102,0)].[/COLOR][COLOR=rgb(0,0,0)]straighten
    $scene [/COLOR][COLOR=rgb(102,102,0)]=[/COLOR][COLOR=rgb(0,0,0)] [/COLOR][COLOR=rgb(102,0,102)]Scene_Battle[/COLOR][COLOR=rgb(102,102,0)].[/COLOR][COLOR=rgb(0,0,136)]new[/COLOR][COLOR=rgb(0,0,0)]
  [/COLOR][COLOR=rgb(0,0,136)]end[/COLOR][COLOR=rgb(0,0,0)]
[/COLOR][COLOR=rgb(0,0,136)]end[/COLOR]
Try this ...


allocate (and name) a switch called Preserve BGM.  At the start of this scene, turn the switch on.  After the battle ends, turn the switch off.  I'll use switch 15 in the code below, but change that to whatever number is appropriate.


Pop this into a new script slot just above Main.

Code:
class Game_System
  alias preserve_bgm_bgm_play bgm_play
  def bgm_play(bgm)
    preserve_bgm_bgm_play if !$game_switches[15] # <<<<<<<<<<<<<<<<<<<< PUT YOUR SWITCH NUMBER HERE
  end
end

class Scene_Map
  def call_battle
    # Clear battle calling flag
    $game_temp.battle_calling = false
    # Clear menu calling flag
    $game_temp.menu_calling = false
    $game_temp.menu_beep = false
    # Make encounter count
    $game_player.make_encounter_count
    # Change bgm if preserve switch is off
    if !$game_switches[15]  # <<<<<<<<<<<<<<<<<<<<<<<<<<< PUT YOUR SWITCH NUMBER HERE
      # Memorize map BGM and stop BGM
      $game_temp.map_bgm = $game_system.playing_bgm
      $game_system.bgm_stop
      # Play battle BGM
      $game_system.bgm_play($game_system.battle_bgm)
    end
    # Play battle start SE
    $game_system.se_play($data_system.battle_start_se)
    # Straighten player position
    $game_player.straighten
    # Switch to battle screen
    $scene = Scene_Battle.new
  end
end

If you have other custom scripts that modify either of these two methods, it might not work.

Original thread: https://forums.rpgmakerweb.com/threads/keeping-a-bgm-playing-when-entering-battle-processing.68134/