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.

Menu music

Seda

Member

I know I've seen something like this a few years back, (before I even understood what scripting was T_T) and I was wondering if anyone had the/a script that allowed different music to be played in the menu.

Let me go into detail here:

For those that have played the game, I am looking for something similar to Final fantasy 1's menu where every time the menu opens, it plays it's menu song.

For those that have not played the game, I am looking for a script that allows ME to select (not the player) a song from the audio/BGM folder that plays every time the player opens up the menu screen, but when the player exits out of the menu, it continues with the song that was playing on the map they are on.
 
Sorry, I've been away from my computer for a few days. I just got back from visiting my family last night, so I'll try to take a look at this again.

EDIT: Ok then, I'm not sure what was wrong with the scripts in your project so I moved them all into another project and it worked fine. I tried to get it so that it memorized the map BGM's position, but it turns out that you would need another script for that. I put in one of these kinds of scripts and was having some compatibility issues. But anyways, it seems to be working fine now, except the map BGM has to restart after closing the menu. Just replace the scripts file in your data folder with this one:

http://www.megaupload.com/?d=N92KOJ1Z

But just in case I screwed anything up, save a copy of your old scripts file so you can go back to that if you need to.

@Superman Prime - Were you looking for a way to change the menu BGM from the game menu or did you just want to be able to change it at certain parts of the game?
 
phantasmo":oqyp5hbf said:
@Superman Prime - Were you looking for a way to change the menu BGM from the game menu or did you just want to be able to change it at certain parts of the game?

At certain parts of the game.

Guess I should have specified that in my original post.
 

Seda

Member

Finally got a break from work and school *phew* I will go ahead and test it out now.

Edit: Alright, It works just fine! Like I had said before, its ok if you can't get the music to memorize.

Not to sound needy or anything, but maybe you could get a way to make it so that the menu music can be toggled on/off with a quick script input.Sort of how like Mr.Mo allows you to hide/show the HUD (for the epic / seriouse moments, and the menu BGM could kill the mood easily).
 
I can set it up so that when you toggle off a certain switch, the menu music will return to the default function, where it continues the map music. Just tell me what number you would like that switch to be and I'll set it all up (actually I already did set it up, it works just fine, just need to throw the proper switch ID in there).

If you wanted to change the menu BGM at a certain part of the game, that could be done with switches as well.

Edit: Oh and Super, if you were still interested I think I would be able to do that for you. I can provide a non-ABS version as well.
 
Alrighty, so now when you have switch #5000 turned ON, the menu will play the selected music file, which can easily be changed in the Scene_Map Fix script I added. Turn the switch off and the map music will continue onto the menu screen:

http://www.megaupload.com/?d=Q4UQT4CD

As I've said before, I'm no scripter, so there's a good chance there is a more efficient way to do this. But this works just fine since you now have the option to toggle the script on/off with an event switch.
 
phantasmo":3oxzc0mt said:
Edit: Oh and Super, if you were still interested I think I would be able to do that for you. I can provide a non-ABS version as well.

Yep, I'm still interested.  :lol:

And I'll have to go with a non-ABS version, since I'll be using the default battle system.
 
Try this out Super:

#--------------------------------------------------------------------------
# * Menu Music
#--------------------------------------------------------------------------
#Instrustions: Place this script above main. You can assign BGMs to switches.
#When the switch is turned on, the assigned menu BGM will play. If all
#switches (4991-5000) are off, then the map music will play on the menu screen.
#Use only one switch at a time (when you turn another one on, turn the last one
#off).

class Scene_Map
  def call_menu
    # Clear menu call flag
    $game_temp.menu_calling = false
    # If menu beep flag is set
    if $game_temp.menu_beep
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Clear menu beep flag
      $game_temp.menu_beep = false
    end
    # Straighten player position
    $game_player.straighten
    if $game_switches[5000] == true
      # Memorize map BGM and stop BGM
      $game_temp.map_bgm = $game_system.playing_bgm
      $game_system.bgm_stop
    end
    if $game_switches[4999] == true
      # Memorize map BGM and stop BGM
      $game_temp.map_bgm = $game_system.playing_bgm
      $game_system.bgm_stop
    end
    if $game_switches[4998] == true
      # Memorize map BGM and stop BGM
      $game_temp.map_bgm = $game_system.playing_bgm
      $game_system.bgm_stop
    end
    if $game_switches[4997] == true
      # Memorize map BGM and stop BGM
      $game_temp.map_bgm = $game_system.playing_bgm
      $game_system.bgm_stop
    end
    if $game_switches[4996] == true
      # Memorize map BGM and stop BGM
      $game_temp.map_bgm = $game_system.playing_bgm
      $game_system.bgm_stop
    end
    if $game_switches[4995] == true
      # Memorize map BGM and stop BGM
      $game_temp.map_bgm = $game_system.playing_bgm
      $game_system.bgm_stop
    end
    if $game_switches[4994] == true
      # Memorize map BGM and stop BGM
      $game_temp.map_bgm = $game_system.playing_bgm
      $game_system.bgm_stop
    end
    if $game_switches[4993] == true
      # Memorize map BGM and stop BGM
      $game_temp.map_bgm = $game_system.playing_bgm
      $game_system.bgm_stop
    end
    if $game_switches[4992] == true
      # Memorize map BGM and stop BGM
      $game_temp.map_bgm = $game_system.playing_bgm
      $game_system.bgm_stop
    end
    if $game_switches[4991] == true
      # Memorize map BGM and stop BGM
      $game_temp.map_bgm = $game_system.playing_bgm
      $game_system.bgm_stop
    end
    # Switch to menu screen
    $scene = Scene_Menu.new
    # Play menu BGM
    if $game_switches[5000] == true
      Audio.bgm_play("Audio/BGM/025-Town03", 100, 100)  #Sets BGMs to switches
    end
    if $game_switches[4999] == true                 
      Audio.bgm_play("Audio/BGM/026-Town04", 100, 100)                                   
    end
    if $game_switches[4998] == true
      Audio.bgm_play("Audio/BGM/025-Town03", 100, 100) 
    end
    if $game_switches[4997] == true
      Audio.bgm_play("Audio/BGM/025-Town03", 100, 100) 
    end
    if $game_switches[4996] == true
      Audio.bgm_play("Audio/BGM/025-Town03", 100, 100) 
    end
    if $game_switches[4995] == true
      Audio.bgm_play("Audio/BGM/025-Town03", 100, 100) 
    end
    if $game_switches[4994] == true
      Audio.bgm_play("Audio/BGM/025-Town03", 100, 100) 
    end
    if $game_switches[4993] == true
      Audio.bgm_play("Audio/BGM/025-Town03", 100, 100) 
    end
    if $game_switches[4992] == true
      Audio.bgm_play("Audio/BGM/025-Town03", 100, 100) 
    end
    if $game_switches[4991] == true
      Audio.bgm_play("Audio/BGM/025-Town03", 100, 100) 
    end
  end
end

class Scene_Menu
  def update_command
  # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      $scene = Scene_Map.new
      if $game_switches[5000] == true
        $game_system.bgm_stop
        $game_system.bgm_play($game_temp.map_bgm)
      end
      if $game_switches[4999] == true
        $game_system.bgm_stop                   
        $game_system.bgm_play($game_temp.map_bgm)
      end
      if $game_switches[4998] == true
        $game_system.bgm_stop                   
        $game_system.bgm_play($game_temp.map_bgm)
      end
      if $game_switches[4997] == true
        $game_system.bgm_stop                   
        $game_system.bgm_play($game_temp.map_bgm)
      end
      if $game_switches[4996] == true
        $game_system.bgm_stop                   
        $game_system.bgm_play($game_temp.map_bgm)
      end
      if $game_switches[4995] == true
        $game_system.bgm_stop                   
        $game_system.bgm_play($game_temp.map_bgm)
      end
      if $game_switches[4994] == true
        $game_system.bgm_stop                   
        $game_system.bgm_play($game_temp.map_bgm)
      end
      if $game_switches[4996] == true
        $game_system.bgm_stop                   
        $game_system.bgm_play($game_temp.map_bgm)
      end
      if $game_switches[4992] == true
        $game_system.bgm_stop                   
        $game_system.bgm_play($game_temp.map_bgm)
      end
      if $game_switches[4991] == true
        $game_system.bgm_stop                   
        $game_system.bgm_play($game_temp.map_bgm)
      end
      return
    end
  end
end

The script is pretty self-explanatory. Just insert it above main and assign the songs you want to play in the menu to switches.
 

Atoa

Member

Code:
#==============================================================================
# To change the music just change the value of de variable with
# the BGM_VARIABLE.
#==============================================================================

class Scene_Menu
  #--------------------------------------------------------------------------
  BGM_VARIABLE = 5000 #Add here de ID of the variable
  #--------------------------------------------------------------------------
  alias main_bgm_music main
  def main
    if $game_variables[BGM_VARIABLE] > 0 
      $game_temp.map_bgm = $game_system.playing_bgm
      case $game_variables[BGM_VARIABLE]
      when 1
        Audio.bgm_play("Audio/BGM/012-Theme01", 100, 100)
      when 2
        Audio.bgm_play("Audio/BGM/013-Theme02", 100, 100)
    # You can add more music
    # when X
    #   Audio.bgm_play("Audio/BGM/Audio_Name", 100, 100)
      end
    end
    main_bgm_music   
    if $game_variables[BGM_VARIABLE] > 0 and $scene.is_a?(Scene_Map)
      $game_system.bgm_stop
      $game_system.bgm_play($game_temp.map_bgm)
    end
  end
end


Add it right above Main (or at least below all the menu scripts)
Simply chage the value of the BGM_VARIABLE (variable 5000, but you can change). if the variable = 0 there's no music change.
You can insert more musics if you want.

Tested whit mog Menu.
 

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