Menu Music

Hikari_Jake

Veteran
Veteran
Joined
Oct 26, 2015
Messages
54
Reaction score
10
First Language
English
Primarily Uses
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:

#==============================================================================
# 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::pLAY_NEW_BGM
Soulpour::Menu_BGM.play_menubgm

end

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

end

end
Any help would be greatly appreciated!!
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
823
First Language
Hungarian
Primarily Uses
RMVXA
You can try this script I wrote:

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
 
Last edited by a moderator:

Hikari_Jake

Veteran
Veteran
Joined
Oct 26, 2015
Messages
54
Reaction score
10
First Language
English
Primarily Uses
You can try this script I wrote:

# 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?
 
Last edited by a moderator:

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
823
First Language
Hungarian
Primarily Uses
RMVXA
Yes, it should still play the menu BGM even on the other menu scenes.
 

Hikari_Jake

Veteran
Veteran
Joined
Oct 26, 2015
Messages
54
Reaction score
10
First Language
English
Primarily Uses
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
 
Last edited by a moderator:

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
823
First Language
Hungarian
Primarily Uses
RMVXA
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.
 

Hikari_Jake

Veteran
Veteran
Joined
Oct 26, 2015
Messages
54
Reaction score
10
First Language
English
Primarily Uses
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!
 

FlyImagi

Creative Crafting
Member
Joined
Jul 11, 2016
Messages
17
Reaction score
0
First Language
English
Primarily Uses
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   
 

FlyImagi

Creative Crafting
Member
Joined
Jul 11, 2016
Messages
17
Reaction score
0
First Language
English
Primarily Uses
Thanks Sixth, the Script is amazing, love it hahaha
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,048
Messages
1,018,545
Members
137,834
Latest member
EverNoir
Top