The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Tutorials and Eventing => Topic started by: Jouninwolf on September 29, 2006, 07:41:35 PM

Title: How do you make it play music when you open the menu?
Post by: Jouninwolf on September 29, 2006, 07:41:35 PM
How can I make it so that everytime I open the menu it plays music, and when I close the menu the music changes back to the map's music? Thanks in advance, I appreciate your help.
Title: Re: How do you make it play music when you open the menu?
Post by: Blizzard on September 29, 2006, 08:40:05 PM
I'm not at home right now, so I can't give you an exact code. Can you bump this topic tomorrow? I'll tell you what to do with the script I'm gonna give to you.
Title: Re: How do you make it play music when you open the menu?
Post by: Jouninwolf on September 29, 2006, 10:14:18 PM
Alrighty, thanks ^_^ I appreciate it.
Title: Re: How do you make it play music when you open the menu?
Post by: Blizzard on September 30, 2006, 12:30:39 PM
Here you go. Don“t forget to set it up. Share this script and post it anywhere if you like.

#==============================================================================
# Menu BGM player by Blizzard
#
# Instructions:
# Just set up the part below. This script comes over main and UNDER any CMS.
#
# Compatibility
# 100% compatible with anything except completely changed basic scripts
#==============================================================================

MENU_BGM = "001-Battle01" # name of the BGM
VOL = 100 # volume of the BGM
PITCH = 100 # pitch of the BGM

#==============================================================================
# Scene_Map
#==============================================================================

class Scene_Map
 
  alias call_menu_bgm_later call_menu
  def call_menu
    call_menu_bgm_later
    $game_temp.map_bgm = $game_system.playing_bgm
    $game_system.bgm_stop
    Audio.bgm_play("Audio/BGM/" + MENU_BGM, VOL, PITCH)
  end
 
end

#==============================================================================
# Scene_Menu
#==============================================================================

class Scene_Menu
 
  alias main_bgm_later main
  def main
    main_bgm_later
    $game_system.bgm_stop
    $game_system.bgm_play($game_temp.map_bgm)
  end
 
end