battleback effects for xp?

I’m wondering if anyone knows of any scripts or codes to animate battlebacks with effects in engine (such as swirling, hue shifting, and waving effects). I’ve been looking around and i have not been able to find any scripts that do this. I do understand that this may require shaders but i don’t really know much on how RMXP engine runs so idk if this is possible.

You name your battleback images sequentially (e.g., Forest, Forest1, Forest2, Forest3). The script cycles through them at a specified speed to create your animation. []

The Code:

Create a new script section right above Main in your Script Editor and paste the following code: [1, 2]

ruby

#==============================================================================
# Animated Battle Background by Blizzard
# Version: 1.1b (Slightly modified for brevity)
#==============================================================================

class Game_System
  attr_accessor :ANIMATED_BATTLE_BACKGROUND
  alias init_abb_game_system initialize
  def initialize
    init_abb_game_system
    @ANIMATED_BATTLE_BACKGROUND = true
  end
end

module BattlebackAnimation
  SPEED = 8 # Lower = faster, higher = slower
end

class Spriteset_Battle
  alias init_animated_battle_background_later initialize
  def initialize
    @frame = 0; @max_frame = 0; @origin_name = ""
    init_animated_battle_background_later
  end

  alias upd_animated_battle_background_later update
  def update
    if $game_system.ANIMATED_BATTLE_BACKGROUND
      if @origin_name != $game_temp.battleback_name
        @origin_name = $game_temp.battleback_name
        @frame = 0; @max_frame = 1
        while FileTest.exist?("Graphics/Battlebacks/#{@origin_name}#{@max_frame}.png")
          @max_frame += 1
        end
      end
      if @max_frame > 1 && Graphics.frame_count % BattlebackAnimation::SPEED == 0
        @frame = (@frame + 1) % @max_frame
        fname = @frame == 0 ? @origin_name : @origin_name + @frame.to_s
        $game_temp.battleback_name = fname
        @battleback1_sprite.bitmap = RPG::Cache.battleback(fname)
      end
    end
    upd_animated_battle_background_later
  end
end

Use code with caution.

How to Set Up the Files:

  1. Create your base battle background and import it into Graphics/Battlebacks.
  2. For the frames of the animation, name your subsequent files exactly as the base file plus a number (e.g., base file: Grass.png, animated frames: Grass1.png, Grass2.png, etc.).
  3. Adjust the SPEED constant in the script module (lines 10-13) if the animation plays too fast or too slow. []
2 Likes