Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

LAWS Menu Music

LAWS Menu Music

Version 2.0
The Law G14/TheScripter
10/11/09


Introduction

I already had this script over at RRR but I decided to bring it here as well. I saw a script like this before for vx by Sojabird and since I noticed that a lot of people seemed to like it, I made one for xp. Basically what it does is play a different music then the map music when you enter the menu. Hope you guys like it :)


Features

- Plays music in menu

- Plug n’ Play

- Can choose if you would like the BGM to be just the Map BGM except faded out a little (In Version 2.0)


Script


[rgss]#------------------------------------------------------------------------------
#==============================================================================
#==============================================================================
#=========================*Law's Menu Music*===================================
#=========================Author: The Law G14==================================
#===================Original VX script by Sojabird=============================
#=======================Bug fixes by Night Runner==============================
#============================Version 2.0=======================================
#==============================================================================
#------------------------------------------------------------------------------
 
#==============================================================================
# ** Music_Custom [CUSTOMIZATION WITHIN THIS MODULE]
#------------------------------------------------------------------------------
#  This module contains the main customization within the script
#==============================================================================
 
module Music_Custom
 
  # Fade Map Music (If true, the menu music will be a softer verision of the
  # map music
  Fade_Map_BGM = true
 
  # Set the file of the BGM for the Menu Music
  File = "Audio/BGM/001-Battle01"
 
end
 
#===============================================================================
# ** Scene_Menu
#-------------------------------------------------------------------------------
# This class performs menu screen processing.
#===============================================================================
 
class Scene_Menu
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias law_music_scene_menu_initialize   initialize  
  alias law_music_scene_menu_main         main        
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------  
  def initialize(*args)
    if Music_Custom::Fade_Map_BGM
      # Dim down volume of bgm when entering menu
      $game_system.playing_bgm.volume = 50
      $game_system.bgm_play($game_system.bgm_memorize)
    else
      Audio.bgm_play(Music_Custom::File, 100, 100)
    end
    # Call original method
    return law_music_scene_menu_initialize(*args)
  end
  #-----------------------------------------------------------------------------
  # * Main
  #-----------------------------------------------------------------------------
  def main
    # Call original method
    law_music_scene_menu_main
    if Music_Custom::Fade_Map_BGM
      # If scene is equal to default, restore bgm to original method
      $game_system.playing_bgm.volume = 100 if $scene.is_a?(Scene_Map)
      $game_system.bgm_play($game_system.bgm_memorize)
    else
      $game_system.bgm_restore if $scene.is_a? Scene_Map
    end
  end
end
 
 
#===============================================================================
# ** Scene_Item
#-------------------------------------------------------------------------------
#  This class performs item screen processing.
#===============================================================================
 
class Scene_Item
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias law_music_scene_item_main         main  
  #-----------------------------------------------------------------------------
  # * Update Command
  #-----------------------------------------------------------------------------
  def main
    # Call original method
    law_music_scene_item_main
    if Music_Custom::Fade_Map_BGM
      # If scene is back to map, restore volume to default
      $game_system.playing_bgm.volume = 100 if $scene.is_a?(Scene_Map)
      $game_system.bgm_play($game_system.bgm_memorize)
    else
      $game_system.bgm_restore if $scene.is_a? Scene_Map
    end
  end
end
[/rgss]


Compatibility

Will probably run into issues with scripts that edit the menu.


Installation

Customize your script at the top.


FAQ

None as of now.


Terms and Conditions

Please credit me where it is due.



Special Thanks

Special Thanks to Sojabird and his script for giving me the idea to do this script.

Thanks to Night Runner for Bug fixes as well as Redd for suggesting the idea on the faded Map BGM
 

regi

Sponsor

Simple little script, but quite useful! I like it. Ain't much to comment on, which is a good thing. Normally I would say, make a method for restoring BGM (upon reentering Scene_Map) since you wrote the same lines twice for Scene_Menu and Scene_Item, but it's so small it doesn't really matter.
 
Yea I could do that to improve readibility or something and to eliminate more than one instance of a block of code, but like you said it's so small it wouldn't really make much of a difference. Thanks for the comment and I'm glad you find it useful!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top