[RMVX] Battle Music Eliminator

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:
  1. #------------------------------------------------------------------------------
  2. # [VX] All Battle Music Eliminator
  3. #------------------------------------------------------------------------------
  4. # Made by Guardian(1239)
  5. #------------------------------------------------------------------------------
  6. # This is a very simple script edit that makes the map music play through the
  7. # battle on all maps.  It eliminates the use of battle background music on all
  8. # maps, basically.
  9. #------------------------------------------------------------------------------
  10. # Instructions: Paste in a new slot under "Materials".
  11. #------------------------------------------------------------------------------
  12. # Copyright: You may use this script freely.  You may distribute this script as
  13. # long as credit is given to Guardian(1239).  You may edit this script as you
  14. # wish.  You may distribute an edit of this script as long as credit for the
  15. # original is given to Guardian(1239).
  16. #------------------------------------------------------------------------------
  17.  
  18. #==============================================================================
  19. # ** Scene_Map
  20. #------------------------------------------------------------------------------
  21. #  This class performs the map screen processing.
  22. #==============================================================================
  23.  
  24. class Scene_Map < Scene_Base
  25.   #--------------------------------------------------------------------------
  26.   # * Switch to Battle Screen
  27.   #--------------------------------------------------------------------------
  28.   def call_battle
  29.     @spriteset.update
  30.     Graphics.update
  31.     $game_player.make_encounter_count
  32.     $game_player.straighten
  33.     #$game_temp.map_bgm = RPG::BGM.last
  34.     #$game_temp.map_bgs = RPG::BGS.last
  35.     #RPG::BGM.stop
  36.     #RPG::BGS.stop
  37.     Sound.play_battle_start
  38.     #$game_system.battle_bgm.play
  39.     $game_temp.next_scene = nil
  40.     $scene = Scene_Battle.new
  41.   end
  42. end
  43.  
  44. #==============================================================================
  45. # ** Scene_Battle
  46. #------------------------------------------------------------------------------
  47. #  This class performs battle screen processing.
  48. #==============================================================================
  49.  
  50. class Scene_Battle < Scene_Base
  51.   #--------------------------------------------------------------------------
  52.   # * End Battle
  53.   #     result : Results (0: win, 1: escape, 2:lose)
  54.   #--------------------------------------------------------------------------
  55.   def battle_end(result)
  56.     if result == 2 and not $game_troop.can_lose
  57.       call_gameover
  58.     else
  59.       $game_party.clear_actions
  60.       $game_party.remove_states_battle
  61.       $game_troop.clear
  62.       if $game_temp.battle_proc != nil
  63.         $game_temp.battle_proc.call(result)
  64.         $game_temp.battle_proc = nil
  65.       end
  66.       unless $BTEST
  67.         #$game_temp.map_bgm.play
  68.         #$game_temp.map_bgs.play
  69.       end
  70.       $scene = Scene_Map.new
  71.       @message_window.clear
  72.       Graphics.fadeout(30)
  73.     end
  74.     $game_temp.in_battle = false
  75.   end
  76.  
  77.   #--------------------------------------------------------------------------
  78.   # * Victory Processing
  79.   #--------------------------------------------------------------------------
  80.   def process_victory
  81.     @info_viewport.visible = false
  82.     @message_window.visible = true
  83.     #RPG::BGM.stop
  84.     #~~ If you want to keep end battle music, remove the comment from the
  85.     #~~ line below.
  86.     #$game_system.battle_end_me.play
  87.     unless $BTEST
  88.       #$game_temp.map_bgm.play
  89.       #$game_temp.map_bgs.play
  90.     end
  91.     display_exp_and_gold
  92.     display_drop_items
  93.     display_level_up
  94.     battle_end(0)
  95.   end
  96. end
Expand to see the code.


Battle Music Eliminator:
  1. #------------------------------------------------------------------------------
  2. # [VX] Battle Music Eliminator
  3. #------------------------------------------------------------------------------
  4. # Made by Guardian(1239)
  5. #------------------------------------------------------------------------------
  6. # This is a very simple script edit that makes the map music play through the
  7. # battle on specified maps.  It eliminates the use of battle background music
  8. # on the specified maps, basically.
  9. #------------------------------------------------------------------------------
  10. # Instructions: Paste in a new slot under "Materials".  Edit the values for
  11. # "Maps" to match the ID(s) of the map(s) you want to eliminate battle music
  12. # on.
  13. #------------------------------------------------------------------------------
  14. # Copyright: You may use this script freely.  You may distribute this script as
  15. # long as credit is given to Guardian(1239).  You may edit this script as you
  16. # wish.  You may distribute an edit of this script as long as credit for the
  17. # original is given to Guardian(1239).
  18. #------------------------------------------------------------------------------
  19.  
  20. module NO_BATTLE_BGM
  21.   # Edit these values to match the ID(s) of the map(s) you wish to eliminate
  22.   # battle music on.
  23.   Maps = [1]
  24. end
  25.  
  26. #==============================================================================
  27. # ** Scene_Map
  28. #------------------------------------------------------------------------------
  29. #  This class performs the map screen processing.
  30. #==============================================================================
  31.  
  32. class Scene_Map < Scene_Base
  33.   include NO_BATTLE_BGM
  34.   #--------------------------------------------------------------------------
  35.   # * Switch to Battle Screen
  36.   #--------------------------------------------------------------------------
  37.   def call_battle
  38.     @spriteset.update
  39.     Graphics.update
  40.     $game_player.make_encounter_count
  41.     $game_player.straighten
  42.     if Maps.include?($game_map.map_id)
  43.       #$game_temp.map_bgm = RPG::BGM.last
  44.       #$game_temp.map_bgs = RPG::BGS.last
  45.       #RPG::BGM.stop
  46.       #RPG::BGS.stop
  47.       Sound.play_battle_start
  48.       #$game_system.battle_bgm.play
  49.       $game_temp.next_scene = nil
  50.       $scene = Scene_Battle.new
  51.     else
  52.       $game_temp.map_bgm = RPG::BGM.last
  53.       $game_temp.map_bgs = RPG::BGS.last
  54.       RPG::BGM.stop
  55.       RPG::BGS.stop
  56.       Sound.play_battle_start
  57.       $game_system.battle_bgm.play
  58.       $game_temp.next_scene = nil
  59.       $scene = Scene_Battle.new
  60.     end
  61.   end
  62. end
  63.  
  64. #==============================================================================
  65. # ** Scene_Battle
  66. #------------------------------------------------------------------------------
  67. #  This class performs battle screen processing.
  68. #==============================================================================
  69.  
  70. class Scene_Battle < Scene_Base
  71.   include NO_BATTLE_BGM
  72.   #--------------------------------------------------------------------------
  73.   # * End Battle
  74.   #     result : Results (0: win, 1: escape, 2:lose)
  75.   #--------------------------------------------------------------------------
  76.   def battle_end(result)
  77.     if result == 2 and not $game_troop.can_lose
  78.       call_gameover
  79.     else
  80.       $game_party.clear_actions
  81.       $game_party.remove_states_battle
  82.       $game_troop.clear
  83.       if $game_temp.battle_proc != nil
  84.         $game_temp.battle_proc.call(result)
  85.         $game_temp.battle_proc = nil
  86.       end
  87.       if Maps.include?($game_map.map_id)
  88.         unless $BTEST
  89.           #$game_temp.map_bgm.play
  90.           #$game_temp.map_bgs.play
  91.         end
  92.       else
  93.         unless $BTEST
  94.           $game_temp.map_bgm.play
  95.           $game_temp.map_bgs.play
  96.         end
  97.       end
  98.       $scene = Scene_Map.new
  99.       @message_window.clear
  100.       Graphics.fadeout(30)
  101.     end
  102.     $game_temp.in_battle = false
  103.   end
  104.  
  105.   #--------------------------------------------------------------------------
  106.   # * Victory Processing
  107.   #--------------------------------------------------------------------------
  108.   def process_victory
  109.     @info_viewport.visible = false
  110.     @message_window.visible = true
  111.     if Maps.include?($game_map.map_id)
  112.       #RPG::BGM.stop
  113.       #~~ If you want to keep end battle music, remove the comment from the
  114.       #~~ line below.
  115.       #$game_system.battle_end_me.play
  116.       unless $BTEST
  117.         #$game_temp.map_bgm.play
  118.         #$game_temp.map_bgs.play
  119.       end
  120.     else
  121.       RPG::BGM.stop
  122.       $game_system.battle_end_me.play
  123.       unless $BTEST
  124.         $game_temp.map_bgm.play
  125.         $game_temp.map_bgs.play
  126.       end
  127.     end
  128.     display_exp_and_gold
  129.     display_drop_items
  130.     display_level_up
  131.     battle_end(0)
  132.   end
  133. end
Expand to see the code.


Reverse Battle Music Eliminator:
  1. #------------------------------------------------------------------------------
  2. # [VX] Reverse Battle Music Eliminator
  3. #------------------------------------------------------------------------------
  4. # Made by Guardian(1239)
  5. #------------------------------------------------------------------------------
  6. # This is a very simple script edit that makes the map music play through the
  7. # battle on all but specified maps.  It eliminates the use of battle background
  8. # music on all but the specified maps, basically.
  9. #------------------------------------------------------------------------------
  10. # Instructions: Paste in a new slot under "Materials".  Edit the values for
  11. # "Maps" to match the ID(s) of the map(s) you don't want to eliminate battle
  12. # music on.
  13. #------------------------------------------------------------------------------
  14. # Copyright: You may use this script freely.  You may distribute this script as
  15. # long as credit is given to Guardian(1239).  You may edit this script as you
  16. # wish.  You may distribute an edit of this script as long as credit for the
  17. # original is given to Guardian(1239).
  18. #------------------------------------------------------------------------------
  19.  
  20. module INCLUDE_BATTLE_BGM
  21.   # Edit these values to match the ID(s) of the map(s) you don't
  22.   # wish to eliminate battle music on.
  23.   Maps = [1]
  24. end
  25.  
  26. #==============================================================================
  27. # ** Scene_Map
  28. #------------------------------------------------------------------------------
  29. #  This class performs the map screen processing.
  30. #==============================================================================
  31.  
  32. class Scene_Map < Scene_Base
  33.   include INCLUDE_BATTLE_BGM
  34.   #--------------------------------------------------------------------------
  35.   # * Switch to Battle Screen
  36.   #--------------------------------------------------------------------------
  37.   def call_battle
  38.     @spriteset.update
  39.     Graphics.update
  40.     $game_player.make_encounter_count
  41.     $game_player.straighten
  42.     if Maps.include?($game_map.map_id)
  43.       $game_temp.map_bgm = RPG::BGM.last
  44.       $game_temp.map_bgs = RPG::BGS.last
  45.       RPG::BGM.stop
  46.       RPG::BGS.stop
  47.       Sound.play_battle_start
  48.       $game_system.battle_bgm.play
  49.       $game_temp.next_scene = nil
  50.       $scene = Scene_Battle.new
  51.     else
  52.       #$game_temp.map_bgm = RPG::BGM.last
  53.       #$game_temp.map_bgs = RPG::BGS.last
  54.       #RPG::BGM.stop
  55.       #RPG::BGS.stop
  56.       Sound.play_battle_start
  57.       #$game_system.battle_bgm.play
  58.       $game_temp.next_scene = nil
  59.       $scene = Scene_Battle.new
  60.     end
  61.   end
  62. end
  63.  
  64. #==============================================================================
  65. # ** Scene_Battle
  66. #------------------------------------------------------------------------------
  67. #  This class performs battle screen processing.
  68. #==============================================================================
  69.  
  70. class Scene_Battle < Scene_Base
  71.   include INCLUDE_BATTLE_BGM
  72.   #--------------------------------------------------------------------------
  73.   # * End Battle
  74.   #     result : Results (0: win, 1: escape, 2:lose)
  75.   #--------------------------------------------------------------------------
  76.   def battle_end(result)
  77.     if result == 2 and not $game_troop.can_lose
  78.       call_gameover
  79.     else
  80.       $game_party.clear_actions
  81.       $game_party.remove_states_battle
  82.       $game_troop.clear
  83.       if $game_temp.battle_proc != nil
  84.         $game_temp.battle_proc.call(result)
  85.         $game_temp.battle_proc = nil
  86.       end
  87.       if Maps.include?($game_map.map_id)
  88.         unless $BTEST
  89.           $game_temp.map_bgm.play
  90.           $game_temp.map_bgs.play
  91.         end
  92.       else
  93.         unless $BTEST
  94.           #$game_temp.map_bgm.play
  95.           #$game_temp.map_bgs.play
  96.         end
  97.       end
  98.       $scene = Scene_Map.new
  99.       @message_window.clear
  100.       Graphics.fadeout(30)
  101.     end
  102.     $game_temp.in_battle = false
  103.   end
  104.  
  105.   #--------------------------------------------------------------------------
  106.   # * Victory Processing
  107.   #--------------------------------------------------------------------------
  108.   def process_victory
  109.     @info_viewport.visible = false
  110.     @message_window.visible = true
  111.     if Maps.include?($game_map.map_id)
  112.       RPG::BGM.stop
  113.       $game_system.battle_end_me.play
  114.       unless $BTEST
  115.         $game_temp.map_bgm.play
  116.         $game_temp.map_bgs.play
  117.       end
  118.     else
  119.       #RPG::BGM.stop
  120.       #~~ If you want to keep end battle music, remove the comment from the
  121.       #~~ line below.
  122.       #$game_system.battle_end_me.play
  123.       unless $BTEST
  124.         #$game_temp.map_bgm.play
  125.         #$game_temp.map_bgs.play
  126.       end
  127.     end
  128.     display_exp_and_gold
  129.     display_drop_items
  130.     display_level_up
  131.     battle_end(0)
  132.   end
  133. end
Expand to see the code.



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).

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=67751