Zerbu 40 Posted January 5, 2012 (edited) Toggle BGM/BGS Autoplay Introduction This script allows you to turn automatic BGM and BGS change on or off. It is useful for creating cutscenes that span across multiple maps. Instructions To turn automatic BGM change on or off: ze_autoplay(:change_bgm, true) - change BGM on ze_autoplay(:change_bgm, false) - change BGM off To turn automatic BGS change on or off: ze_autoplay(:change_bgs, true) - change BGS on ze_autoplay(:change_bgs, false) - change BGS off Script #============================================================================ # Zerbu Engine - Toggle BGM/BGS Autoplay #---------------------------------------------------------------------------- # This script allows you to turn automatic BGM and BGS change on or off. # It is useful for creating cutscenes that span across multiple maps. #---------------------------------------------------------------------------- # To turn automatic BGM change on or off: # ze_autoplay(:change_bgm, true) - change BGM on # ze_autoplay(:change_bgm, false) - change BGM off #---------------------------------------------------------------------------- # To turn automatic BGS change on or off: # ze_autoplay(:change_bgs, true) - change BGS on # ze_autoplay(:change_bgs, false) - change BGS off #============================================================================ #============================================================================ # ZE_Autoplay #============================================================================ class ZE_Autoplay #-------------------------------------------------------------------------- # new method: initialize #-------------------------------------------------------------------------- def initialize #--- @data = { #---------------------------------------------------------------------- # Options #---------------------------------------------------------------------- # This option will enable or disable automatic BGM change. # Note: having this disable by default will also prevent the BGM from # automatically playing when the game starts. #---------------------------------------------------------------------- :CHANGE_BGM => true, #---------------------------------------------------------------------- # This option will enable or disable automatic BGS change. # Note: having this disable by default will also prevent the BGS from # automatically playing when the game starts. #---------------------------------------------------------------------- :CHANGE_BGS => true, } #--- end #-------------------------------------------------------------------------- # new method: [] #-------------------------------------------------------------------------- def [](setting) #--- @data[setting] || false #--- end #-------------------------------------------------------------------------- # new method: []= #-------------------------------------------------------------------------- def []=(setting, value) #--- @data[setting] = value #--- end end #============================================================================ # DataManager #============================================================================ module DataManager class << self #------------------------------------------------------------------------ # alias method: create_game_objects #------------------------------------------------------------------------ alias ze_autoplay_create_game_objects create_game_objects def create_game_objects #--- ze_autoplay_create_game_objects $ze_autoplay = ZE_Autoplay.new #--- end #------------------------------------------------------------------------ # alias method: make_save_contents #------------------------------------------------------------------------ alias ze_autoplay_make_save_contents make_save_contents def make_save_contents #--- contents = ze_autoplay_make_save_contents contents[:ze_autoplay] = $ze_autoplay contents #--- end #------------------------------------------------------------------------ # alias method: extract_save_contents #------------------------------------------------------------------------ alias ze_autoplay_extract_save_contents extract_save_contents def extract_save_contents(contents) #--- ze_autoplay_extract_save_contents(contents) $ze_autoplay = contents[:ze_autoplay] ? contents[:ze_autoplay] : ZE_Autoplay.new #--- end end end #============================================================================ # Game_Map #============================================================================ class Game_Map #-------------------------------------------------------------------------- # overwrite method: autoplay #-------------------------------------------------------------------------- def autoplay @map.bgm.play if @map.autoplay_bgm and $ze_autoplay[:CHANGE_BGM] @map.bgs.play if @map.autoplay_bgs and $ze_autoplay[:CHANGE_BGS] end end #============================================================================ # Game_Interpreter #============================================================================ class Game_Interpreter #-------------------------------------------------------------------------- # new method: ze_autoplay #-------------------------------------------------------------------------- def ze_autoplay(setting, value) #--- $ze_autoplay[setting.upcase] = value #--- end end Edited January 6, 2012 by Zerbu Share this post Link to post Share on other sites
Nohta 15 Posted January 6, 2012 I think I'm going to need this. Not sure if it'll work for what I'm trying to do (keeping the current battle music playing (because it changes mid-battle) while returning to the map from battle), but I'll give it a shot when I get a chance. Even if it doesn't, I'm sure this'll help me out a lot while I'm eventing! Keep up the good work! (I think that's the phrase I'm thinking of; damn, I'm getting old, and I'm only 21...) Share this post Link to post Share on other sites
Zerbu 40 Posted January 6, 2012 I think I'm going to need this. Not sure if it'll work for what I'm trying to do (keeping the current battle music playing (because it changes mid-battle) while returning to the map from battle), but I'll give it a shot when I get a chance. Even if it doesn't, I'm sure this'll help me out a lot while I'm eventing! Keep up the good work! (I think that's the phrase I'm thinking of; damn, I'm getting old, and I'm only 21...) Sorry it only works when entering maps, not when leaving battles, but you just gave me the idea for my next script I'll make a script that lets you turn off automatic BGM or BGS changes when entering or leaving battle. Share this post Link to post Share on other sites