Bypassing battle-ending ME...and hit a snag

● ARCHIVED · READ-ONLY
Started by lord_steak 2 posts View original ↗
  1. Been watching DiamondandPlatinum3's tutorials to learn.  During his vid about aliasing module methods, I saw the elimination of battle BGM, and letting the map BGM keep going.  I thought to m'self take this one step further and do the same for the victory fanfares, since I rather liked how it flowed in Chrono Trigger when the party came to a series of forced battles and the one track kept playing through all of it, both the bouts and the setting up of the next, and so on.

    So...gave it a whirl.  Got it running so that both battle BGM and ending ME both were ignored and the map BGM played on without starting over, or stopping.  Thought maybe to leave the option of letting the battle BGM continue to play rather than the ending ME, just for grins.  And there's where I hit a snag.  Instead of the battle BGM continuing, the map BGM started up instead.  Here's what I've got in terms of code:

    Spoiler
    #===============================================================================
    # Slight adaptations from dp3's tutorial on aliasing module methods.
    # Many thanks for the instruction, sirrah.  You are a scholar and a gentleman.
    #
    # So then! this is to give the option to not play the designated battle BGM or
    # its corresponding victory fanfare, each controlled separately.  The previous
    # track should continue playing like nothing happened.  For disabling the ending
    # ME, that should leave the Battle BGM going.  For the Battle BGM, the map's
    # assigned music should continue playing.  Disable both, and the map track plays
    # through the whole thing without missing a beat or starting over.
    #===============================================================================

    module BattleManager
      class << self

    #-------------------------------------------------------------------------------
    # This section allow use of an in-game switch to choose when or when not to have
    # the map music continue into battle like nothing even happened, or to play the
    # Battle BGM as per normal.  Throw the switch, and the map music continues.
    #-------------------------------------------------------------------------------

        
        alias old_play_battle_bgm play_battle_bgm
        def play_battle_bgm
          unless $game_switches[11]
            #msgbox_p("Branch executed")
            old_play_battle_bgm
            ########################################################################
            # The snag is in here.  It's reaching this point, and the message box
            # pops up right on cue when the ME should start playing (if it were to
            # be an ME), but I'm not sure what in the crap went awry.  It's handling
            # keeping the assigned map track going without issue; it's trying to
            # maintain the Battle BGM that I'm running into trouble at.  It starts
            # the map track instead.
            ########################################################################

          end
        end

    #-------------------------------------------------------------------------------
    # This section allow use of an in-game switch to choose when or when not to have
    # the victory fanfare at the end of battle play, or to just allow the previous
    # track to continue.  Throw this other switch, and it'll go on peachy-keen.
    #-------------------------------------------------------------------------------

        
        alias old_play_battle_end_me play_battle_end_me
        def play_battle_end_me
          if !$game_switches[12]
            old_play_battle_end_me
          else
            play_battle_bgm
          end
        end
      end
    end
    Suggestions, please?
  2. You're looking for this:

    Code:
    #==============================================================================# ** BattleManager#------------------------------------------------------------------------------#  This module manages battle progress.#==============================================================================module BattleManager  #--------------------------------------------------------------------------  # * Resume BGM and BGS  #--------------------------------------------------------------------------  def self.replay_bgm_and_bgs    @map_bgm.replay unless $BTEST    @map_bgs.replay unless $BTEST  endend