Edited Paradog's Battle BGM Anti-Reset
#1
Edited Paradog's Battle BGM Anti-Reset
Version: 1, I guess :x

Introduction

So, basically, I needed something to play my battle BGM without resetting the map BGM. I tried a few scripts, none really satisfied me. So I tried editing Paradog's Battle BGM Anti-Reset so that it doesn't only work when both the battle and map BGM are the same.

It's pretty simple, but there is a convenience : the battle BGM is played as a ME file, which doesn't loop. It's pretty much my first attempt to edit a script, so I don't even know if this is possible to loop MEs !


Features
By editing the script (just have to change the switchs, you can have 3 different things :
  • No switch : does the same think as if you didn't have the script, the battle BGM is played as a BGM, which loops, but the map BGM WILL reset after the battle.
  • First switch : The battle BGM is the same as the map BGM, so it continues, thanks to Paradog's script !
  • Second switch : The battle BGM is played as a ME. Doesn't loop, but the map BGM won't reset after the battle. This is what I use for random battles : those are quickly over, so the battle BGM doesn't have time to finish.
Screenshots

None.


Demo

Here.


Script

Code:
#==============================================================================
#????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


Instructions

You just have to change the switches you want to use at lines 38, 42 and 44.
Check the demo out to see what events look like.


FAQ

-


Compatibility

Doesn't require SDK or anything else. I tried it with Charlie Lee's CTB and with basic battles and it worked well.


Credits and Thanks

Just give credits to Paradog !


Author's Notes

As I said, this is my first attempt to edit a script, so don't hesitate to say if the way I did it just sucks or anything !
If you want Paradog's script, just see here.


Terms and Conditions

Here is the Paradog's condition of use.

Content Hidden
Reply }
#2
Sorry for the necropost but I wish to use this script yet I've encountered what I believe is an overlooked bug: If you escape a battle, the battle theme will continue to play until it finishes. Is there any way to fix this?
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Battle Item Count kyonides 4 2,163 02-04-2024, 05:49 AM
Last Post: kyonides
   Dalissa's Battle Cry DerVVulfman 2 7,431 05-09-2023, 03:07 AM
Last Post: DerVVulfman
   Zenith Tactical Battle System Plus (ZTBS+) DerVVulfman 0 2,848 05-10-2022, 10:42 PM
Last Post: DerVVulfman
   Actor Battle Items DerVVulfman 4 6,090 11-08-2020, 12:36 PM
Last Post: Mel
   Battle Report Raziel 1 6,983 05-29-2020, 02:27 AM
Last Post: Whisper
   ZLSL's Battle Portraits DerVVulfman 4 7,518 11-12-2019, 04:10 AM
Last Post: DerVVulfman
   ACBS - Atoa Custom Battle System 3.2 Victor Sant 150 255,721 03-02-2019, 04:47 AM
Last Post: dragonprincess44
   Mimi's Battle Music DerVVulfman 2 8,836 11-19-2018, 04:18 AM
Last Post: DerVVulfman
   ATOA Chanting Battle Animations DerVVulfman 9 17,862 01-12-2017, 01:46 PM
Last Post: Noctis
   Automatic Battle Actions Claihm 1 7,416 08-15-2016, 09:15 PM
Last Post: Mel



Users browsing this thread: 1 Guest(s)