Menu Music

Hey guys, I am very new to RPG Maker and I was just wondering if it was possible to have menu music that plays on the menu and keeps on playing during the Items/Skills/Status/etc. menus but then returns to the BGM theme once you completely exit out of the menu? If that makes sense >.<
 
Here's a script I found by a guy on the internet named Soulpour777, which is almost what I want, but the music doesn't play throughout the items screen and what not, and when I did modify it to play on all screens, the menu music kept resetting :/ (for example, the song would be playing on the menu screen, then when you select Status, the song would reset)

But yeah, here's the script:

Spoiler
#==============================================================================
# Menu BGM EX
# Soulpour777
# Web URL: www.infinitytears.wordpress.con
# This script is a request by lionheartvll
# lionheartvll http://www.rpgmakervxace.net/topic/24712-menu-song/
#------------------------------------------------------------------------------
# Description:
# This script allows the developer to play a different BGM when the Menu is
# opened.
#==============================================================================

module Soulpour
module Menu_BGM
PLAY_NEW_BGM = true #play different music on menu?
def self.play_menubgm
RPG::BGM.new("music", 100, 100).play #BGM Name, Volume, Pitch
end
end

end

class Scene_Menu < Scene_MenuBase
alias :menu_bgm_play_start :start
#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
def start
menu_bgm_play_start
return if !Soulpour::Menu_BGM:😛LAY_NEW_BGM
Soulpour::Menu_BGM.play_menubgm

end

#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_background
return if !Soulpour::Menu_BGM:😛LAY_NEW_BGM
$game_map.autoplay

end

end
Any help would be greatly appreciated!!
You can try this script I wrote:

Spoiler
Code:
# Menu BGM
# Made by: Sixth

module BGM_Saver

  # Set up your menu BGM here.  
  # Format: RPG::BGM.new("file name",volume,pitch)  
  MenuBGM = RPG::BGM.new("Town1",100,100)    
	
  # Set up the Map BGM replay mode here.  
  # true = Will continue the map BGM from the exact time it changed.  
  # false = Will replay the map BGM from the beginning.  
  MapReplay = false
	
  # No touchy-touchy below!    

  def self.save_bgm    
    if SceneManager.scene_is?(Scene_Map)      
      @lastbgm_map = RPG::BGM.last    
    elsif SceneManager.scene_is?(Scene_Menu)      
      @lastbgm_menu = RPG::BGM.last    
    end  
  end    
	
  def self.get_last_bgm(type)    
    case type    
    when :map;  return @lastbgm_map
    when :menu; return @lastbgm_menu    
    end  
  end
  
end

module SceneManager    

  class << self; alias save_lastbgm5814 call; end  
  def self.call(scene_class)    
    if scene_is?(Scene_Menu) || scene_is?(Scene_Map)      
      BGM_Saver.save_bgm    
    end    
    save_lastbgm5814(scene_class)    
    if scene_is?(Scene_Menu) || scene_is?(Scene_Map)      
      BGM_Saver.save_bgm    
    end  
  end 
	
  class << self; alias save_lastbgm7774 call; end  
  def self.goto(scene_class)    
    save_lastbgm7774(scene_class)    
    if scene_class == Scene_Map      
      if BGM_Saver::MapReplay == true
        last = BGM_Saver.get_last_bgm(:map)      
        last.replay if last      
      else        
        $game_map.autoplay      
      end    
    end  
  end
	
end

class Scene_Menu < Scene_MenuBase    
	
  alias add_bgm_changes9986 start  
  def start    
    add_bgm_changes9986    
    last = BGM_Saver.get_last_bgm(:menu)    
    menubgm = BGM_Saver::MenuBGM    
    menubgm.play if last && last.name != menubgm.name  
  end
	
  alias add_bgm_saves8874 terminate  
  def terminate    
    add_bgm_saves8874    
    if SceneManager.scene_is?(Scene_Map)            
      if BGM_Saver::MapReplay == true
        last = BGM_Saver.get_last_bgm(:map)
        last.replay if last      
      else        
        $game_map.autoplay      
      end
    end
  end
	
end
You can try this script I wrote:

Spoiler
# Menu BGM## Made by: Sixthmodule BGM_Saver # Set up your menu BGM here. # Format: RPG::BGM.new("file name",volume,pitch) MenuBGM = RPG::BGM.new("Town1",100,100) # Set up the Map BGM replay mode here. # true = Will continue the map BGM from the exact time it changed. # false = Will replay the map BGM from the beginning. MapReplay = false # No touchy-touchy below! def self.save_bgm if SceneManager.scene_is?(Scene_Map) @lastbgm_map = RPG::BGM.last elsif SceneManager.scene_is?(Scene_Menu) @lastbgm_menu = RPG::BGM.last end end def self.get_last_bgm(type) case type when :map return @lastbgm_map when :menu return @lastbgm_menu end end endmodule SceneManager class << self; alias save_lastbgm5814 call; end def self.call(scene_class) if scene_is?(Scene_Menu) || scene_is?(Scene_Map) BGM_Saver.save_bgm end save_lastbgm5814(scene_class) if scene_is?(Scene_Menu) || scene_is?(Scene_Map) BGM_Saver.save_bgm end endendclass Scene_Menu < Scene_MenuBase alias add_bgm_changes9986 start def start add_bgm_changes9986 last = BGM_Saver.get_last_bgm🙂menu) menubgm = BGM_Saver::MenuBGM menubgm.play if last && last.name != menubgm.name end alias add_bgm_saves8874 terminate def terminate add_bgm_saves8874 if SceneManager.scene_is?(Scene_Map) last = BGM_Saver.get_last_bgm🙂map) if BGM_Saver::MapReplay == true last.replay if last else $game_map.autoplay end end end end
Thank you!! I'm not home right now but I'll try it as soon as I get home and let you know how it works :3

EDIT: There is one thing I want to make sure, though: does the menu music continue to play while in the Item/Status/Skills/etc menus?
Yes, it should still play the menu BGM even on the other menu scenes.
Yes, it should still play the menu BGM even on the other menu scenes.
Just got home and tried it.

It works beautifully~ Thank you so much!

If I ever do finish my game or release it to the public, I will definitely credit you!

EDIT: Actually, and sorry to bother you again, but there's still one small problem: whenever I pause inside of a building, when I cancel out of the pause menu the Menu BGM keeps on playing. Any ideas?

EDIT AGAIN: Never mind! I set the MapReplay to "true" and it works now. Once again, thanks a lot! ^^

OOOH... I see why that happened. It's whenever I use a consumable item. When I use the item, the game exits the menu and goes back to the map, and the Menu BGM keeps on playing. Any way to fix this?? x3
Bump!
Whoopsy, I forgot that 'goto' method...


The script is updated above, it should change back to the map BGM after item/skill with common event usage now.
Whoopsy, I forgot that 'goto' method...

The script is updated above, it should change back to the map BGM after item/skill with common event usage now.
Omg You rock!! :3 Thank you!
Hi Sixth.. i like to try your Script but i ended up confusing myself try to paste the raw code above


can you make it a file like Github, so it is clear what line the code does.. Thank you   
Yeah, the forum update broke these old codes. >.>


I fixed the script here and also uploaded it onto my pastebin ( http://pastebin.com/GnupjwSw ).
Thanks Sixth, the Script is amazing, love it hahaha

Original thread: https://forums.rpgmakerweb.com/threads/menu-music.47441/