RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Override Change BGM/ME

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Override Change BGM/ME
Version: 1.0
Author: modern algebra
Date: July 12, 2010

Version History


  • <Version 1.0> 07.12.2010 - Original Release

Description


This script will override the BGM or ME changes when you activate chosen switches. This is useful, for instance, if for a boss battle you want to start the battle music early and have it directly continue into the battle or if, for a certain battle where the enemy escapes after the battle, you don't want the Victory ME played.

It will also override bgm and me changes through event commands (since you can always turn the switch off immediately beforehand if you don't want it to apply), but it will not override BGMs or MEs in the Gameover scene, as I figure you would not have the opportunity to turn the switches if actors die in battle.

Features

  • Allows you to prevent the BGM from changing when going into or out of battle by turning on an in-game switch
  • Allows you to prevent MEs from playing by turning on an in-game switch
  • Allows you to choose which switches control the above features

Instructions

The script is very easy to use. Simply paste it into its own slot above Main and below other default or custom scripts. Then, go to lines 48 and 49 to select which switches you want to use to prevent the BGM from changing or to prevent new MEs from playing, respectively. Then when you want to prevent the BGM from changing, simply turn the switch with the ID you chose on. To allow it to change again, turn that switch off. Same thing for preventing MEs from playing.

Script


Code: [Select]
#==============================================================================
#    Override Change BGM/ME
#    Version: 1.0
#    Author: modern algebra (rmrk.net)
#    Date: July 12, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This script will override the BGM or ME changes when you activate chosen
#   switches. This is useful, for instance, if for a boss battle you want to
#   start the battle music early and have it directly continue into the battle
#   or if, for a certain battle where the enemy escapes after the battle, you
#   don't want the Victory ME played.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#   
#    The script is very easy to use. Simply paste it into its own slot above
#   Main and below other default or custom scripts. Then, go to lines 48 and 49
#   to select which switches you want to use to prevent the BGM from changing
#   or to prevent new MEs from playing, respectively. Then when you want to
#   prevent the BGM from changing, simply turn the switch with the ID you chose
#   on. To allow it to change again, turn that switch off. Same thing for
#   preventing MEs from playing.
#==============================================================================

#==============================================================================
# *** RPG
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new constant - OVERRIDE_BGM_SWITCH_ID, OVERRIDE_ME_SWITCH_ID
#    modified class - BGM
#      aliased methods - self.stop, self.fade, play
#    modified class - ME
#      aliased method - play
#==============================================================================

module RPG
  #==========================================================================
  #    Configuration
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  OVERRIDE_BGM_SWITCH_ID - set this to the ID of the switch that you
  #   want to use to prevent the BGM from changing.
  #  OVERRIDE_ME_SWITCH_ID - set this to the ID of the switch that you
  #   want to use to prevent MEs from playing
  #
  #  Note that for both of theses it is the ID of the switch you want to use,
  # so if it is 1, then turning the in-game switch with ID 1 on or off will
  # turn that feature on or off.
  #==========================================================================
  OVERRIDE_BGM_SWITCH_ID = 1
  OVERRIDE_ME_SWITCH_ID = 2
  #==========================================================================
  # ** BGM
  #==========================================================================
  class BGM
    # ALiases
    unless self.method_defined? (:odrna_mscovrde_ply_7uj2)
      class << self
        alias malgr_bgmovrid_stp_5th2 stop
        alias maa_ovrridebgm_fde_2rt9 fade
      end
      alias odrna_mscovrde_ply_7uj2 play
    end
    class << self
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * Stop
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      def stop (*args)
        malgr_bgmovrid_stp_5th2 (*args) unless $game_switches && $game_switches[OVERRIDE_BGM_SWITCH_ID] && !$scene.is_a? (Scene_Gameover)
      end
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * Fade
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      def fade (*args)
        maa_ovrridebgm_fde_2rt9 (*args) unless $game_switches && $game_switches[OVERRIDE_BGM_SWITCH_ID] && !$scene.is_a? (Scene_Gameover)
      end
    end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Play
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def play (*args)
      odrna_mscovrde_ply_7uj2 (*args) unless $game_switches && $game_switches[OVERRIDE_BGM_SWITCH_ID] && !$scene.is_a? (Scene_Gameover)
    end
  end
  #==========================================================================
  # ** ME
  #==========================================================================
  class ME
    # Aliases
    unless self.method_defined? (:modrna_rideme_play_6fv1)
      alias modrna_rideme_play_6fv1 play
    end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Play
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def play (*args)
      modrna_rideme_play_6fv1 (*args) unless $game_switches && $game_switches[OVERRIDE_ME_SWITCH_ID] && !$scene.is_a? (Scene_Gameover)
    end
  end
end

Credit


  • modern algebra

Thanks

  • Kail200x, for the request

Support


Please post in this topic at RMRK for support. Do not PM me, as then other people can't benefit from the answers.

Known Compatibility Issues

No known compatibility issues.

*
Rep: +0/-0Level 75
RMRK Junior
when i turn the switch off it still plays the map bgm in battle when i don't want it help me please