Battle Music Eliminator
#1
This is a script I made recently for a side project.  It's incredibly simple, but I thought I'd post it here, anyway. :P  What it does is eliminate the battle music on maps of your choice so that the map background music will continue playing instead.

There are three versions: All Battle Music Eliminator, which completely gets rid of the use of battle music, Battle Music Eliminator, which lets you choose which maps the effect takes place on, and Reverse Battle Music Eliminator, which lets you choose which maps the effect won't take place on (it'll work on all other maps).  Instructions in headers.  Enjoy!

All Battle Music Eliminator:
Code:
#------------------------------------------------------------------------------
# [VX] All Battle Music Eliminator
#------------------------------------------------------------------------------
# Made by Guardian(1239)
#------------------------------------------------------------------------------
# This is a very simple script edit that makes the map music play through the
# battle on all maps.  It eliminates the use of battle background music on all
# maps, basically.
#------------------------------------------------------------------------------
# Instructions: Paste in a new slot under "Materials".
#------------------------------------------------------------------------------
# Copyright: You may use this script freely.  You may distribute this script as
# long as credit is given to Guardian(1239).  You may edit this script as you
# wish.  You may distribute an edit of this script as long as credit for the
# original is given to Guardian(1239).
#------------------------------------------------------------------------------

#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs the map screen processing.
#==============================================================================

class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # * Switch to Battle Screen
  #--------------------------------------------------------------------------
  def call_battle
    @spriteset.update
    Graphics.update
    $game_player.make_encounter_count
    $game_player.straighten
    #$game_temp.map_bgm = RPG::BGM.last
    #$game_temp.map_bgs = RPG::BGS.last
    #RPG::BGM.stop
    #RPG::BGS.stop
    Sound.play_battle_start
    #$game_system.battle_bgm.play
    $game_temp.next_scene = nil
    $scene = Scene_Battle.new
  end
end

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * End Battle
  #     result : Results (0: win, 1: escape, 2:lose)
  #--------------------------------------------------------------------------
  def battle_end(result)
    if result == 2 and not $game_troop.can_lose
      call_gameover
    else
      $game_party.clear_actions
      $game_party.remove_states_battle
      $game_troop.clear
      if $game_temp.battle_proc != nil
        $game_temp.battle_proc.call(result)
        $game_temp.battle_proc = nil
      end
      unless $BTEST
        #$game_temp.map_bgm.play
        #$game_temp.map_bgs.play
      end
      $scene = Scene_Map.new
      @message_window.clear
      Graphics.fadeout(30)
    end
    $game_temp.in_battle = false
  end
 
  #--------------------------------------------------------------------------
  # * Victory Processing
  #--------------------------------------------------------------------------
  def process_victory
    @info_viewport.visible = false
    @message_window.visible = true
    #RPG::BGM.stop
    #~~ If you want to keep end battle music, remove the comment from the
    #~~ line below.
    #$game_system.battle_end_me.play
    unless $BTEST
      #$game_temp.map_bgm.play
      #$game_temp.map_bgs.play
    end
    display_exp_and_gold
    display_drop_items
    display_level_up
    battle_end(0)
  end
end

Battle Music Eliminator:
Code:
#------------------------------------------------------------------------------
# [VX] Battle Music Eliminator
#------------------------------------------------------------------------------
# Made by Guardian(1239)
#------------------------------------------------------------------------------
# This is a very simple script edit that makes the map music play through the
# battle on specified maps.  It eliminates the use of battle background music
# on the specified maps, basically.
#------------------------------------------------------------------------------
# Instructions: Paste in a new slot under "Materials".  Edit the values for
# "Maps" to match the ID(s) of the map(s) you want to eliminate battle music
# on.
#------------------------------------------------------------------------------
# Copyright: You may use this script freely.  You may distribute this script as
# long as credit is given to Guardian(1239).  You may edit this script as you
# wish.  You may distribute an edit of this script as long as credit for the
# original is given to Guardian(1239).
#------------------------------------------------------------------------------

module NO_BATTLE_BGM
  # Edit these values to match the ID(s) of the map(s) you wish to eliminate
  # battle music on.
  Maps = [1]
end

#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs the map screen processing.
#==============================================================================

class Scene_Map < Scene_Base
  include NO_BATTLE_BGM
  #--------------------------------------------------------------------------
  # * Switch to Battle Screen
  #--------------------------------------------------------------------------
  def call_battle
    @spriteset.update
    Graphics.update
    $game_player.make_encounter_count
    $game_player.straighten
    if Maps.include?($game_map.map_id)
      #$game_temp.map_bgm = RPG::BGM.last
      #$game_temp.map_bgs = RPG::BGS.last
      #RPG::BGM.stop
      #RPG::BGS.stop
      Sound.play_battle_start
      #$game_system.battle_bgm.play
      $game_temp.next_scene = nil
      $scene = Scene_Battle.new
    else
      $game_temp.map_bgm = RPG::BGM.last
      $game_temp.map_bgs = RPG::BGS.last
      RPG::BGM.stop
      RPG::BGS.stop
      Sound.play_battle_start
      $game_system.battle_bgm.play
      $game_temp.next_scene = nil
      $scene = Scene_Battle.new
    end
  end
end

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle < Scene_Base
  include NO_BATTLE_BGM
  #--------------------------------------------------------------------------
  # * End Battle
  #     result : Results (0: win, 1: escape, 2:lose)
  #--------------------------------------------------------------------------
  def battle_end(result)
    if result == 2 and not $game_troop.can_lose
      call_gameover
    else
      $game_party.clear_actions
      $game_party.remove_states_battle
      $game_troop.clear
      if $game_temp.battle_proc != nil
        $game_temp.battle_proc.call(result)
        $game_temp.battle_proc = nil
      end
      if Maps.include?($game_map.map_id)
        unless $BTEST
          #$game_temp.map_bgm.play
          #$game_temp.map_bgs.play
        end
      else
        unless $BTEST
          $game_temp.map_bgm.play
          $game_temp.map_bgs.play
        end
      end
      $scene = Scene_Map.new
      @message_window.clear
      Graphics.fadeout(30)
    end
    $game_temp.in_battle = false
  end
 
  #--------------------------------------------------------------------------
  # * Victory Processing
  #--------------------------------------------------------------------------
  def process_victory
    @info_viewport.visible = false
    @message_window.visible = true
    if Maps.include?($game_map.map_id)
      #RPG::BGM.stop
      #~~ If you want to keep end battle music, remove the comment from the
      #~~ line below.
      #$game_system.battle_end_me.play
      unless $BTEST
        #$game_temp.map_bgm.play
        #$game_temp.map_bgs.play
      end
    else
      RPG::BGM.stop
      $game_system.battle_end_me.play
      unless $BTEST
        $game_temp.map_bgm.play
        $game_temp.map_bgs.play
      end
    end
    display_exp_and_gold
    display_drop_items
    display_level_up
    battle_end(0)
  end
end

Reverse Battle Music Eliminator:
Code:
#------------------------------------------------------------------------------
# [VX] Reverse Battle Music Eliminator
#------------------------------------------------------------------------------
# Made by Guardian(1239)
#------------------------------------------------------------------------------
# This is a very simple script edit that makes the map music play through the
# battle on all but specified maps.  It eliminates the use of battle background
# music on all but the specified maps, basically.
#------------------------------------------------------------------------------
# Instructions: Paste in a new slot under "Materials".  Edit the values for
# "Maps" to match the ID(s) of the map(s) you don't want to eliminate battle
# music on.
#------------------------------------------------------------------------------
# Copyright: You may use this script freely.  You may distribute this script as
# long as credit is given to Guardian(1239).  You may edit this script as you
# wish.  You may distribute an edit of this script as long as credit for the
# original is given to Guardian(1239).
#------------------------------------------------------------------------------

module INCLUDE_BATTLE_BGM
  # Edit these values to match the ID(s) of the map(s) you don't
  # wish to eliminate battle music on.
  Maps = [1]
end

#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs the map screen processing.
#==============================================================================

class Scene_Map < Scene_Base
  include INCLUDE_BATTLE_BGM
  #--------------------------------------------------------------------------
  # * Switch to Battle Screen
  #--------------------------------------------------------------------------
  def call_battle
    @spriteset.update
    Graphics.update
    $game_player.make_encounter_count
    $game_player.straighten
    if Maps.include?($game_map.map_id)
      $game_temp.map_bgm = RPG::BGM.last
      $game_temp.map_bgs = RPG::BGS.last
      RPG::BGM.stop
      RPG::BGS.stop
      Sound.play_battle_start
      $game_system.battle_bgm.play
      $game_temp.next_scene = nil
      $scene = Scene_Battle.new
    else
      #$game_temp.map_bgm = RPG::BGM.last
      #$game_temp.map_bgs = RPG::BGS.last
      #RPG::BGM.stop
      #RPG::BGS.stop
      Sound.play_battle_start
      #$game_system.battle_bgm.play
      $game_temp.next_scene = nil
      $scene = Scene_Battle.new
    end
  end
end

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle < Scene_Base
  include INCLUDE_BATTLE_BGM
  #--------------------------------------------------------------------------
  # * End Battle
  #     result : Results (0: win, 1: escape, 2:lose)
  #--------------------------------------------------------------------------
  def battle_end(result)
    if result == 2 and not $game_troop.can_lose
      call_gameover
    else
      $game_party.clear_actions
      $game_party.remove_states_battle
      $game_troop.clear
      if $game_temp.battle_proc != nil
        $game_temp.battle_proc.call(result)
        $game_temp.battle_proc = nil
      end
      if Maps.include?($game_map.map_id)
        unless $BTEST
          $game_temp.map_bgm.play
          $game_temp.map_bgs.play
        end
      else
        unless $BTEST
          #$game_temp.map_bgm.play
          #$game_temp.map_bgs.play
        end
      end
      $scene = Scene_Map.new
      @message_window.clear
      Graphics.fadeout(30)
    end
    $game_temp.in_battle = false
  end
 
  #--------------------------------------------------------------------------
  # * Victory Processing
  #--------------------------------------------------------------------------
  def process_victory
    @info_viewport.visible = false
    @message_window.visible = true
    if Maps.include?($game_map.map_id)
      RPG::BGM.stop
      $game_system.battle_end_me.play
      unless $BTEST
        $game_temp.map_bgm.play
        $game_temp.map_bgs.play
      end
    else
      #RPG::BGM.stop
      #~~ If you want to keep end battle music, remove the comment from the
      #~~ line below.
      #$game_system.battle_end_me.play
      unless $BTEST
        #$game_temp.map_bgm.play
        #$game_temp.map_bgs.play
      end
    end
    display_exp_and_gold
    display_drop_items
    display_level_up
    battle_end(0)
  end
end


Questions and Answers
Q: Can you make this for XP?
A: No.  Sorry, but it would be a completely different script and I only made this one because I needed it.

Q: It's not working/there's an error!
A: Write down what error (if you're getting an error) you're shown and post it.  This edits a couple of classes that could be used in other scripts (especially battle system scripts), so there's probably a compatibility problem.  If you think there's a compatibility error, you'll need to contact the maker of your other script(s).  I'm presenting this "as-is", which basically means I'll fix problems with this script but I'm not going to spend my time making it compatible with other scripts.

Q: Can you do such-and-such/make a similar script?
Probably not.  I'm pretty new to scripting, but you can post your suggestion and I'll let you know what I'm capable of (or maybe someone else can help if they see the suggestion).
Reply }
#2
This would be somewhat easier with events
Reply }
#3
I'm not sure this is possible with events. I'm not entirely sure about VX but in XP, you can't just eliminate the battle music and have the map music play through. If this is the case with VX, then this is a great script. Wish I had it for XP Laughing
Reply }
#4
No, this isn't possible to do with events. Trust me, I always check that first. XD You can do the basic - turn off the battle music, but you can't make the background music keep playing. Here's the battle call from Scene_Map:
Code:
def call_battle
    @spriteset.update
    Graphics.update
    $game_player.make_encounter_count
    $game_player.straighten
    $game_temp.map_bgm = RPG::BGM.last
    $game_temp.map_bgs = RPG::BGS.last
    RPG::BGM.stop
    RPG::BGS.stop
    Sound.play_battle_start
    $game_system.battle_bgm.play
    $game_temp.next_scene = nil
    $scene = Scene_Battle.new
  end
Those RPG::BGM.stop and RPG::BGS.stop can't be changed via events; they're built into the system. In my script I just commented those lines out and, for the ones where you choose the maps, added a conditional branch.

I may look into doing it for XP in the future, but for now I've only got the VX version. Winking with a tongue sticking out
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Battle Item Count VX + ACE kyonides 1 218 10-17-2024, 08:01 PM
Last Post: kyonides
   Theolized Sideview Battle System TheoAllen 5 14,703 09-15-2014, 04:30 AM
Last Post: TheoAllen
   Yanfly Battle Status Helladen 3 8,362 04-20-2013, 04:40 AM
Last Post: Helladen
   Victor Engine - Active Time Battle Victor Sant 0 5,522 12-16-2012, 08:17 PM
Last Post: Victor Sant
   Skip Battle Messages Helladen 1 6,061 08-06-2012, 01:34 AM
Last Post: Helladen
   Skip Battle Log Helladen 0 4,811 08-02-2012, 10:49 AM
Last Post: Helladen
   Debug Battle Add-on Helladen 0 4,121 07-27-2012, 06:41 AM
Last Post: Helladen
   Victor Engine - Map Turn Battle Victor Sant 1 6,251 07-21-2012, 11:47 PM
Last Post: xnadvance
   Victor Engine - Animated Battle Victor Sant 4 15,033 03-10-2012, 06:42 PM
Last Post: Victor Sant
   Victor Engine - Skip Battle Log Victor Sant 0 4,994 01-09-2012, 05:27 AM
Last Post: Victor Sant



Users browsing this thread: 1 Guest(s)