Ever wanted the music to change to a set piece when you open your menu and to change back to the music that was playing on the map after you leave the menu? Well, here you go. Read the notes in the script or the notes after the script. They're the same notes but are also included in the script so you can look at them any time. Just read the notes and you shouldn't have any trouble understanding how to use the script. It was a few months ago that this was requested but I decided to repost it for use.
#-----------------------------------------------------------------
#----------------------Music in the Menu----------------------
#----------------------written by Shinami---------------------
#-----------------------------------------------------------------
#I decided to write this little script after I saw it had
#been requested on the Crankeye forums. It's really
#simple and easy to use. You just need to leave the
#quotation marks " " around your song name. If
#the name isn't the exact same as the one in your BGM
#folder, you will have problems.
#-----------------------------------------------------------------
#-------------------INCOMPATIBILITY-----------------------
#-----------------------------------------------------------------
#I havn't tested this on any other scripts outside of my own
#but since I used aliases, there should be a .01% chance
#of incompatibility. Basically, it'll only screw up when
#Hell freezes over, if you mistype the song name, or if
#you're using a CMS customly built using a different class
#name than Scene_Menu. I don't mind merging this into
#a CMS BUT you will need to post the CMS script or a
#link to the incompatible script if you want the merge to
#be done. I won't always immediately respond either
#since I do have a life outside of the internet.
#-----------------------------------------------------------------
#----------------HOW TO USE THIS SCRIPT----------------
#-----------------------------------------------------------------
#Insert the script above the script called Main and call it
#what ever you want. Afterwards, replace the text
#SONG NAME GOES HERE with the name of the music
#you want to play in the menu and it'll work just fine.
#-----------------------------------------------------------------
#------------------TOTAL TIME TAKEN----------------------
#-----------------------30 MINUTES--------------------------
#-----------------------------------------------------------------
#Also, thanks go to Blizzard for fixing a small error I
#overlooked!
#Okies...update #2 now makes it work like it was
#was intended to.
#Update #3 is to keep your background sounds from being stopped.
class Scene_Menu
alias initialize_later initialize
def initialize(menu_index = 0)
initialize_later(menu_index = 0)
bgm_name = "SONG NAME GOES HERE"#Name of file must match what you put here.
bgm_volume = 0 #How loud the music plays
bgm_pitch = 100#How fast the music plays
$game_system.bgs_memorize
Audio.bgs_stop
if $game_system.playing_bgm != bgm_name
@bgm = $game_system.playing_bgm #stores the map's music, $game_system.playing_bgm, for later use
Audio.bgm_play("Audio/BGM/" + bgm_name, bgm_volume, bgm_pitch)#begins playing menu music
end
end
alias update_command_later update_command
def update_command
update_command_later
if Input.trigger?(Input::B) and $scene.is_a?(Scene_Map)#This checks to see if you are exiting the menu.
#This plays the predefined cancel sound effect
$game_system.se_play($data_system.cancel_se)
#This tells the game to go back to the map.
$scene = Scene_Map.new
$game_system.bgs_restore
$game_system.bgm_play(@bgm)#recalls the map's music, @bgm, and begins playing.
end
end
end
#-----------------------------------------------------------------
#----------------------Music in the Menu----------------------
#----------------------written by Shinami---------------------
#-----------------------------------------------------------------
#I decided to write this little script after I saw it had
#been requested on the Crankeye forums. It's really
#simple and easy to use. You just need to leave the
#quotation marks " " around your song name. If
#the name isn't the exact same as the one in your BGM
#folder, you will have problems.
#-----------------------------------------------------------------
#-------------------INCOMPATIBILITY-----------------------
#-----------------------------------------------------------------
#I havn't tested this on any other scripts outside of my own
#but since I used aliases, there should be a .01% chance
#of incompatibility. Basically, it'll only screw up when
#Hell freezes over, if you mistype the song name, or if
#you're using a CMS customly built using a different class
#name than Scene_Menu. I don't mind merging this into
#a CMS BUT you will need to post the CMS script or a
#link to the incompatible script if you want the merge to
#be done. I won't always immediately respond either
#since I do have a life outside of the internet.
#-----------------------------------------------------------------
#----------------HOW TO USE THIS SCRIPT----------------
#-----------------------------------------------------------------
#Insert the script above the script called Main and call it
#what ever you want. Afterwards, replace the text
#SONG NAME GOES HERE with the name of the music
#you want to play in the menu and it'll work just fine.
#-----------------------------------------------------------------
#------------------TOTAL TIME TAKEN----------------------
#-----------------------30 MINUTES--------------------------
#-----------------------------------------------------------------
#Also, thanks go to Blizzard for fixing a small error I
#overlooked!
#Okies...update #2 now makes it work like it was
#was intended to.
#Update #3 is to keep your background sounds from being stopped.