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.
 
I figured out how to do this. Go into Scene_Menu. Right under def main, insert this:

    # Memorize map BGM and stop BGM
    $game_temp.map_bgm = $game_system.playing_bgm
    $game_system.bgm_stop
    # Play menu BGM
    $game_system.bgm_play(RPG::AudioFile.new('026-Town04'))

This memorizes the current map's BGM and sets the menu BGM. Change the "026-Town04" to the name of the song file you wish to be played. Then, to restore the map BGM, go down to the end of def main, right after the @status_window.dispose, and insert this:

    if $scene.is_a?(Scene_Map)
      $game_system.bgm_play($game_temp.map_bgm)
    end

EDIT: This is a start anyways, I just realized that when you exit out of another menu, say "Item" for example, the menu music will restart. I'll look into fixing that.
 

Seda

Member

Hmm.. I followed your instructions closely, and nothing is happening... Would it be because I am using Moghunter's menu script? If so, what can I tweak in order to make this work?

Edit: I tried throwing this into a new project, and I've also noticed that if there is no music playing in the background, the menu music will take it over.

This is a good start though, Thank you so much for the help!
 
I'll see what I can do with the Mog menu instead, I'm running out of ideas for this one. (I use the Mog menu too so I'd rather do that one anyways).

EDIT: OK, I think I got this now. In Scene_Map, go down to where it says $scene = Scene_Menu.new (line 216). Directly under that, put in this:

    # Memorize map BGM and stop BGM
    $game_temp.map_bgm = $game_system.playing_bgm
    $game_system.bgm_stop
    # Play menu BGM
    Audio.bgm_play("Audio/BGM/026-Town04", 100, 100)

Now go into the Mog Scene Menu. I've modified mine a little so I can't say exactly what line, just find the second instance of Graphics.update under def main, and insert this under that:

# Plays MAP Bgm
if $scene.is_a?(Scene_Map)
$game_system.bgm_play($game_temp.map_bgm)
end

This should work just fine. The problem with the last one I did was that it set the BGM every time the scene_menu loaded. Now it sets the BGM when you load scene_menu from the map screen, so it no longer re-starts itself when exiting out of other menus. I've tested it and it works fine, let me know if you have any problems.
 

Seda

Member

This is weird... It works just fine when I open up a new project. But when I try and put it into the game I actually want it in, nothing happens...

Edit: Crap... It's because I am using Mr.Mo's SBABS lite. Its the SDK Scripts that are messing with the music... Sorry about that... Any other ways to tweak it?
 
That's right, I forgot you were using that. It must re-write the scene_map. I was going to go to bed but I want to figure this out before I forget what I was doing. I think you just need to make sure that the Mog menu script is placed after the SBABS, then under the class scene_map in the SBABS script (line 3100 or so) find where it says $scene = Scene_Menu.new and under that paste in:

    # Memorize map BGM and stop BGM
    $game_temp.map_bgm = $game_system.playing_bgm
    $game_system.bgm_stop
    # Play menu BGM
    Audio.bgm_play("Audio/BGM/026-Town04", 100, 100)

The Mog menu should be changed just the same as before, except placed under the SBABS script. I've tested this and it works fine for me.
 

Seda

Member

I think I forgot to mention that I am using SBABS lite 2.0... I just ctrl + F what you told me to paste the code under, and it can't find it... Sorry I'm causing such a problem ><
 
Is there a version of that in English? If you can find me a link to it I'll modify it for you, but at this point I would almost prefer it if you could just send me your game, then I can be sure that it's working fine.
 
You can upload to Megaupload or Rapidshare and just post a link here. I had an easier idea though, rather than sending the whole game file, just send me the scripts file instead. Go into your game folder, open the "data" folder, and find the "Scripts" RXDATA file and just upload that.
 
Seda":1aplv1fb said:
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.



Events?

If X is being pressed play menu bgm.  Else, play field bgm.

I didn't test it, so there may be something wrong with it, but I don't see why it wouldn't work.
 

Seda

Member

I kind of prefer to use scripts over eventing really. Also, I want the music to continue from where it left off... Not sure if eventing can do that...
Thanks for the suggestion though! If all else fails with the scripting, I will go ahead and do my menu music through eventing!
 
In the methods that I've tryed so far, I haven't gotten it so that the map music continues where it left off upon closing the menu screen. I'll look into to doing that but I can't make any promises at this point, as I'm not scripter, just some guy who likes to tinker around with these things.
 

Seda

Member

If you can't get it to work like that, thats alright, I can deal without it. It's just a plus to what I am looking for. let me know if you can get it work or not. Also let me know how what I need to do exactly to get the music to work with my scripts, I had uploaded them for that reason.
 
This is kind of strange. I was using the SBABS lite as well and for some reason it was working fine on mine. When I do it on yours I have the same problem, where the menu music continues playing after the menu has been closed. This might take me some time to figure out.
 
phantasmo":231p7zt1 said:
I'll see what I can do with the Mog menu instead, I'm running out of ideas for this one. (I use the Mog menu too so I'd rather do that one anyways).

EDIT: OK, I think I got this now. In Scene_Map, go down to where it says $scene = Scene_Menu.new (line 216). Directly under that, put in this:

    # Memorize map BGM and stop BGM
    $game_temp.map_bgm = $game_system.playing_bgm
    $game_system.bgm_stop
    # Play menu BGM
    Audio.bgm_play("Audio/BGM/026-Town04", 100, 100)

Now go into the Mog Scene Menu. I've modified mine a little so I can't say exactly what line, just find the second instance of Graphics.update under def main, and insert this under that:

# Plays MAP Bgm
if $scene.is_a?(Scene_Map)
$game_system.bgm_play($game_temp.map_bgm)
end

This should work just fine. The problem with the last one I did was that it set the BGM every time the scene_menu loaded. Now it sets the BGM when you load scene_menu from the map screen, so it no longer re-starts itself when exiting out of other menus. I've tested it and it works fine, let me know if you have any problems.
I was looking for something like this, so thanks.  :thumb:

But I got one question, is there anyway I could change the menu BGM in-game?
 

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