11-03-2005, 01:00 PM
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
This is a special script that allows you to start a boss battle without the music interrupting and restarting. Here's how it works: Make an event that changes the background BGM and battle BGM to the same music. DO NOT MAKE IT DIFFERENT OR ELSE IT DOESN'T WORK! If you have different the battle BGM will go as normally. Now when you've done that, start a battle, and voila! You'll notice that the BGM doesn't interrupt and better! It just continues from where the battle begun. Good for special BGM's that has an intro. If you didn't understand this, try it out yourself. Remember to have battle and background BGM the same.
Replace the whole Game_System with this.
Code:
#==============================================================================
# ■ Game_System
#------------------------------------------------------------------------------
# システム周りのデータを扱うクラスです。BGM などの管理も行います。このクラス
# のインスタンスは $game_system で参照されます。
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :map_interpreter # マップイベント用インタプリタ
attr_reader :battle_interpreter # バトルイベント用インタプリタ
attr_accessor :timer # タイマー
attr_accessor :timer_working # タイマー作動中フラグ
attr_accessor :save_disabled # セーブ禁止
attr_accessor :menu_disabled # メニュー禁止
attr_accessor :encounter_disabled # エンカウント禁止
attr_accessor :message_position # 文章オプション 表示位置
attr_accessor :message_frame # 文章オプション ウィンドウ枠
attr_accessor :save_count # セーブ回数
attr_accessor :magic_number # マジックナンバー
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
@map_interpreter = Interpreter.new(0, true)
@battle_interpreter = Interpreter.new(0, false)
@timer = 0
@timer_working = false
@save_disabled = false
@menu_disabled = false
@encounter_disabled = false
@message_position = 2
@message_frame = 0
@save_count = 0
@magic_number = 0
end
#--------------------------------------------------------------------------
# ● BGM の演奏
# bgm : 演奏する BGM
#--------------------------------------------------------------------------
def bgm_play(bgm)
@playing_bgm = bgm
if bgm != nil and bgm.name != "" #was a nil somewhere here.
Audio.bgm_play("Audio/BGM/" + bgm.name, bgm.volume, bgm.pitch) #Audio.bgm_play
else
#It was an Audio.bgm_stop here
end
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# ● BGM の停止
#--------------------------------------------------------------------------
def bgm_stop
#Audio.bgm_stop
end
#--------------------------------------------------------------------------
# ● BGM のフェードアウト
# time : フェードアウト時間 (秒)
#--------------------------------------------------------------------------
def bgm_fade(time)
@playing_bgm = nil
Audio.bgm_fade(time * 1000)
end
#--------------------------------------------------------------------------
# ● BGM の記憶
#--------------------------------------------------------------------------
def bgm_memorize
@memorized_bgm = @playing_bgm
end
#--------------------------------------------------------------------------
# ● BGM の復帰
#--------------------------------------------------------------------------
def bgm_restore
bgm_play(@memorized_bgm)
end
#--------------------------------------------------------------------------
# ● BGS の演奏
# bgs : 演奏する BGS
#--------------------------------------------------------------------------
def bgs_play(bgs)
@playing_bgs = bgs
if bgs != nil and bgs.name != ""
Audio.bgs_play("Audio/BGS/" + bgs.name, bgs.volume, bgs.pitch)
else
Audio.bgs_stop
end
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# ● BGS のフェードアウト
# time : フェードアウト時間 (秒)
#--------------------------------------------------------------------------
def bgs_fade(time)
@playing_bgs = nil
Audio.bgs_fade(time * 1000)
end
#--------------------------------------------------------------------------
# ● BGS の記憶
#--------------------------------------------------------------------------
def bgs_memorize
@memorized_bgs = @playing_bgs
end
#--------------------------------------------------------------------------
# ● BGS の復帰
#--------------------------------------------------------------------------
def bgs_restore
bgs_play(@memorized_bgs)
end
#--------------------------------------------------------------------------
# ● ME の演奏
# me : 演奏する ME
#--------------------------------------------------------------------------
def me_play(me)
if me != nil and me.name != ""
Audio.me_play("Audio/ME/" + me.name, me.volume, me.pitch)
else
Audio.me_stop
end
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# ● SE の演奏
# se : 演奏する SE
#--------------------------------------------------------------------------
def se_play(se)
if se != nil and se.name != ""
Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
end
end
#--------------------------------------------------------------------------
# ● SE の停止
#--------------------------------------------------------------------------
def se_stop
Audio.se_stop
end
#--------------------------------------------------------------------------
# ● 演奏中 BGM の取得
#--------------------------------------------------------------------------
def playing_bgm
return @playing_bgm
end
#--------------------------------------------------------------------------
# ● 演奏中 BGS の取得
#--------------------------------------------------------------------------
def playing_bgs
return @playing_bgs
end
#--------------------------------------------------------------------------
# ● ウィンドウスキン ファイル名の取得
#--------------------------------------------------------------------------
def windowskin_name
if @windowskin_name == nil
return $data_system.windowskin_name
else
return @windowskin_name
end
end
#--------------------------------------------------------------------------
# ● ウィンドウスキン ファイル名の設定
# windowskin_name : 新しいウィンドウスキン ファイル名
#--------------------------------------------------------------------------
def windowskin_name=(windowskin_name)
@windowskin_name = windowskin_name
end
#--------------------------------------------------------------------------
# ● バトル BGM の取得
#--------------------------------------------------------------------------
def battle_bgm
if @battle_bgm == nil
return $data_system.battle_bgm
else
return @battle_bgm
end
end
#--------------------------------------------------------------------------
# ● バトル BGM の設定
# battle_bgm : 新しいバトル BGM
#--------------------------------------------------------------------------
def battle_bgm=(battle_bgm)
@battle_bgm = battle_bgm
end
#--------------------------------------------------------------------------
# ● バトル終了 BGM の取得
#--------------------------------------------------------------------------
def battle_end_me
if @battle_end_me == nil
return $data_system.battle_end_me
else
return @battle_end_me
end
end
#--------------------------------------------------------------------------
# ● バトル終了 BGM の設定
# battle_end_me : 新しいバトル終了 BGM
#--------------------------------------------------------------------------
def battle_end_me=(battle_end_me)
@battle_end_me = battle_end_me
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# タイマーを 1 減らす
if @timer_working and @timer > 0
@timer -= 1
end
end
end