Jump to content

Recommended Posts

Hello again, fellow RPG Maker community,

So I'm trying to implement scrolling battlebacks into my VX Ace game. I have this scene where the character says something in a battle, the screen flashes, and then the front and back battlebacks change, and then they start scrolling and looping much like a parallax background. I tried coding some manual events, but this seems impossible without a script. I looked around for a script and only found this one: 

https://forums.rpgmakerweb.com/index.php?threads/scrolling-battleback.41844/

It seemed like it would do the trick, but after inserting it into my game, as soon as I boot up the game I get this error:

1757502353_error1.PNG.7a94cdfb82d920f92a425255152c8938.PNG

I have never seen an error like this before. I even put it into a new project and it still wouldn't work. Does anyone know what the problem is and how to fix it? Or does anyone know of another script that does this?

Share this post


Link to post
Share on other sites

I think the script formatting is broken, split these two things into separate lines.

It should be

@back1_sprite.z = 0

@back1_sprite.ox = 0

Not in a single line like this:

@back1_sprite.z = 0    @back1_sprite.ox = 0

 

If the game crashes and points to this line, simply open the script editor and you'll be taken there, then simply press enter between these two variable assignments.

Share this post


Link to post
Share on other sites

I see the problem. I had done that before but then I realized this error was happening in 4 different places. I thought it was the same error not being fixed! Thank you!

For the sake of anyone reading this post who are having the same issue, here is the fixed version.

#==============================================================================
#** NS
#==============================================================================
class NS;
end #NS

#==============================================================================
# ** NS::Battle_Plane
#==============================================================================
class NS::Battle_Plane       
    # Switch to Enable Scrolling Background    
    Enable_Switch    = 15        
    # Variables for Horizontal and Vertical Scroll Speed    
    Back1_X_Variable = 10    
    Back1_Y_Variable = 11    
    Back2_X_Variable = 12    
    Back2_Y_Variable = 13    
end # NS::Battle_Plane


#==============================================================================
#** Spriteset_Battle
#==============================================================================
class Spriteset_Battle  

    #--------------------------------------------------------------------------  
    #* Create Battle Background (Floor) Sprite  
    #--------------------------------------------------------------------------  
    unless method_defined?(:battleback_C42W53GD_sb_create_battleback1)    
        alias_method(:battleback_C42W53GD_sb_create_battleback1, :create_battleback1) 
    end    

    def create_battleback1(*args, &block)    
        if $game_switches[NS::Battle_Plane::Enable_Switch] == true    
            @back1_sprite = Plane.new(@viewport1)      
            @back1_sprite.bitmap = battleback1_bitmap    
            @back1_sprite.z  = 0
            @back1_sprite_ox = 0   
            @back1_sprite_oy = 0    
        else     
            battleback_C42W53GD_sb_create_battleback1(*args, &block)   
        end  
    end   

  #--------------------------------------------------------------------------  
  # * Create Battle Background (Wall) Sprite  
  #--------------------------------------------------------------------------  
    unless method_defined?(:battleback_ms67JgWE_sb_create_battleback2)    
        alias_method(:battleback_ms67JgWE_sb_create_battleback2, :create_battleback2)  
    end    

    def create_battleback2(*args, &block)   
        if $game_switches[NS::Battle_Plane::Enable_Switch] == true     
            @back2_sprite = Plane.new(@viewport1)      
            @back2_sprite.bitmap = battleback2_bitmap      
            @back2_sprite.z = 1      
            @back2_sprite_ox = 0     
            @back2_sprite_oy = 0    
        else      
            battleback_ms67JgWE_sb_create_battleback2(*args, &block)   
        end  
     end  
  #-------------------------------------------------------------------------- 
  #* Update Battle Background (Floor) Sprite  
  #--------------------------------------------------------------------------  
    unless method_defined?(:battleback_HNirC0QE_sb_update_battleback1)    
     alias_method(:battleback_HNirC0QE_sb_update_battleback1, :update_battleback1) 
    end    

    def update_battleback1(*args, &block)   
        if $game_switches[NS::Battle_Plane::Enable_Switch] == true    
            @back1_sprite_ox += $game_variables[NS::Battle_Plane::Back1_X_Variable].to_f / 64 
            @back1_sprite_oy += $game_variables[NS::Battle_Plane::Back1_Y_Variable].to_f / 64 
            @back1_sprite.ox = @back1_sprite_ox * 16      
            @back1_sprite.oy = @back1_sprite_oy * 16  
        else      
            battleback_HNirC0QE_sb_update_battleback1(*args, &block)   
        end  
    end   
    
    #--------------------------------------------------------------------------  
    # * Update Battle Background (Wall) Sprite  
    #-------------------------------------------------------------------------- 
    unless method_defined?(:battleback_zmrQkMCU_sb_update_battleback2)   
        alias_method(:battleback_zmrQkMCU_sb_update_battleback2, :update_battleback2)
    end   
    
    def update_battleback2(*args, &block)    
        if $game_switches[NS::Battle_Plane::Enable_Switch] == true    
            @back2_sprite_ox += $game_variables[NS::Battle_Plane::Back2_X_Variable].to_f / 64  
            @back2_sprite_oy += $game_variables[NS::Battle_Plane::Back2_Y_Variable].to_f / 64   
            @back2_sprite.ox = @back2_sprite_ox * 16      
            @back2_sprite.oy = @back2_sprite_oy * 16  
        else      
            battleback_zmrQkMCU_sb_update_battleback2(*args, &block) 
        end  
    end

end # Spriteset_Battle

 

Share this post


Link to post
Share on other sites

Yes, yes, now that I checked the script over there, there indeed was the same error in multiple spots. Scripts posted on RMW got their formatting broken during migration to another forum software, if I recall correctly. All scripts turned into super long one liners and it looks like someone overlooked some of the lines when fixing the formatting manually.

You're welcome.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted