DP3 Battle Parallax - Cancel FX After Battle

● ARCHIVED · READ-ONLY
Started by Nugem 8 posts View original ↗
  1. Everytime you start a battle and script call for the parallax, the parallax will last forever.

    I'm having a hard time to figure how to CANCEL the Parallax effect after one battle.

    I've tried searching the script a cancel def, but nothing seens to work.

    I need a skilled scripter to help me set the script to to end after the battle.

    A script call I can set after the battle would work too.

    Here's the script:

    Spoiler
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    #             Battle Parallax Background
    #             Version: 1.0
    #             Author: DiamondandPlatinum3
    #             Date: September 6, 2012
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    #  Description:
    #
    #    This script allows you to use a parallax as a background for your
    #    Battles. It also allows you to scroll the parallax like any regular
    #    map parallax.
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    #------------------------------------------------------------------------------
    #  Instructions:
    #  
    #     -  There are two methods of changing the battle parallax options.
    #     
    #     ~  One of which is to use a script call with the following line of code
    #
    #         setbattleparallax( filename, scrollx, scrolly )
    #
    #        Where 'filename' is where you enter the name of the parallax, this must be
    #        done in quotation marks ( ' ' ).
    #        'scrollx' is the amount the parallax will scroll to the left or right.
    #        'scrolly' is the amount the parallax will scroll up or down.
    #
    #     -  If you do not want to change a specific value, simply pass in nil as the
    #        parameter
    #
    #     ~  The other method is to use notetags for the map, exactly like the following:
    #     
    #         ~BP_NAME: "Filename"
    #         ~BP_SCRX: Number
    #         ~BP_SCRY: Number
    #
    #        This has the same effect as calling the function, in that you can change
    #        the name of the battle parallax and it's scrolling variables.
    #       
    #     -  The advantage of using the map note is that you can set the parallax to
    #        a specific map like when you specify the battle backgrounds in the map
    #        settings. The function method is really for use when you want to change
    #        the parallax for a specific bossfight.
    #
    #     -  You can also use negative numbers to reverse the directions of the
    #        parallax scroll. You'll need to play around with it to achieve the
    #        desired effect
    #
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

    #==============================================================================
    # ** Spriteset_Battle
    #------------------------------------------------------------------------------
    #  This class brings together battle screen sprites. It's used within the
    # Scene_Battle class.
    #==============================================================================

    class Spriteset_Battle
      #--------------------------------------------------------------------------
      # * Overwritten Functions
      #--------------------------------------------------------------------------
      #     create_battleback1
      #     create_battleback2
      #     update_battleback1
      #     update_battleback2
      #     dispose_battleback1
      #     dispose_battleback2
      #
      #--------------------------------------------------------------------------
      # * Alias Listings
      #--------------------------------------------------------------------------
      alias dp3_batlparallax_sprsetbatl_init_1h2g       initialize
      alias dp3_batlparallax_sprsetbatl_dispose_1h2g    dispose
      alias dp3_batlparallax_sprsetbatl_update_1h2g     update
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        # Call Original Method
        dp3_batlparallax_sprsetbatl_init_1h2g
        
        create_parallax
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        update_parallax
        
        # Call Original Method
        dp3_batlparallax_sprsetbatl_update_1h2g
      end
      #--------------------------------------------------------------------------
      # * Free
      #--------------------------------------------------------------------------
      def dispose
        dispose_parallax
        
        # Call Original Method
        dp3_batlparallax_sprsetbatl_dispose_1h2g
      end
      #--------------------------------------------------------------------------
      # * Create Battle Background (Floor) Sprite
      #--------------------------------------------------------------------------
      def create_battleback1
        @back1_sprite = nil
      end
      #--------------------------------------------------------------------------
      # * Create Battle Background (Wall) Sprite
      #--------------------------------------------------------------------------
      def create_battleback2
        @back2_sprite = nil
      end
      #--------------------------------------------------------------------------
      # * Create Parallax
      #--------------------------------------------------------------------------
      def create_parallax
        @backparallax = Plane.new(@viewport1)
        @backparallax.bitmap = Cache.parallax($game_system.battleparallaxgraphicname)
        @backparallax.z = 0
      end
      #--------------------------------------------------------------------------
      # * Update Battle Background (Floor) Sprite
      #--------------------------------------------------------------------------
      def update_battleback1
        @back1_sprite.update if @back1_sprite
      end
      #--------------------------------------------------------------------------
      # * Update Battle Background (Wall) Sprite
      #--------------------------------------------------------------------------
      def update_battleback2
        @back2_sprite.update if @back2_sprite
      end
      #--------------------------------------------------------------------------
      # * Update Parallax
      #--------------------------------------------------------------------------
      def update_parallax
        if @backparallax
          @backparallax.ox += $game_system.battleparallaxgraphicscrollx
          @backparallax.oy += $game_system.battleparallaxgraphicscrolly
        end
      end
      #--------------------------------------------------------------------------
      # * Free Battle Background (Floor) Sprite
      #--------------------------------------------------------------------------
      def dispose_battleback1
        if @back1_sprite
          @back1_sprite.bitmap.dispose
          @back1_sprite.dispose
        end
      end
      #--------------------------------------------------------------------------
      # * Free Battle Background (Wall) Sprite
      #--------------------------------------------------------------------------
      def dispose_battleback2
        if @back2_sprite
          @back2_sprite.bitmap.dispose
          @back2_sprite.dispose
        end
      end
      #--------------------------------------------------------------------------
      # * Free Battle Parallax
      #--------------------------------------------------------------------------
      def dispose_parallax
        @backparallax.dispose if @backparallax
      end
     
    end # of Class

    #==============================================================================
    # ** Game_System
    #------------------------------------------------------------------------------
    #  This class handles system data. It saves the disable state of saving and
    # menus. Instances of this class are referenced by $game_system.
    #==============================================================================

    class Game_System
      #--------------------------------------------------------------------------
      # * New Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :battleparallaxgraphicname
      attr_accessor :battleparallaxgraphicscrollx
      attr_accessor :battleparallaxgraphicscrolly
      #--------------------------------------------------------------------------
      # * Alias Listings
      #--------------------------------------------------------------------------
      alias dp3_batlparallax_gamesys_init_1h2g     initialize
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        
        # Call Original Method
        dp3_batlparallax_gamesys_init_1h2g
        
        # Setup Parallax (safety precautions in case the user doesn't do it themselves)
        @battleparallaxgraphicname    = "BlueSky"
        @battleparallaxgraphicscrollx = 0
        @battleparallaxgraphicscrolly = 0
      end
     
    end # of Class

    #==============================================================================
    # ** Game_Interpreter
    #------------------------------------------------------------------------------
    #  An interpreter for executing event commands. This class is used within the
    # Game_Map, Game_Troop, and Game_Event classes.
    #==============================================================================

    class Game_Interpreter  
      #--------------------------------------------------------------------------
      # * Set Battle Parallax
      #--------------------------------------------------------------------------
      def setbattleparallax( filename, scrollx, scrolly )
        $game_system.battleparallaxgraphicname    = filename if filename.is_a?(String)
        $game_system.battleparallaxgraphicscrollx = scrollx  if scrollx.is_a?(Integer)
        $game_system.battleparallaxgraphicscrolly = scrolly  if scrolly.is_a?(Integer)
      end
     
    end # of Class    

    #==============================================================================
    # ** Game_Map
    #------------------------------------------------------------------------------
    #  This class handles maps. It includes scrolling and passage determination
    #  functions. The instance of this class is referenced by $game_map.
    #==============================================================================

    class Game_Map
      #--------------------------------------------------------------------------
      # * Alias Listings
      #--------------------------------------------------------------------------
      alias dp3_battleparallaxmapnote_setup_1h2g     setup  
      #--------------------------------------------------------------------------
      # * Setup
      #      map_id : map ID  
      #--------------------------------------------------------------------------
      def setup(*args)
        # Call Original Method
        dp3_battleparallaxmapnote_setup_1h2g(*args)
        
        # Check Map Note
        checkbattleparallax_mapnote
      end  
      #--------------------------------------------------------------------------
      # * Check Map Note for Battle Parallax Info
      #--------------------------------------------------------------------------
      def checkbattleparallax_mapnote
        
        # Set instance variables to current values
        prlxname = $game_system.battleparallaxgraphicname
        scrollx  = $game_system.battleparallaxgraphicscrollx
        scrolly  = $game_system.battleparallaxgraphicscrolly
        
        # Check Map Notetags
        
        # Code by Modern Algebra -----------------------------
        @map.note[/~BP_NAME:\s*\"(.+?)\"/im]
        prlxname = $1.gsub(/[\n\r]+/, "") if $1 # if not nil
        #-----------------------------------------------------
        @map.note[/~BP_SCRX: ([-0-9]+)/]
        scrollx = $1.to_i if $1
        @map.note[/~BP_SCRY: ([-0-9]+)/]
        scrolly = $1.to_i if $1
            
        $game_system.battleparallaxgraphicname    = prlxname
        $game_system.battleparallaxgraphicscrollx = scrollx
        $game_system.battleparallaxgraphicscrolly = scrolly
      end
     
    end # of Class
    Thanks already.
  2. Same problem here...
  3. if you change line 202 from:

    Code:
    @backparallax.dispose if @backparallax
    to:
    Code:
    if @backparallax      @backparallax.bitmap.dispose      @backparallax.dispose     end
    It may work.
  4. DiamondandPlatinum3 said:
    if you change line 202 from:

    @backparallax.dispose if @backparallaxto:
    Code:
    if @backparallax      @backparallax.bitmap.dispose      @backparallax.dispose     end
    It may work.
    I really appreciate your assistance.

    Unfortunately it don't worked for me.

    I've tried some script calls, but It either dont work or throw errors. I don't know if i'm typing it wrong or something else...
  5. It seems as though you may have a script incompatibility.


    If you have other custom scripts try to put this script below them and try once more.
  6. DiamondandPlatinum3 said:
    It seems as though you may have a script incompatibility.

    If you have other custom scripts try to put this script below them and try once more.
    I tried, but nothing changes!

    The parallax is supposed to be auto-removed after one battle? If not, what is exactly the script call I need to use?

    Also, I've noted the script seens to be runnin' even if I have not called it.

    A default sky parallax is used...
  7. I believe I may have misunderstood what you wanted to say. You simply want the battle parallax to appear in battle when YOU want it to appear, correct?

    I've been assuming that the battle parallax stuck around after battle and blended with the map. But if that's not the problem, then the script is working absolutely fine.

    This script REPLACES the battle background, so the default blue sky parallax is used if you haven't specified what you want.

    Spoiler
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# Battle Parallax Background# Version: 1.0# Author: DiamondandPlatinum3# Date: September 6, 2012#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# Description:## This script allows you to use a parallax as a background for your# Battles. It also allows you to scroll the parallax like any regular# map parallax.#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#------------------------------------------------------------------------------# Instructions:# # - There are two methods of changing the battle parallax options.# # ~ One of which is to use a script call with the following line of code## setbattleparallax( filename, scrollx, scrolly )## Where 'filename' is where you enter the name of the parallax, this must be # done in quotation marks ( ' ' ).# 'scrollx' is the amount the parallax will scroll to the left or right.# 'scrolly' is the amount the parallax will scroll up or down.### - If you do not want to change a specific value, simply pass in nil as the # parameter##### ~ The other method is to use notetags for the map, exactly like the following:# # ~BP_NAME: "Filename"# ~BP_SCRX: Number # ~BP_SCRY: Number## This has the same effect as calling the function, in that you can change # the name of the battle parallax and it's scrolling variables.#### - You can find screenshots to visually explain both methods# Here:


    Here:


    # - The advantage of using the map note is that you can set the parallax to# a specific map like when you specify the battle backgrounds in the map# settings. The function method is really for use when you want to change # the parallax for a specific bossfight.## - You can also use negative numbers to reverse the directions of the # parallax scroll. You'll need to play around with it to achieve the # desired effect##=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=class Spriteset_Battle # Switch to activate parallax. Turn ON this switch to activate. BATTLE_PARALLAX_ACTIVATION_EVENT_SWITCH_ID = 10 end#==============================================================================# ** Spriteset_Battle#------------------------------------------------------------------------------# This class brings together battle screen sprites. It's used within the# Scene_Battle class.#==============================================================================class Spriteset_Battle #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias dp3_batlparallax_sprsetbatl_init_1h2g initialize alias dp3_batlparallax_sprsetbatl_dispose_1h2g dispose alias dp3_batlparallax_sprsetbatl_update_1h2g update alias dp3_batlparallax_sprsetbatl_createbb1_1h2g create_battleback1 alias dp3_batlparallax_sprsetbatl_createbb2_1h2g create_battleback2 alias dp3_batlparallax_sprsetbatl_updatebb1_1h2g update_battleback1 alias dp3_batlparallax_sprsetbatl_updatebb2_1h2g update_battleback2 alias dp3_batlparallax_sprsetbatl_disposebb1_1h2g dispose_battleback1 alias dp3_batlparallax_sprsetbatl_disposebb2_1h2g dispose_battleback2 #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(*args) dp3_batlparallax_sprsetbatl_init_1h2g(*args) create_parallax if $game_switches[BATTLE_PARALLAX_ACTIVATION_EVENT_SWITCH_ID] end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update(*args) update_parallax if $game_switches[BATTLE_PARALLAX_ACTIVATION_EVENT_SWITCH_ID] dp3_batlparallax_sprsetbatl_update_1h2g(*args) end #-------------------------------------------------------------------------- # * Free #-------------------------------------------------------------------------- def dispose(*args) dispose_parallax if $game_switches[BATTLE_PARALLAX_ACTIVATION_EVENT_SWITCH_ID] dp3_batlparallax_sprsetbatl_dispose_1h2g(*args) end #-------------------------------------------------------------------------- # * Create Battle Background (Floor) Sprite #-------------------------------------------------------------------------- def create_battleback1(*args) if $game_switches[BATTLE_PARALLAX_ACTIVATION_EVENT_SWITCH_ID] @back1_sprite = nil else dp3_batlparallax_sprsetbatl_createbb1_1h2g(*args) end end #-------------------------------------------------------------------------- # * Create Battle Background (Wall) Sprite #-------------------------------------------------------------------------- def create_battleback2(*args) if $game_switches[BATTLE_PARALLAX_ACTIVATION_EVENT_SWITCH_ID] @back2_sprite = nil else dp3_batlparallax_sprsetbatl_createbb2_1h2g(*args) end end #-------------------------------------------------------------------------- # * Create Parallax #-------------------------------------------------------------------------- def create_parallax @backparallax = Plane.new(@viewport1) @backparallax.bitmap = Cache.parallax($game_system.battleparallaxgraphicname) @backparallax.z = 0 end #-------------------------------------------------------------------------- # * Update Battle Background (Floor) Sprite #-------------------------------------------------------------------------- def update_battleback1(*args) dp3_batlparallax_sprsetbatl_updatebb1_1h2g(*args) unless $game_switches[BATTLE_PARALLAX_ACTIVATION_EVENT_SWITCH_ID] end #-------------------------------------------------------------------------- # * Update Battle Background (Wall) Sprite #-------------------------------------------------------------------------- def update_battleback2(*args) dp3_batlparallax_sprsetbatl_updatebb2_1h2g(*args) unless $game_switches[BATTLE_PARALLAX_ACTIVATION_EVENT_SWITCH_ID] end #-------------------------------------------------------------------------- # * Update Parallax #-------------------------------------------------------------------------- def update_parallax if @backparallax @backparallax.ox += $game_system.battleparallaxgraphicscrollx @backparallax.oy += $game_system.battleparallaxgraphicscrolly end end #-------------------------------------------------------------------------- # * Free Battle Background (Floor) Sprite #-------------------------------------------------------------------------- def dispose_battleback1(*args) unless $game_switches[BATTLE_PARALLAX_ACTIVATION_EVENT_SWITCH_ID] dp3_batlparallax_sprsetbatl_disposebb1_1h2g(*args) end end #-------------------------------------------------------------------------- # * Free Battle Background (Wall) Sprite #-------------------------------------------------------------------------- def dispose_battleback2(*args) unless $game_switches[BATTLE_PARALLAX_ACTIVATION_EVENT_SWITCH_ID] dp3_batlparallax_sprsetbatl_disposebb2_1h2g(*args) end end #-------------------------------------------------------------------------- # * Free Battle Parallax #-------------------------------------------------------------------------- def dispose_parallax if @backparallax @backparallax.bitmap.dispose @backparallax.dispose end end end # of Class#==============================================================================# ** Game_System#------------------------------------------------------------------------------# This class handles system data. It saves the disable state of saving and # menus. Instances of this class are referenced by $game_system.#==============================================================================class Game_System #-------------------------------------------------------------------------- # * New Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :battleparallaxgraphicname attr_accessor :battleparallaxgraphicscrollx attr_accessor :battleparallaxgraphicscrolly #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias dp3_batlparallax_gamesys_init_1h2g initialize #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize # Call Original Method dp3_batlparallax_gamesys_init_1h2g # Setup Parallax (safety precautions in case the user doesn't do it themselves) @battleparallaxgraphicname = "BlueSky" @battleparallaxgraphicscrollx = 0 @battleparallaxgraphicscrolly = 0 end end # of Class#==============================================================================# ** Game_Interpreter#------------------------------------------------------------------------------# An interpreter for executing event commands. This class is used within the# Game_Map, Game_Troop, and Game_Event classes.#==============================================================================class Game_Interpreter #-------------------------------------------------------------------------- # * Set Battle Parallax #-------------------------------------------------------------------------- def setbattleparallax( filename, scrollx, scrolly ) $game_system.battleparallaxgraphicname = filename if filename.is_a?(String) $game_system.battleparallaxgraphicscrollx = scrollx if scrollx.is_a?(Integer) $game_system.battleparallaxgraphicscrolly = scrolly if scrolly.is_a?(Integer) end end # of Class #==============================================================================# ** Game_Map#------------------------------------------------------------------------------# This class handles maps. It includes scrolling and passage determination# functions. The instance of this class is referenced by $game_map.#==============================================================================class Game_Map #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias dp3_battleparallaxmapnote_setup_1h2g setup #-------------------------------------------------------------------------- # * Setup # map_id : map ID #-------------------------------------------------------------------------- def setup(*args) # Call Original Method dp3_battleparallaxmapnote_setup_1h2g(*args) # Check Map Note checkbattleparallax_mapnote end #-------------------------------------------------------------------------- # * Check Map Note for Battle Parallax Info #-------------------------------------------------------------------------- def checkbattleparallax_mapnote # Set instance variables to current values prlxname = $game_system.battleparallaxgraphicname scrollx = $game_system.battleparallaxgraphicscrollx scrolly = $game_system.battleparallaxgraphicscrolly # Check Map Notetags # Code by Modern Algebra ----------------------------- @map.note[/~BP_NAME:\s*\"(.+?)\"/im] prlxname = $1.gsub(/[\n\r]+/, "") if $1 # if not nil #----------------------------------------------------- @map.note[/~BP_SCRX: ([-0-9]+)/] scrollx = $1.to_i if $1 @map.note[/~BP_SCRY: ([-0-9]+)/] scrolly = $1.to_i if $1 $game_system.battleparallaxgraphicname = prlxname $game_system.battleparallaxgraphicscrollx = scrollx $game_system.battleparallaxgraphicscrolly = scrolly end end # of Class
    Updated script for you. Change the event switch ID to something more comfortable.

    Turn on the switch to activate the script, turn off to do the opposite.
  8. Amazing!

    That's exactly what I wanted!

    Thank you very much DiamondandPlatinum3!

    You rocks!