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.

A simple request

Marpy

Member

I still don't know how to work RGSS, and I've attempted something that used to work on RM2k, but doesn't work here. I used to have a common event set up that whenever you press escape, it would call up the menu, but it would memorize the current BGM, then play a new one, and then play the memorized BGM once you exit the menu. In theory, it works here on RMXP, it just calls the menu when you press esc during dialog. Is there a script that would do something similar?
 
Just place this above Main (not tested)

Code:
class RPG::System
  Menu_BGM = RPG::AudioFile.new('filename', volume, pitch)
end

class Game_System
  attr_accessor :menu_bgm
end

class Scene_Title
  alias_method :seph_menubgm_scnttl_cng, :command_new_game
  def command_new_game
    seph_menubgm_scnttl_cng
    $game_system.menu_bgm = RPG::System::Menu_BGM
  end
end

class Scene_Menu
  alias_method :seph_menubgm_scnmnu_main, :main
  def main
    $game_temp.map_bgm = $game_system.playing_bgm
    $game_system.bgm_stop
    $game_system.bgm_play($game_system.menu_bgm)
    seph_menubgm_scnmnu_main
    if $scene.is_a?(Scene_Map)
      $game_system.bgm_stop
      $game_system.bgm_play($game_temp.map_bgm)
    end
  end
end

Just edit this line: Menu_BGM = RPG::AudioFile.new('filename', volume, pitch)

Change filename to the file's name (include Audio/BGM/) and replace volume and pitch with a number between 0 and 100
 

Marpy

Member

Ah, thank you. It works pretty good, but it always jumps back to the start of the music file every time you return the to main screen of the menu. Anyway to fix this?
 

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