Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Menu BGM
- # Made by: Sixth
- module BGM_Saver
- # Set up your menu BGM here.
- # Format: RPG::BGM.new("file name",volume,pitch)
- MenuBGM = RPG::BGM.new("Town1",100,100)
- # Set up the Map BGM replay mode here.
- # true = Will continue the map BGM from the exact time it changed.
- # false = Will replay the map BGM from the beginning.
- MapReplay = false
- # No touchy-touchy below!
- def self.save_bgm
- if SceneManager.scene_is?(Scene_Map)
- @lastbgm_map = RPG::BGM.last
- elsif SceneManager.scene_is?(Scene_Menu)
- @lastbgm_menu = RPG::BGM.last
- end
- end
- def self.get_last_bgm(type)
- case type
- when :map; return @lastbgm_map
- when :menu; return @lastbgm_menu
- end
- end
- end
- module SceneManager
- class << self; alias save_lastbgm5814 call; end
- def self.call(scene_class)
- if scene_is?(Scene_Menu) || scene_is?(Scene_Map)
- BGM_Saver.save_bgm
- end
- save_lastbgm5814(scene_class)
- if scene_is?(Scene_Menu) || scene_is?(Scene_Map)
- BGM_Saver.save_bgm
- end
- end
- class << self; alias save_lastbgm7774 call; end
- def self.goto(scene_class)
- save_lastbgm7774(scene_class)
- if scene_class == Scene_Map
- if BGM_Saver::MapReplay == true
- last = BGM_Saver.get_last_bgm(:map)
- last.replay if last
- else
- $game_map.autoplay
- end
- end
- end
- end
- class Scene_Menu < Scene_MenuBase
- alias add_bgm_changes9986 start
- def start
- add_bgm_changes9986
- last = BGM_Saver.get_last_bgm(:menu)
- menubgm = BGM_Saver::MenuBGM
- menubgm.play if last && last.name != menubgm.name
- end
- alias add_bgm_saves8874 terminate
- def terminate
- add_bgm_saves8874
- if SceneManager.scene_is?(Scene_Map)
- if BGM_Saver::MapReplay == true
- last = BGM_Saver.get_last_bgm(:map)
- last.replay if last
- else
- $game_map.autoplay
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement