Battle : Use Map BGM - Kain Nobel - 06-04-2016
Introduction
A script that allows the developer to override the Battle BGM and use Map BGM in combat instead.
See Also : Battle : Disable Battle End ME
Instructions
Place below default scripts and above Main.
All you have to do is set your Battle BGM to (none) and Map BGM will continue to play while you're in battle. Alternatively, if Map and Battle BGM are the same, then you no longer should have to worry about the music being interrupted between transitions.
You can use an Integer Switch ID for this effect.
You can use an Array of Switch IDs for this effect.
Code:
BattleUseMapBGM = [1, 3, 17, 191]
You can simply set as true for this effect.
Code:
BattleUseMapBGM = true
Script
Content Hidden
Code:
#===============================================================================
# ** Game_Switches
#===============================================================================
class Game_Switches
#-----------------------------------------------------------------------------
# * Battle Use Map BGM = (Switch ID, Array of Switch IDs or nil)
#-----------------------------------------------------------------------------
BattleUseMapBGM = 3
#-----------------------------------------------------------------------------
# * Battle Use Map BGM?
#-----------------------------------------------------------------------------
def battle_use_map_bgm?
case BattleUseMapBGM
when Array ; BattleUseMapBGM.each {|id| return true if self[id]}
when Integer ; return self[BattleUseMapBGM]
when TrueClass ; return true
end
false
end
end
#===============================================================================
# ** Game_Temp
#===============================================================================
class Game_Temp
#-----------------------------------------------------------------------------
# * Public Instance Variables
#-----------------------------------------------------------------------------
attr_accessor :battle_use_map_bgm
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :battleusemapbgm_gmtemp_initialize, :initialize
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize(*args)
battleusemapbgm_gmtemp_initialize(*args)
@battle_use_map_bgm = false
end
end
#===============================================================================
# ** Game_System
#===============================================================================
class Game_System
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :battleusemapbgm_gmsystem_bgmplay, :bgm_play
alias_method :battleusemapbgm_gmsystem_bgmstop, :bgm_stop
#-----------------------------------------------------------------------------
# * BGM Play
#-----------------------------------------------------------------------------
def bgm_play(*args)
return if battle_use_map_bgm?
battleusemapbgm_gmsystem_bgmplay(*args)
end
#-----------------------------------------------------------------------------
# * BGM Stop
#-----------------------------------------------------------------------------
def bgm_stop(*args)
return if battle_use_map_bgm?
battleusemapbgm_gmsystem_bgmstop(*args)
end
#-----------------------------------------------------------------------------
# * Battle Use Map BGM ?
#-----------------------------------------------------------------------------
def battle_use_map_bgm?
return false unless $game_temp.is_a?(Game_Temp)
return false unless $game_temp.battle_use_map_bgm
return true if @playing_bgm == self.battle_bgm
return true if self.battle_bgm.nil?
return true if self.battle_bgm.name == ''
return true if self.battle_bgm.volume == 0
$game_switches.battle_use_map_bgm?
end
end
#===============================================================================
# ** Scene_Map
#===============================================================================
class Scene_Map
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :battleusemapbgm_scnmap_callbattle, :call_battle
#-----------------------------------------------------------------------------
# * Call Battle
#-----------------------------------------------------------------------------
def call_battle(*args)
$game_temp.battle_use_map_bgm = true
battleusemapbgm_scnmap_callbattle(*args)
$game_temp.battle_use_map_bgm = false
end
end
Compatability
Written for RPG Maker XP. Please tell me if this works in VX or VX Ace; if it does, I'll change the topic icon.
Author's Notes (Pointless Trivia)
Sometimes Final Fantasy 7 does this, where the current Map BGM is used instead of the standard Battle BGM. Notable tracks include...
"Bombing Mission"
"Hurry!"
"Trail of Blood"
"Aerith's Theme"
"Hurry Up"
I believe the RMXP game Master of the Wind did, too. I'm not sure if they were using my script or not though.
Credits
Free to use in commercial and non-commercial games. Just credit Kain Nobel and enjoy!