This version of Paradog's Battle BGM Anti-Reset was edited to play the battle theme as a ME. This way, the map music won't reset after the battle is finished. It works as intended, but there's a problem if you escape from the fight: the battle theme will continue to play until it finishes. Is there a way to fix this?
There's the script:
#==============================================================================
#????Battle BGM Anti-Reset ver. 1.00???
#??Script by ParaDog
#??http://2d6.parasite.jp/
#------------------------------------------------------------------------------
# Prevents the music from starting over when entering combat if both the field
# map's and battlesystem's BMG are the same. Likewise, the music will not re-
# set upon escaping combat, or after victory if the 'battle end ME' has been
# turned off (set to 'None).
#------------------------------------------------------------------------------
# For best results of this system, please set the 'Battle End ME' to ("None)"
# in either the SYSTEM section or through an event command.
#==============================================================================
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Battle Call
#--------------------------------------------------------------------------
def call_battle
# Clear battle calling flag
$game_temp.battle_calling = false
# Clear menu calling flag
$game_temp.menu_calling = false
$game_temp.menu_beep = false
# Make encounter count
$game_player.make_encounter_count
# Memorize map BGM and stop BGM
$game_temp.map_bgm = $game_system.playing_bgm
# Play battle start SE
$game_system.se_play($data_system.battle_start_se)
# Play battle BGM
#If Switch 1 is ON
if $game_switches[1] == true
# Play same battle BGM as the map BGM
$game_system.battle_bgm = $game_temp.map_bgm
$game_system.bgm_play($game_system.battle_bgm)
#If Switch 2 is ON
elsif $game_switches[2] == true
# Play the basic battle BGM
# ! WILL RESET THE MAP BGM AFTER BATTLE ! #
# I use this for bosses, so that the battle BGM can loop.
$game_system.bgm_play($game_system.battle_bgm)
#Else, if Switch 1 and Switch 2 are OFF
elsif $game_switches[1] == false and $game_switches[2] == false
#Play battle BGM as ME (won't loop)
Audio.me_play("Audio/BGM/" + $game_system.battle_bgm.name, $game_system.battle_bgm.volume, $game_system.battle_bgm.pitch)
end
# Straighten player position
$game_player.straighten
# Switch to battle screen
$scene = Scene_Battle.new
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Start After Battle Phase
#--------------------------------------------------------------------------
def start_phase5
# Shift to phase 5
@phase = 5
if $game_system.battle_end_me.name != ""
# Play battle end ME
$game_system.me_play($game_system.battle_end_me)
end
# Return to BGM before battle started
$game_system.bgm_play($game_temp.map_bgm)
# Initialize EXP, amount of gold, and treasure
exp = 0
gold = 0
treasures = []
# Loop
for enemy in $game_troop.enemies
# If enemy is not hidden
unless enemy.hidden
# Add EXP and amount of gold obtained
exp += enemy.exp
gold += enemy.gold
# Determine if treasure appears
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
# Treasure is limited to a maximum of 6 items
treasures = treasures[0..5]
# Obtaining EXP
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@status_window.level_up(i)
end
end
end
# Obtaining gold
$game_party.gain_gold(gold)
# Obtaining treasure
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# Make battle result window
@result_window = Window_BattleResult.new(exp, gold, treasures)
if $game_system.battle_end_me.name != ""
# Set wait count
@phase5_wait_count = 100
else
# Set wait count
@phase5_wait_count = 20
end
end
end
Hmm, I think use ME as battle theme is not good idea, because ME is not loop, you must use a long length ME for long battle.
You should search demo "Audio Module" , it have method pause and resume BGM, or demo "FmodEx", it have method memorize position and resume position for BGM. You can use their method to resume and continue map BGM after a battle.
I circumvented the "ME don't loop" problem by simply making the random battle theme loop a few times before it end. And the script allows to play a battle music as a normal track for special cases, such as boss battles.
As well for you other suggestions: I tried both of those script before:
- MCI Audio Module has this nasty bug that causes the BGM to reset when you teleport to another map that plays the same music as the map you were in. There's a script that supposedly fixes this on the MCI Audio thread on this forum (http://forum.chaos-project.com/index.php/topic,11778.0.html (http://forum.chaos-project.com/index.php/topic,11778.0.html)) but I couldn't make it work.
- I tried FmodEx for a while and while it works most of the time, the script also has its flaws: sometimes the BGM will start at a lower volumen after battle and this won't get fixed unless you reset the game. It also comes into conflict with any other scripts that involve modifying the battle end scene, such as gameus' XP and Gold plus. And most mystifying, this script seems to have a problem with elaborate battle animations, causing the game to collapse and shut down if a long attack animation plays.
I'm using FmodEx long time ago, and fine with it up to now, I think your problem is because you copy all scripts have in demo, I only copy FmodEx (not copy Game_System *, Other Classes *), this will also cause error with other scripts that modifying the battle end scene, you must edit in that battle end script by yourself (by call some method of FmodEx into that battle end script).
About battle animation bug, just because def se_play, find this line in FmodEx script
def Audio.se_play(filename, volume = 100, pitch = 100)
FMod::se_play(filename, volume, pitch)
end
and delete it, I recognized that when I use "skill all", it will play multiple SE depend on the number of enemies (8 enemies, SE_play x8), and causes crash game.
I followed your instructions. It did solve the problem about the battle animations crashing the game but now the music still resets after battle. It seems the other two scripts are required for this whole thing to work properly.
About BGM continue after battle:
find
, add this
attr_accessor :map_bgm_pos
then Ctrl + F , find the last
(if you have many scripts that define call_battle, choose the last in script editor to make it working property)
in
add
$game_temp.map_bgm_pos = FMod.bgm_position
right above
Now find the last
,
find line
$game_system.bgm_play($game_temp.map_bgm)
(if you're using Gameus Gold & EXP plus, it near below def start_phase5).
change to
$game_system.bgm_play($game_temp.map_bgm, $game_temp.map_bgm_pos)
After this step, BGM can continue after a finished battle.
About escape: in
find
$game_system.bgm_play($game_temp.map_bgm)
also change to
$game_system.bgm_play($game_temp.map_bgm, $game_temp.map_bgm_pos)
Done, now BGM can continue after you escape a battle.
Alright, I did what you posted and now this error shows up after either escaping/winning a battle.
(http://i.imgur.com/GZmZpR9.png)
I should've mentioned that I'm using Blizzard's Stormtronics Custom Menu Screen.
Hmm,let's try this : above line 449 is def bgm_play(bgm), change to :
def bgm_play(bgm, pos = 0)
, below that you'll see Audio.bgm_play('Audio/BGM/' + bgm.name , bgm.volume * vol / 100, bgm.pitch), change to
Audio.bgm_play('Audio/BGM/' + bgm.name, bgm.volume * vol / 100, bgm.pitch, pos)
Tried that and the same error pops up.
Thinking about it, I think I got this same error when I started using Stormtronics Custom Menu Screen and FmodEX. I recall the problem was that I copied an incomplete version of FmodEX and that clashed with Stormtronics's BGM/SFX Volume Control.
Perhaps the problem lies in some decree of incompatibility be between the two scripts, seeing how both of of them modify the Battle BGM control scene?
I test in a clear demo with FmodEx, Gold and Exp Plus, Stormtronics CMS and do the same with what I said, everything do fine, no error pops up. Hmm hmm, weird :???:
ps: okay, I downloaded demo Stormtronics CMS - Hybrid Edition and test again, it's fine, too . May be other script causes that.
Yeah that must be the crux of this whole mess.
Issues like this one is the reason of why I wanted to use Paradog's script instead of Fmod and Audio Module. There's a lower risk of getting compatibility problems with a script that doesn't try to replace XP's music player module.
Quote from: Simon Greedwell on July 02, 2014, 09:20:03 am
MCI Audio Module has this nasty bug that causes the BGM to reset when you teleport to another map that plays the same music as the map you were in. There's a script that supposedly fixes this on the MCI Audio thread on this forum (http://forum.chaos-project.com/index.php/topic,11778.0.html (http://forum.chaos-project.com/index.php/topic,11778.0.html)) but I couldn't make it work.
Just fixed this bug if it is any help to you in this situation. MCI Audio Player (http://forum.chaos-project.com/index.php/topic,11778.0.html)
Quote from: ForeverZer0 on July 05, 2014, 09:43:15 am
Quote from: Simon Greedwell on July 02, 2014, 09:20:03 am
MCI Audio Module has this nasty bug that causes the BGM to reset when you teleport to another map that plays the same music as the map you were in. There's a script that supposedly fixes this on the MCI Audio thread on this forum (http://forum.chaos-project.com/index.php/topic,11778.0.html (http://forum.chaos-project.com/index.php/topic,11778.0.html)) but I couldn't make it work.
Just fixed this bug if it is any help to you in this situation. MCI Audio Player (http://forum.chaos-project.com/index.php/topic,11778.0.html)
Alright. I tested it and unfortunately, it seems the Auto-Restore plug-in isn't working as intended i.e the BGM still resets after battle.