Galv’s Animated Battlers V.1.2

DOWNLOAD DEMO:
Demo – Version 1.2 > (demo uses old version)
(This demo also includes Galv’s Battle Pets)

SCRIPT:

#------------------------------------------------------------------------------#
#  Galv's Animated Battlers
#------------------------------------------------------------------------------#
#  For: RPGMAKER VX ACE
#  Version 1.3
#------------------------------------------------------------------------------#
#  2014-06-20 - Version 1.3 - added ability to change actor battle x,y positions
#  2014-01-17 - Version 1.2 - compatibility fix when using with Actor Duel Game
#  2013-05-06 - Version 1.1 - added move speed for melee attacks
#  2013-05-04 - Version 1.0 - release
#------------------------------------------------------------------------------#
#  Holder's animated battler spritesheets can be found here:
#  http://animatedbattlers.wordpress.com/
#------------------------------------------------------------------------------#
#  This is just another animated battler script that uses holder-style animated
#  battler sheets. There are better ones out there, this one is just my basic
#  implementation in an attempt to continue improving my scripting.
#
#  This script works in the default battle system but is optimised for use with
#  Yanfly's battle script. Not tested with other battle scripts. Put this script
#  below any battle scripts you try it with.
#------------------------------------------------------------------------------#
 
#------------------------------------------------------------------------------#
#  Note tag for ENEMIES and ACTORS
#------------------------------------------------------------------------------#
#
#  <battler: filename>    # filename is the animated spritesheet located in
#                         # /Graphics/Battlers/
#                         # Required for actors, optional for enemies.
#
#  <stationary_sub>       # will not re-position themselves in front of an ally
#                         # they are covering/substituting for.
#
#------------------------------------------------------------------------------#
 
#------------------------------------------------------------------------------#
#  Note tags for SKILLS, ITEMS and STATES
#------------------------------------------------------------------------------#
#
#  <pose: x>    # The skill, item or state will use x pose row.
#               # If a skill does not have this tag, it will use row 6.
#               # If an item does not have this tag, it will use row 5.
#               # If a state does not have this tag, it will use row 2. If a
#               # battler has multiple states, it uses the highest priority.
#
#------------------------------------------------------------------------------#
 
#------------------------------------------------------------------------------#
#  Note tag for SKILLS, ITEMS and ACTORS
#------------------------------------------------------------------------------#
#
#  <melee: x>  # Normal attacks for Actors, items being used or skills being
#              # used that have this tag will make the actor dash into close
#              # range before doing the action. x is the dash speed.
#              # 0 = instant.  1 is slow, higher numbers is faster
#
#------------------------------------------------------------------------------#
 
#------------------------------------------------------------------------------#
#  SCRIPT CALLS
#------------------------------------------------------------------------------#
#
#  change_battler(id,"filename")  # Changes actor's animated battler sheet.
#
#------------------------------------------------------------------------------#
 
($imported ||= {})["Galv_Animated_Battlers"] = true
module GALV_BAT
 
#-------------------------------------------------------------------------------
#
#  * SETTINGS
#
#-------------------------------------------------------------------------------
 
  COLS = 4             # How many columns your animated spritesheet uses
  ROWS = 14            # How many rows your animated spritesheet uses
 
  ENEMY_FLIP = true    # true = flip enemy battler image horizontally
  ACTOR_FLIP = false   # true = flip actor battler image horizonatally
 
  HP_CRISIS = 0.25     # Remaining hp before poor status pose (0.25 = 25%)
 
  ONE_ANIM = [3,4,5,6,7,11,12]  # Poses that will NOT keep repeating their frames
 
  XOFFSET = 80    # horizonatal distance from opponent when using <melee: x>
  YOFFSET = 0     # vertical distance from opponent when using <melee: x>
 
  SXOFFSET = 40   # horizontal distance from ally when substituting
  SYOFFSET = 0    # vertical distance from ally when substituting
 
#------------------------------------------------------------------------------#
  ACTOR_POSITIONS = [ # don't touch
#------------------------------------------------------------------------------#
#  Default x,y locations of your actors on the battle screen
#------------------------------------------------------------------------------#
 
    [440,150],   # Party member 1 [x,y]      z = 0
    [460,180],   # Party member 2 [x,y]      z = 1
    [480,210],   # Party member 3 [x,y]      z = 2
    [500,260],   # Party member 4 [x,y]      z = 3
 
#   You can change these in game by using the z value above for each position.
#   script call:
#   $game_system.b_positions[z] = [x,y]
#
#   eg. To change position of party member 3 to x 500 and y 300
#   $game_system.b_positions[2] = [500,300]
 
#------------------------------------------------------------------------------#
  ] #don't touch
#------------------------------------------------------------------------------#
 
#-------------------------------------------------------------------------------
#  POSES USED FOR SPECIAL ACTIONS:
#-------------------------------------------------------------------------------
 
   COUNTER_ATTACK = 4       # Pose when counter attacking
   MAGIC_REFLECT  = 7       # Pose when reflecting magic
   EVASION        = [9,8]   # Move back then move forward poses to evade.
 
#-------------------------------------------------------------------------------
#  POSE INFORMATION:
#------------------------------------------------------------------------------#
#  DEFAULT SPRITESHEET POSES (HOLDER SETUP)
#------------------------------------------------------------------------------#
#  ROW     POSE
#
#   0      Idle
#   1      Guard
#   2      Poor Status
#   3      Get hit
#   4      Normal Attack
#   5      Use Item
#   6      Use Skill
#   7      Use Magic
#   8      Move toward
#   9      Move back
#   10     Victory
#   11     Battle Start
#   12     Dead
#   13     Spritesheet Info
#------------------------------------------------------------------------------#
 
#-------------------------------------------------------------------------------
#
#  * END SETTINGS
#
#-------------------------------------------------------------------------------
 
end
 
#------------------------------------------------------------------------------#
#  OVERWRITTEN METHODS
#------------------------------------------------------------------------------#
#  class Spriteset_Battle
#    - create_enemies
#    - create_actors
#    - update_actors
#------------------------------------------------------------------------------#
 
    #-----------------#
#---|   GAME_SYSTEM   |---------------------------------------------------------
    #-----------------#
 
class Game_System
  attr_accessor :b_positions
 
  alias galv_animb_gs_initialize initialize
  def initialize
    galv_animb_gs_initialize
    @b_positions = Array.new(GALV_BAT::ACTOR_POSITIONS)
  end
end
 
    #----------------------#
#---|   GAME_INTERPRETER   |----------------------------------------------------
    #----------------------#
 
class Game_Interpreter
  def change_battler(id,name)
    $game_actors[id].animated_battler = name
  end
end # Game_Interpreter
 
    #-------------------#
#---|   RPG::BASEITEM   |-------------------------------------------------------
    #-------------------#
 
class RPG::BaseItem
  def pose
    if @pose.nil?
      if @note =~ /<pose: (.*)>/i
        @pose = $1.to_i
      else
        @pose = nil
      end
    end
    @pose
  end
end # RPG::BaseItem
 
    #----------------------#
#---|   GAME_BATTLERBASE   |----------------------------------------------------
    #----------------------#
 
class Game_BattlerBase
  alias galv_animb_gbb_appear appear
  def appear
    return if SceneManager.scene_is?(Scene_Map)
    galv_animb_gbb_appear
  end
end # Game_BattlerBase
 
    #------------------#
#---|   GAME_BATTLER   |--------------------------------------------------------
    #------------------#
 
class Game_Battler < Game_BattlerBase
  attr_accessor :animated_battler
  attr_accessor :pose
  attr_accessor :freeze_pose
  attr_accessor :bactivated
  attr_accessor :move_target
  attr_accessor :orx
  attr_accessor :ory
  attr_accessor :reset_pose
  attr_accessor :move_speed
 
  def setup_animated_battler
    @pose = 0
    @move_speed = 0
    char = actor? ? actor : enemy
    @animated_battler = $1 if char.note =~ /<battler:[ ](.*)>/i
  end
 
  def do_pose(col)
    @reset_pose = true
    @pose = col
    @freeze_pose = true if GALV_BAT::ONE_ANIM.include?(@pose)
  end
 
  alias galv_animb_gbgbb_on_turn_end on_turn_end
  def on_turn_end
    galv_animb_gbgbb_on_turn_end
    set_idle_pose
  end
 
  alias galv_animb_gbgbb_on_action_end on_action_end
  def on_action_end
    galv_animb_gbgbb_on_action_end
    set_idle_pose
  end
 
  def set_idle_pose
    return if !@bactivated
    if death_state?
      do_pose(12)
    elsif guard?
      do_pose(1)
    elsif !@states.empty?
      do_pose(state_pose)
    elsif low_life?
      do_pose(2)
    else
      do_pose(0)
    end
    @freeze_pose = false unless GALV_BAT::ONE_ANIM.include?(@pose)
  end
 
  def low_life?
    @hp < (mhp * GALV_BAT::HP_CRISIS)
  end
 
  def state_pose
    prio = 0
    prio_state = 0
    @states.each { |sid|
      if $data_states[sid].priority > prio
        prio_state = sid
        prio = $data_states[sid].priority
      end
    }
    if prio_state <= 0 || !$data_states[prio_state].pose
      return 2
    else
      $data_states[prio_state].pose
    end
  end
 
  alias galv_animb_gbgbb_add_state add_state
  def add_state(state_id)
    galv_animb_gbgbb_add_state(state_id)
    set_idle_pose
  end
 
  alias galv_animb_gbgbb_remove_state remove_state
  def remove_state(state_id)
    dead = dead?
    galv_animb_gbgbb_remove_state(state_id)
    set_idle_pose if state_id != 1 && !dead? || dead
  end
 
  alias galv_animb_gbgbb_execute_damage execute_damage
  def execute_damage(user)
    perform_get_hit if @result.hp_damage > 0
    galv_animb_gbgbb_execute_damage(user)
    if !$imported["YEA-BattleEngine"]
      SceneManager.scene.wait(15)
      set_idle_pose
    end
  end
 
  def perform_get_hit
    if !dead? && !guard? && $game_party.in_battle && @animated_battler
      do_pose(3)
      @sprite_effect_type = :get_hit
    end
  end
 
  def perform_counter_attack
    if !dead? && $game_party.in_battle && @animated_battler
      do_pose(GALV_BAT::COUNTER_ATTACK)
      @sprite_effect_type = :counter_attack
    end
  end
 
  def perform_magic_reflect
    if !dead? && $game_party.in_battle && @animated_battler
      do_pose(GALV_BAT::MAGIC_REFLECT)
      @sprite_effect_type = :counter_attack
    end
  end
 
  def perform_victory
    if !dead? && @animated_battler
      do_pose(10)
    end
  end
 
  def perform_enter_battle
    @bactivated = true
    if !dead? && @animated_battler
      @pose = 11
      @sprite_effect_type = :enter_battle
    end
  end
 
  def perform_dash(dash_type,target)
    if !dead? && @animated_battler
      @move_target = target
      pose = dash_type == :dash_forward ? 8 : 9
      do_pose(pose)
      @sprite_effect_type = dash_type
    end
  end
 
  def perform_travel(dash_type,target,speed)
    @move_target = target
    @move_speed = speed
    do_pose(8)
    @sprite_effect_type = dash_type
  end
 
  def moving?
    @move_speed > 0
  end
 
  def perform_dodge
    if !dead? && @animated_battler
      do_pose(GALV_BAT::EVASION[0])
      @sprite_effect_type = :dodge
    end
  end
 
  alias galv_animb_gbgbb_on_battle_start on_battle_start
  def on_battle_start
    perform_enter_battle
    galv_animb_gbgbb_on_battle_start
  end
 
  def init_animated_battler(i)
    @sprite_effect_type = :appear
    @bactivated = false
    @pose = alive? ? 11 : 12
    if actor?
      #@screen_x = GALV_BAT::ACTOR_POSITIONS[i][0]
      #@orx = GALV_BAT::ACTOR_POSITIONS[i][0]
      #@screen_y = GALV_BAT::ACTOR_POSITIONS[i][1]
      #@ory = GALV_BAT::ACTOR_POSITIONS[i][1]
      @screen_x = $game_system.b_positions[i][0]
      @orx = $game_system.b_positions[i][0]
      @screen_y = $game_system.b_positions[i][1]
      @ory = $game_system.b_positions[i][1]
    else
      @orx = @screen_x
      @ory = @screen_y
    end
  end
 
  def reinit_battler(i)
    if actor?
      #@screen_x = GALV_BAT::ACTOR_POSITIONS[i][0]
      #@orx = GALV_BAT::ACTOR_POSITIONS[i][0]
      #@screen_y = GALV_BAT::ACTOR_POSITIONS[i][1]
      #@ory = GALV_BAT::ACTOR_POSITIONS[i][1]
      @screen_x = $game_system.b_positions[i][0]
      @orx = $game_system.b_positions[i][0]
      @screen_y = $game_system.b_positions[i][1]
      @ory = $game_system.b_positions[i][1]
    else
      @orx = @screen_x
      @ory = @screen_y
    end
    @bactivated = true
  end
 
  alias galv_animb_gbgbb_item_apply item_apply
  def item_apply(user, item)
    galv_animb_gbgbb_item_apply(user, item)
    if @result.evaded
      perform_dodge
    end
  end
end # Game_Battler < Game_BattlerBase
 
    #----------------#
#---|   GAME_ACTOR   |----------------------------------------------------------
    #----------------#
 
class Game_Actor < Game_Battler
  attr_accessor :screen_x
  attr_accessor :screen_y
 
  def screen_x; screen_x = @screen_x; end
  def screen_y; screen_y = @screen_y; end
  def screen_z; 100; end
 
  alias galv_animb_gagb_initialize initialize
  def initialize(actor_id)
    galv_animb_gagb_initialize(actor_id)
    setup_animated_battler
    @screen_x = 0
    @screen_y = 0
  end
 
  def sub_pose(target)
    if !dead? && @animated_battler
      return if $data_actors[@actor_id].note =~ /<stationary_sub>/i
      @screen_x = target.screen_x - GALV_BAT::SXOFFSET
      @screen_y = target.screen_y - GALV_BAT::SYOFFSET
      @sprite_effect_type = :substitute
    end
  end
 
  def return_to_position
    if !dead? && @animated_battler
      @screen_x = @orx
      @screen_y = @ory
    end
  end
end # Game_Actor < Game_Battler
 
    #----------------#
#---|   GAME_ENEMY   |----------------------------------------------------------
    #----------------#
 
class Game_Enemy < Game_Battler
  alias galv_animb_gegb_initialize initialize
  def initialize(index, enemy_id)
    galv_animb_gegb_initialize(index, enemy_id)
    setup_animated_battler
  end
 
  def sub_pose(target)
    if !dead? && @animated_battler
      return if $data_enemies[@enemy_id].note =~ /<stationary_sub>/i
      @screen_x = target.screen_x + GALV_BAT::SXOFFSET
      @screen_y = target.screen_y + GALV_BAT::SYOFFSET
      @sprite_effect_type = :substitute
    end
  end
 
  def return_to_position
    if !dead? && @animated_battler
      @screen_x = @orx
      @screen_y = @ory
    end
  end
end # Game_Enemy < Game_Battler
 
    #-------------------#
#---|   BATTLEMANAGER   |-------------------------------------------------------
    #-------------------#
 
module BattleManager
  class << self
    alias galv_animb_bm_process_victory process_victory
  end
 
  def self.process_victory
    $game_party.battle_members.each { |actor| actor.perform_victory }
    galv_animb_bm_process_victory
  end
end # BattleManager
 
    #------------------#
#---|   SCENE_BATTLE   |--------------------------------------------------------
    #------------------#
 
class Scene_Battle < Scene_Base
  alias galv_animb_sbsb_start start
  def start
    position_battlers
    galv_animb_sbsb_start
  end
 
  def position_actors
    $game_party.battle_members.each_with_index { |battler,i|
      battler.reinit_battler(i)
    }
    @spriteset.refresh_actors
  end
 
  def position_battlers
    galv_all_battle_members.each_with_index { |battler,i|
      battler.init_animated_battler(i)
    }
  end
 
  def galv_all_battle_members
    $game_party.battle_members + $game_troop.members
  end
 
  alias galv_animb_sbsb_show_animation show_animation
  def show_animation(targets, animation_id)
    @move_target = targets[0]
    check_dash
    set_pose
    galv_animb_sbsb_show_animation(targets, animation_id)
  end
 
  def check_dash
    move = move_to_target
    if move > 0
      @subject.perform_travel(:move_forward,@move_target,move)
      update_for_wait while @subject.moving?
    elsif move == 0
      @subject.perform_dash(:dash_forward,@move_target)
      wait(30)
    end
  end
 
  def move_to_target
    return -1 if no_action && !@moveitem
    @moveitem ||= @subject.current_action.item
    return $1.to_i if @moveitem.note =~ /<melee: (.*)>/i
    if @moveitem.is_a?(RPG::Skill) && @moveitem.id == 1
      char = @subject.actor? ? $data_actors[@subject.id] :
        $data_enemies[@subject.enemy_id]
      return $1.to_i if char.note =~ /<melee: (.*)>/i
    end
    return -1
  end
 
  def no_action
    !@subject || !@subject.current_action || !@subject.current_action.item
  end
 
  alias galv_animb_sbsb_process_action_end process_action_end
  def process_action_end
    if @subject.screen_x != @subject.orx
      @subject.perform_dash(:dash_back,@subject)
      wait(25)
    end
    galv_animb_sbsb_process_action_end
    @moveitem = nil
  end
 
  alias galv_animb_sbsb_invoke_counter_attack invoke_counter_attack
  def invoke_counter_attack(target,item)
    target.perform_counter_attack
    galv_animb_sbsb_invoke_counter_attack(target,item)
  end
 
  alias galv_animb_sbsb_invoke_magic_reflection invoke_magic_reflection
  def invoke_magic_reflection(target, item)
    target.perform_magic_reflect
    galv_animb_sbsb_invoke_magic_reflection(target, item)
  end
 
  def set_pose
    return if no_action
    item = @subject.current_action.item
    if item.is_a?(RPG::Skill)
      case item.id
      when 2  # guard
        @subject.do_pose(1)
      when 1  # attack
        @subject.do_pose(4)
        wait(20) if $imported["YEA-BattleEngine"]
      else
        unique = item.pose ? item.pose : 6
        @subject.do_pose(unique)
      end
    elsif item.is_a?(RPG::Item)
      unique = item.pose ? item.pose : 5
      @subject.do_pose(unique)
      wait(30) if $imported["YEA-BattleEngine"]
    end
  end
end # Scene_Battle < Scene_Base
 
    #----------------------#
#---|   WINDOW_BATTLELOG   |----------------------------------------------------
    #----------------------#
 
class Window_BattleLog < Window_Selectable
  alias galv_animb_wblws_display_substitute display_substitute
  def display_substitute(substitute, target)
    substitute.sub_pose(target)
    galv_animb_wblws_display_substitute(substitute, target)
  end
end
 
    #----------------------#
#---|   SPRITESET_BATTLE   |----------------------------------------------------
    #----------------------#
 
class Spriteset_Battle
  #OVERWRITE
  def create_enemies
    @enemy_sprites = $game_troop.members.reverse.collect do |enemy|
      if enemy.animated_battler
        Sprite_AnimBattler.new(@viewport1, enemy)
      else
        Sprite_Battler.new(@viewport1, enemy)
      end
    end
  end
 
  # OVERWRITE
  def create_actors
    @actor_sprites = $game_party.battle_members.reverse.collect do |actor|
      Sprite_ActorBattler.new(@viewport1, actor)
    end
  end
 
  # OVERWRITE
  def update_actors
    need_update = false
    @actor_sprites.each_with_index do |sprite, i|
      sprite.battler = $game_party.battle_members[i]
      if sprite.battler
        sprite.update
      else
        need_update = true
      end
    end
    need_update = true if @actor_sprites.count < $game_party.battle_members.count
    if need_update
      SceneManager.scene.position_actors
    end
  end
 
  def refresh_actors
    dispose_actors
    create_actors
  end
end # Spriteset_Battle
 
    #--------------------#
#---|   SPRITE_BATTLER   |------------------------------------------------------
    #--------------------#
 
class Sprite_Battler < Sprite_Base
  alias galv_animb_spritebsb_update update
  def update
    if @battler && @battler.animated_battler && @galv_animb
      super
    else
      galv_animb_spritebsb_update
    end
  end
end # Sprite_Battler < Sprite_Base
 
    #------------------------#
#---|   SPRITE_ANIMBATTLER   |--------------------------------------------------
    #------------------------#
 
class Sprite_AnimBattler < Sprite_Battler
  def initialize(viewport, battler = nil)
    init_variables
    super(viewport,battler)
  end
 
  def init_variables
    @pattern = 0
    @speed_timer = 0
    @pose = 0
    @galv_animb = true
  end
 
  def update
    if @battler && @battler.animated_battler
      update_bitmap
      update_pose
      update_src_rect
      update_anim
      update_position
      setup_new_effect
      setup_new_animation
      update_effect
    end
    super
  end
 
  def update_bitmap
    new_bitmap = Cache.battler(@battler.animated_battler,
      @battler.battler_hue)
    if bitmap != new_bitmap
      self.bitmap = new_bitmap
      spritesheet_normal
      init_visibility
    end
  end
 
  def spritesheet_normal
    @cw = bitmap.width / GALV_BAT::COLS
    @ch = bitmap.height / GALV_BAT::ROWS
    self.ox = @cw / 2
    self.oy = @ch
    set_mirror
  end
 
  def set_mirror
    self.mirror = GALV_BAT::ENEMY_FLIP
  end
 
  def update_pose
    if @pose != @battler.pose
      @pattern = 0
      @pose = @battler.pose
    end
    if @battler.reset_pose
      @pose = 0
      @battler.reset_pose = false
    end
  end
 
  def update_src_rect
    if @pattern >= GALV_BAT::COLS
      @pattern = 0 unless freeze_pose?
    end
    sx = @pattern * @cw
    sy = @battler.pose * @ch
    self.src_rect.set(sx, sy, @cw, @ch)
  end
 
  def freeze_pose?
    @battler.freeze_pose && @pattern == GALV_BAT::COLS - 1
  end
 
  def update_anim
    return if !@battler.bactivated
    @speed_timer += 1
    if @speed_timer > 8
      @pattern += 1 unless freeze_pose?
      @speed_timer = 0
    end
  end
 
  def update_position
    self.x = @battler.screen_x
    self.y = @battler.screen_y
    self.z = @battler.screen_z
  end
 
  def start_effect(effect_type)
    @effect_type = effect_type
    case @effect_type
    when :counter_attack,:magic_reflect,:get_hit
      @effect_duration = 40
      @battler_visible = true
    when :enter_battle
      @effect_duration = 35
      @battler_visible = true
    when :dash_forward,:dash_back
      @effect_duration = 15
      @battler_visible = true
    when :move_forward
      @effect_duration = 500
      @move_duration = @effect_duration
      @battler_visible = true
    when :dodge
      @effect_duration = 20
      @battler_visible = true
    when :substitute
      @effect_duration = 20
      @battler_visible = true
    end
    super
  end
 
  def update_effect
    if @effect_duration > 0
      case @effect_type
      when :get_hit, :substitute
        update_generic_pose
      when :counter_attack,:magic_reflect
        update_counter
      when :enter_battle
        update_enter_battle
      when :dash_forward
        update_dash_forward
      when :move_forward
        update_move_forward
      when :dash_back
        update_dash_back
      when :dodge
        update_dodge
      end
    end
    super
  end
 
  def revert_to_normal
    return if do_revert?
    super
    spritesheet_normal
  end
 
  def do_revert?
    @effect_type == :whiten || @battler.dead?
  end
 
  def update_generic_pose
    if @effect_duration == 1
      @battler.return_to_position
      @battler.set_idle_pose
    end
  end
 
  def xoff; @battler.actor? ? GALV_BAT::XOFFSET : -GALV_BAT::XOFFSET; end
  def yoff; @battler.actor? ? GALV_BAT::YOFFSET : -GALV_BAT::YOFFSET; end
 
  def update_dash_forward
    if @battler.actor? && @battler.screen_x > Graphics.width / 2
      @battler.screen_x -= 3
    elsif @battler.enemy? && @battler.screen_x < Graphics.width / 2
      @battler.screen_x += 3
    end
    update_disappear
    if @effect_duration == 1
      @battler.screen_x = @battler.move_target.screen_x + xoff
      @battler.screen_y = @battler.move_target.screen_y + yoff
      start_effect(:appear)
    end
  end
 
  def update_dash_back
    if @battler.actor? && @battler.screen_x < Graphics.width / 2
      @battler.screen_x += 3
    elsif @battler.enemy? && @battler.screen_x > Graphics.width / 2
      @battler.screen_x -= 3
    end
    update_disappear
    if @effect_duration == 1
      @battler.screen_x = @battler.move_target.orx
      @battler.screen_y = @battler.move_target.ory
      start_effect(:appear)
    end
  end
 
  def update_move_forward
    if @battler.actor?
      @battler.screen_x -= x_difference(@battler,@battler.move_target)
    elsif @battler.enemy?
      @battler.screen_x += x_difference(@battler,@battler.move_target)
    end
    @battler.screen_y += y_difference(@battler,@battler.move_target)
  end
 
  def y_difference(bat,tar)
    yof = bat.actor? ? yoff : -yoff
    y_diff = bat.ory - (tar.screen_y + yof)
    x_diff = bat.orx - (tar.screen_x + xoff)
    y_move = y_diff.to_f / (x_diff.to_f / [@battler.move_speed,1].max).to_f
    return bat.actor? ? -y_move : y_move
  end
 
  def x_difference(bat,tar)
    if bat.actor? && bat.screen_x <= (tar.screen_x + xoff) ||
        bat.enemy? && bat.screen_x >= (tar.screen_x + xoff)
      @battler.move_speed = 0
      @effect_duration = 1
      return 0
    end
    return @battler.move_speed
  end
 
  def update_dodge
    if @effect_duration == 1
      @battler.screen_x = @battler.orx
      @battler.screen_y = @battler.ory
      @battler.set_idle_pose
    elsif @effect_duration >= 10
      @battler.actor? ? @battler.screen_x += 3 : @battler.screen_x -= 3
    else
      @battler.pose = GALV_BAT::EVASION[1]
      @battler.actor? ? @battler.screen_x -= 3 : @battler.screen_x += 3
    end
  end
 
  def update_enter_battle
    if @effect_duration == 1
      @battler.bactivated = true
      @battler.set_idle_pose
    end
  end
 
  def update_counter
    self.color.set(255, 255, 255, 0)
    self.color.alpha = 128 - (26 - @effect_duration) * 10
    @battler.set_idle_pose if @effect_duration == 1
  end
 
  def update_collapse; end
end # Sprite_AnimBattler < Sprite_Base
 
    #-------------------------#
#---|   SPRITE_ACTORBATTLER   |-------------------------------------------------
    #-------------------------#
 
class Sprite_ActorBattler < Sprite_AnimBattler
  def initialize(viewport, battler = nil)
    super(viewport,battler)
  end
 
  def dispose; super; end
  def update; super; end
 
  def set_mirror
    self.mirror = GALV_BAT::ACTOR_FLIP
  end
 
  def update_position
    self.x = @battler.screen_x
    self.y = @battler.screen_y
    self.z = @battler.screen_z
  end
 
  def init_visibility
    self.opacity = 255
  end
end # Sprite_ActorBattler < Sprite_AnimBattler
 
    #------------------------#
#---|   WINDOW_BATTLEENEMY   |--------------------------------------------------
    #------------------------#
 
class Window_BattleEnemy < Window_Selectable
  if $imported["YEA-BattleEngine"]
    def create_flags
      set_select_flag(:any)
      select(-1)
      return if $game_temp.battle_aid.nil?
      if $game_temp.battle_aid.need_selection?
        select(-1)
      elsif $game_temp.battle_aid.for_all?
        select(-1)
        set_select_flag(:all)
      elsif $game_temp.battle_aid.for_random?
        select(-1)
        set_select_flag(:random)
      end
    end
  end
end # Window_BattleEnemy < Window_Selectable

84 thoughts on “Galv’s Animated Battlers V.1.2

  1. How do the work is it possible to a combo with multiple skills?

  2. zerphoon says:

    Hey sorry again didnt have internet last time I was on your script pages was using my phone, my question is, is this script compatible with your Actor Duel Mini Game?

  3. zerphoon says:

    It’s okay just noticed figured I’d point it out for you :)

  4. izarckjitter says:

    simply amazing!
    is there’s a way for it to work with yanfly’s party sistem?
    (i mean adding extra characters to battle.)
    Link is here:

    Party System

  5. Wind says:

    I’m sorry for barging in. I know you are a bit busy lately, but is there any way to change the enemy sprite using script call just like what we can do with the actors?
    Even a non-simplified like @game_actors[x].animated_battler = “name” or @game_party.members[x].animated_battler = “name” will do. I’ve been trying with @game_enemy and @game_troop.members, but it seems I need to write interpreter for that first. I cannot really understand what should I type inside the bracket. Is it only id like with actors, or its’ index within the troop AND the enemy id, or should it be @enemy_index[y], or something else.. I’m at loss here.
    Enlighten me, please?

    • Galv says:

      That’s not set up in the script. If you need a different sprite for enemies, you could use a different enemy :)

      • Wind says:

        Why of course there is a way to get around that without any scripting..

        I ended up placing a different enemy right under the one I want to ‘transform’ from and hide it away. When I wish the enemy to transform into that hidden enemy, I just have the hidden one appear, then kill the previous one (i did have the dead pose column and some other column empty, so I can make as if it disappear). And other itty-bitty eventing so it goes a little smoother and make it as though the damages we have dish out on it remained there…

        …or just let it as it is if I feel like I’m cruel enough to do it. It’s just that the collapse sound effect still bugging me.. But then again, I guess I can still manage things out.

        Good things when the sprite used is the same one (albeit with different hue applied from enemy picture hue slider) the event command transform enemy still works.

        Honestly I’m just wondering whether there is a way to simplify this workaround, but then, since there isn’t, I’ll just leave my workaround here in case anyone needs to do the same.

        Well, at least the way you code this script is quite easy to understand even for me who have only little knowledge of scripting. I did find out that pose for the traveling toward the enemy does not repeat, so if the pose actually have the sprite walking (not jump dashing), if the melee speed is low enough, the sprite would just steps until the last frame of the pose then slide all the way to the target while remain in the last frame (imagine a huge and pretty slugish bear slides to you slowly after taking two strides ;D). I fixed this by copy pasting line @freeze_pose = false unless GALV_BAT::ONE_ANIM.include?(@pose) to def perform_travel after the do_pose.

        Also, for my project, I did change few lines, mostly on the @effect_duration because I want the enemy perform some of their poses faster than the actors. I hope you don’t mind that.

        Whew, sorry if it is a bit lengthy on my part.

      • Galv says:

        Not at all, modify it to suit your project is all good :)

  6. Emanuele says:

    Galv, it seems i cannot change actors positions, not even script call is working. Wonder why?

    • Emanuele says:

      Nevermind, i seem to have solved the issue myself.
      It seems the script suffer a ‘slow processing’. I could change battler X and Y only modifying 1 value at time, because otherwise the script didn’t apply the changes and when i closed RMVXA and opened it again the values were resetted. So after making 8 different modifies, i could get the changes

  7. blazearx says:

    How do i change the character sprite in battle ? I am new to it and the script is working but …. i dont know cuz i have a sprite sheet for animaated battlers so i wanna know…..

  8. MAHTUKOP says:

    Can I use it in a commercial project?

  9. Red says:

    Hey! I’m having a few issues here:
    1) Actors are shown on the right and vertically, while the enemies are shown at the bottom and horizontally. How could I make the enemies show on the left, vertically, directly opposite to the actors?
    2) My idea is to use the script to show the battle from the side, with animation, but I only want the idle animation to work (attacks, evades, etc, disable them and always show the idle pose). I’ve tried with the notetag in any skill, and it seems to keep ‘dashing’ to the target, as the sprite disappears when I attack. I’d like the battlers to behave like regular RMVX (still image, but an animated one). Is it possible?

    Thank you! I’m very new to this.

    • Galv says:

      1) you need to move your enemy positions in the “troop” tab of your database. Move them to the left.

      2) Not sure what you mean by disabling attacks, evades, etc. but that isn’t an option in the script

      • Red says:

        1) Thanks! Figured it out, although I’m gonna try and find an “accurate” way of positioning them (like what your script does with actors, giving the X/Y position), at least for the vertical location, to match them exactly with the actors.

        2) What I mean is that apparently, the script is designed to use a different pose for every action (idle, attack, evade, use skills, etc). I only use idle animated sprites, so I’d like to disable every other pose/animation, and always play the idle one. If it’s not coded in the script, could you give me some insight on where to look in the script to add it?

        Thanks for the reply! :)

  10. Galv says:

    unfortunately it’d take a lot of changing the script to do what you want it to. It wasn’t designed to do that :)

  11. Shane says:

    Hi Galv,

    I get this error everytime the actor encounters an enemy.

    Script ‘Galvs Animated Battlers’ line 397: NoMethodError occured.
    undefined method ‘[]’ for nil:NilClass

    The script runs fine when I do a battle test in the database of the editor.

    Any ideas?

    Thanks,
    Shane

  12. Je says:

    Hi galv, I just have a question… I don’t know if this is a dumb question or not but please bear with me… actually when I paste your script to my script editor, then pressed the green play button. this popped up. (line 1672: No methoderror occurred. undefined method [] for nil: Nilclass.) I’m sorry but I just dont understand scripting at all.. sorry and thanks..

    • Galv says:

      This script only has 995 lines. Your error is referencing a script that has over 1672 lines. Run through this checklist to try to solve the problem: https://galvs-scripts.com/errors-using-scripts/

      • Je says:

        hi thanks for the quick reply and btw the reason I can’t start my game was because I accidentally didn’t copy the whole script but now, I was able to open the game, but right now i run to another problem when I try to enter a battle this popped up (line 743 nomethoderror occured undefined method width for nil: nilclass. I tried to place = 4 to end of the line in 743 but what happened was it showed me a syntax error so of course I removed it again,, and of course I tried this for new game and load game. sorry just don’t know what i’m doing here.

      • Galv says:

        Make sure your actors have notetag to specify their animated battler file.

        # filename is the animated spritesheet located in /Graphics/Battlers/
        Required for actors, optional for enemies.

  13. Brandon says:

    Hey, great script! I like this one way better than the other animated battler scripts I have found so I want to keep using it in my projects.
    I have just one problem and one request I would like to make of you.
    My problem is that I am using custom battle sprites, to be specific, Pioneer Valley Games sprite sheets. They are larger then standard RPG Maker VX Ace sprites. They are all unique frames to display every status and command and function perfectly with your script, as long as I don’t want to change anything. What I am running into, is that certain boss battle scenes I am creating require enemy transformations. While this is a standard feature in the Ace battle events, I cannot get them to change physical appearance in battle. The enemy will take on the skill/attack characteristics of the transformation but will not change sprites. The sprites are all there in my battlers database and work fine in their own troops. I am doing the transformation correctly because I can get it to work when I am not using custom sprites. Is there any tweaks or changes I can make to the script to accommodate the custom sprites?
    Lastly, my request. Since you are an awesome scripter, and I have checked all the forums for months. Even had direct conversations with the authors of other scripts I am using, I cannot seem to get an resolution to this. Other authors tell me it’s “Galv’s fault”. Whatever…. I need an add-on to your animated battler’s script that would allow summoning abilities. Either to replace the user or the party, and let me designate the location of the summoned sprite if it is to replace the party or just simply replace the user if it only going to replace the user.
    I have tried all the other summoning scripts I can find out there, but they just don’t want to play well with any other animated battler script then Holder’s (yuck), and your script is way better then Holder’s. I really want to use your script, can you please make an add-on or summoning script that will work with your animated battler script?
    I am using Yanfly’s (Ace) battle engine, Victor’s Engine, Yanfly (Ace) Core, Galv’s Animated Battlers for my battle scene manager. None of there conflict, I have no issues or error messages running the game with all these together.

    • Galv says:

      Replacing sprites in a battle is an issue with my battle script currently. I will need to address it but I don’t have time to look into it any time soon, unfortunately :(

      • Brandon says:

        Thank you for replying so quickly. I will not be done with this epic game for several months. If you get time to look into it and come up with a fix, let me know please. If you want a copy of this game when I am done, it’s yours. I am naming you in the credits, and is there any specific way you want your name to appear other than Galv? If so, just let me know.

  14. Derek says:

    Hi Galv, this is a very useful script and I really want to use it. However after couple of test plays I ran into a problem is that the Actor sometime lose turn because the player (me ^_^) accidentally hit the right button on the keyboard during battle.

    The default battle system doesn’t have this problem because if you hit the right or left button on the keyboard during battle, it doesn’t do anything.

    Is there anyway to disable the left and right button on Actor selection during battle?

    • Galv says:

      That sounds like functionality of Yanfy’s battle script and not this animated battlers script

      • Derek says:

        Hi, thanks for your quick reply. Yes, but since this script depends on the core Yanfly script so I have been Googling a lot trying to solve this problem. Here is what I did and looks like it works. I fixed it by going on line 1725+ and editing this method:

        “def process_handling
        return unless open? && active
        return process_dir4 if Input.repeat?(:LEFT)
        return process_dir6 if Input.repeat?(:RIGHT)
        return super
        end”

        Basically I just put the “#” in front of the “return process_dir4 if Input.repeat?(:LEFT)” and “return process_dir6 if Input.repeat?(:RIGHT)”.

        I wish to know 2 thing: 1. Can this script works without the Yanfly core script? I have tested and take out the Yanfly script from the Demo, everything seem to work fine until the enemy dies then the graphic moving kind of happens too fast.

        2. Is the way I did above the correct way to do it?

      • Galv says:

        The script should work without yanfly’s combat, I dont know what you mean by dying too fast. And yes, what you did sounds like it would be a good solution

  15. Derek says:

    What I meant is that when I run the battle without the Yanfly script, when the opponent die, it seem like its graphic cut right away to the “body lying on the ground” graphic. Where if I run the battle with Yanfly script, the animation seem to be a bit 0slower and look more natural and realistic. I was using PV Games’ Holder styles batlers…. Can I ask if Yanfly script is not necessary, then what is the benefit of the Yanfly script in the Demo in your estimation?

  16. Chi says:

    Hello Galv. Great script, I installed it just fine and got the sprite sheets/actors and enemies set up, but when I run into battle, this happens I get an error from
    line 743: @cw = bitmap.width / GALV_BAT::COLS

    I’m new to scripting and rpg maker in general :b so I should have gotten more experience first, I know, but I really want to use a side-view battle system with animated battlers.

  17. Impossible says:

    The script is great and is very simple and easy. The only thing I have a problem is that the animations are a little transparent. Is that something that can be easily changed or ?

    • Galv says:

      This script doesn’t change animation transparency. Are you talking about skill animations? They all use a blend mode by default, you’ll need to edit that in the database > animations tab.

  18. Emmet says:

    Hey, is there any way to change the framerate on the animations? It’s a little too fast for my taste.
    Thanks for the script though!

  19. pianotm says:

    How can my make my characters dash forward when attacking? It seems to me I was able to do that before, but now I can’t see how it’s done.

    • Galv says:

      #——————————————————————————#
      # Note tag for SKILLS, ITEMS and ACTORS
      #——————————————————————————#
      #
      # <melee: x>
      #
      # # Normal attacks for Actors, items being used or skills being
      # # used that have this tag will make the actor dash into close
      # # range before doing the action. x is the dash speed.
      # # 0 = instant. 1 is slow, higher numbers is faster

      • pianotm says:

        Okay. Thank you. I missed that because I remember a somewhat more involved notetag procedure. It must have been a different script.

      • pianotm says:

        I have another issue. I know nothing about scripting, obviously, and I wanted to make sure I couldn’t fix this problem myself. I could still be missing something, but anyway, I can only assume that this line:

        ONE_ANIM = [3,4,5,6,7,11,12] # Poses that will NOT keep repeating their frames

        is not working. This wouldn’t be a problem except that for enemies, who I do not have falling on the ground, but fading away, keep replaying the death animation.

      • Galv says:

        Hmmm, I will add to my to-do list to look into this but not sure when I will be able to check it out. Sounds like it could be a bug

  20. Fan says:

    Ah, I hope I’m not double-posting. It seems my comment didn’t get through, so I’m just posting this just to be sure.

    Hi there, and first of all, what I’ve seen of your work is simply amazing. I’m excited to try this out for myself, but when I put in the script, unfortunately I got this when I entered a battle…

    Script ‘Galv’s Animated Battler v1.2’ line 770: NoMethodError occurred.
    undefined method ‘*’ for :left:Symbol

    Yes, I did start a new game, yes, I have put it in the correct position in the script editor and yes, I have all the required files. I also tried making a new, clean project and try it out but somehow I got the same error. I do have Yanfly Core Engine and Battle Symphony installed but not the battler pets.
    I’m guessing it has something to do with the sprite but I have no idea what.
    I am using VX ace, but that shouldn’t be a problem.

    Supposedly I just have to put in the scripts, edit them if needed, set the sprite sheet for each character and voila?

    Thank you for still helping us n00bs with our problems xD My apologies.
    Keep up the great work!
    -Fan that thinks he’s double posting. (And probably is)

    • Galv says:

      Doesn’t battle symphony do side view battlers? If so you cannot use it with this script as they do the same thing and will conflict.

      • Fan says:

        Ah, so that’s the problem. I feel embarrassed for not realizing.
        So it is not possible to have Battle Symphony along with your Animated Battlers? That’s a shame… I really wanted to use the symphony tags.

        Oh well. I’ll just have to weigh the pros and cons of the two.
        Thanks for replying so soon!

  21. Pls Help me :(
    Does this script work on it’s own or do I need another script?
    Why does this keep bothering me about line 743?
    Why won’t it work? D:

  22. Anonymous says:

    Hi, I’m using this script alone, and the battlers do not move even though the melee is set to 6 in the note area. How can I fix this?

    • Galv says:

      Double check that you have done everything correctly. Study the demo and how it was done.

      Also here’s an error trapping checklist:

      Errors Using VX/VX Ace Scripts

      • Anonymous says:

        Thanks!

        I have two more question, the first one is that the enemies sometimes disappear upon death and sometimes play the animation. I have no idea what’s causing this.
        Also, is there a way to make the battlers walk back without fading, like they do when walking forward?

      • Galv says:

        No, the plugin was coded to fade when going back.

        Unfortunately for the enemies disappearing thing I don’t know what’s causing it either. You’ll need to put your error-trapping hat on and do many tests to try and work it out :)

      • Anonymous says:

        I know, but is there a way to remove that? I also noticed it makes the battler sprite permanently translucent after button mashing the space bar.

      • Galv says:

        I do not know what is wrong and do not have time to error trap your project for you or modify the plugin. You will have to error trap your own project.

  23. risyad says:

    Nice plug and play script ! but i was wondering if its possible to lock a pose for a certain period or turns in battle.

    I’m making a skill that “jump” on the current turn and then gain a state called “aerial” ( i made a clear row, for it will appear as if shes disappeared when in this state) which raise her evasion stat by 100% then, perform an attack on the next turn. The problem is every time she evade an attack while in “aerial” state, she does the evade pose. So i was hoping to be able to lock her pose until shes not in “aerial” state anymore.

    Thank you for your amazing scripts btw :D

    • Galv says:

      Unfortunately you can’t do that with this script, sorry. This is a very basic battle system, I recommend checking out one of the more advanced ones to do stuff like that :)

  24. spawn3601 says:

    Odd question I was trying to use Yanfly’s visual battler for the player and this for enemies, but essentially when using the script if I use an animated battler it works, however If I don’t specify one of the graphics and attempt to make it use the default animation sprite it freaks out and give me a nil class error is there any way to make this only apply to enemies and let the players default sprite remain?

  25. Chris Kelly says:

    Can i use this in a commercial Project?

  26. Valentina Baker says:

    is there anyway I can change the battler’s sprite when an actor changes armour?

  27. lightninsoarer says:

    Hello galv, I’m using mog_hunter’s damage popup script that shows the amount of damage that is done to an enemy or ally on the screen. When I add your script it still works for the enemies, but the moment I add battler sprites to the enemies and players, the damage popup can no longer be seen. Is this like an incompatibility issue?

  28. John says:

    Is it possible to have enemy’s with animated battlers that do more than just Attack? I have 3 seprate skills and I cant get it to move for any of them. not even the one I use for the basic attack.
    All it will do is idle and hurt and dead it wont do anything else. I put a lot of work into making an enemy sprite and would like it to work please help me.

    • Galv says:

      I recommend asking in a forum for assistance.

      • Kai Myers says:

        do you think the forum knows why this line of code: @cw = bitmap.width / GALV_BAT::COLS makes an error appear saying the method isn’t specified.

      • Galv says:

        Not really enough information to go on – you’d have to post screenshots of the error etc. in said forum if they were to try and help error trap.

  29. ChillCat says:

    So for some

Leave a comment