Jump to content
Sign in to follow this  
Hytporsche

Kread-EX - Animated Battlers Problem?

Recommended Posts

Okay, so i decided to use Kread-EX - Animated Battlers. I love the script concept and very easy and flexible. But, I'm doing something wrong... and to be honest. I feel so dumb posting this! I guess I'm just not grasping the conecpt  :(  Can someone possible help? (BTW, I thought it was my other scripts causing th eproblem. So, I am running a fresh project. This is the only script.)

 

Kread-EX - Animated Battlers: (For more info to help me)

http://grimoirecastle.wordpress.com/rgss3-scripts/graphics-enhancements/animated-battlers/

 

Script:

 

 

 

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#  â–¼ Animated Battlers
#  Author: Kread-EX
#  Version 1.01
#  Release date: 28/11/2012
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
 
#------------------------------------------------------------------------------
#  â–¼ UPDATES
#------------------------------------------------------------------------------
# # 05/01/2013. Compatibility with Banish Skills.
#------------------------------------------------------------------------------
#  â–¼ INTRODUCTION
#------------------------------------------------------------------------------
# # This script will allow you to use battle animations as animation battlers.
# # It sounds simple enough but please read the instructions.
# #
# # DON'T ASK ME FOR A DEMO. PLEASE.
#------------------------------------------------------------------------------
#  â–¼ INSTRUCTIONS
#------------------------------------------------------------------------------
# # I direct you to this page: 
#------------------------------------------------------------------------------
#  â–¼ TERMS OF USAGE
#------------------------------------------------------------------------------
# #  You are free to adapt this work to suit your needs.
# #  You can use this work for commercial purposes if you like it.
# #  Credit is appreciated.
# #
# # For support:
# # grimoirecastle.wordpress.com
# # rpgmakerweb.com
#------------------------------------------------------------------------------
#  â–¼ COMPATIBILITY
#------------------------------------------------------------------------------
# # Works with the DBS and Ace Battle Engine.
# # List of aliases and overwrites:
# #
# # DataManager
# # load_database (alias)
# # load_aniB_notetags (new method)
# #
# # BattleManager
# # process_victory (alias)
# #
# # 
# #
# # RPG::Actor, RPG::Class, RPG::Enemy
# # load_aniB_notetags (new method)
# # animation_data (new method)
# #
# # RPG::UsableItem
# # load_aniB_notetags (new method)
# # battler_anim_id (new attr method)
# # move_to_target (new attr method)
# #
# # Game_Battler
# # skill_pose_active (new attr method)
# # item_pose_active (new attr method)
# # x_destination (new attr method)
# # y_destination (new attr method)
# # movement_type (new attr method)
# # animation_data (new method)
# # skill_battler_anim (new method)
# # item_battler_anim (new method)
# # on_action_end (alias)
# # is_moving? (new method)
# #
# # Game_Actor
# # victory_pose (new attr method)
# # perform_collapse_effect (alias)
# # screen_x (overwrite)
# # screen_y (overwrite)
# # screen_z (overwrite)
# # use_sprite? (overwrite)
# #
# # Sprite_Battler
# # screen_x (new attr method)
# # screen_y (new attr method)
# # initialize (alias)
# # update (alias)
# # update_bitmap (overwrite)
# # update_position (overwrite)
# # update_movement (new method)
# # update_battler_poses (new method)
# # animation? (overwrite)
# # battler_animation? (new method)
# # start_battler_animation (new method)
# # load_battler_animation_bitmap (new method)
# # make_battler_animation_sprites (new method)
# # set_battler_animation_origin (new method)
# # move_battler_animation (new method)
# # dispose_battler_animation (new method)
# # update_battler_animation (new method)
# # battler_animation_set_sprites (new method)
# # battler_animation_process_timing (new method)
# # get_current_pose (new method)
# # update_collapse (alias)
# # update_boss_collapse (overwrite)
# #
# # Window_BattleActor
# # update (alias)
# #
# # Scene_Battle
# # execute_action (alias)
# # move_to_target (new method)
# # move_back_to_pos (new method)
#------------------------------------------------------------------------------
 
$imported = {} if $imported.nil?
$imported['KRX-AnimatedBattlers'] = true
 
puts 'Load: Animated Battlers v1.01 by Kread-EX'
 
module KRX
#===========================================================================
# â–  CONFIGURATION
#===========================================================================
 
  ACTOR_POSITIONS = [[400, 300], [460, 320], [520, 340], [580, 360]]
  VICTORY_DELAY = 30
 
#===========================================================================
# â–  CONFIGURATION ENDS HERE
#===========================================================================
  module REGEXP
    ANIM_TAG_START = /<animation_block>/i
    ANIM_TAG_END = /<\/animation_block>/i
    ANIM_STANDING = /standing:[ ]*(\d+)/i
    ANIM_DANGER = /danger:[ ]*(\d+)/i
    ANIM_HIT = /hit:[ ]*(\d+)/i
    ANIM_DEAD = /dead:[ ]*(\d+)/i
    ANIM_VICTORY = /victory:[ ]*(\d+)/i
    ANIM_ITEM_DEFAULT = /item_default:[ ]*(\d+)/i
    ANIM_SKILL_DEFAULT = /skill_default:[ ]*(\d+)/i
    ANIM_ITEM = /item:[ ]*(\d+(?:\s*,\s*\d+*)*)/i
    ANIM_SKILL = /skill:[ ]*(\d+(?:\s*,\s*\d+*)*)/i
    ANIM_MOV_F = /move_f: [ ]*(\d+)/
    ANIM_MOV_B = /move_b: [ ]*(\d+)/
    ANIM_MIRROR = /mirror/i
    ANIM_ON_ITEM = /<anim_id:[ ]*(\d+)>/i
    ANIM_TO_TARGET = /<move_to_target>/i
  end
  
end
 
#===========================================================================
# â–  DataManager
#===========================================================================
 
module DataManager  
#--------------------------------------------------------------------------
# â— Loads the database
#--------------------------------------------------------------------------
class << self; alias_method(:krx_aniB_dm_ld, :load_database); end
def self.load_database
krx_aniB_dm_ld
load_aniB_notetags
end  
#--------------------------------------------------------------------------
# â— Loads the note tags
#--------------------------------------------------------------------------
def self.load_aniB_notetags
groups = [$data_skills, $data_items, $data_actors, $data_classes,
    $data_enemies]
for group in groups
for obj in group
next if obj.nil?
obj.load_aniB_notetags
end
end
puts "Read: Animated Battlers Notetags"
end
end
 
#===========================================================================
# â–  BattleManager
#===========================================================================
 
module BattleManager
#--------------------------------------------------------------------------
# â— Process the battle victory
#--------------------------------------------------------------------------
  class << self; alias_method(:krx_aniB_bm_pv, :process_victory); end
  def self.process_victory
    $game_party.members.each {|m| m.victory_pose = true}
    KRX::VICTORY_DELAY.times {SceneManager.scene.update_basic}
    krx_aniB_bm_pv
    $game_party.members.each {|m| m.victory_pose = false}
  end
end
 
 
#===========================================================================
# â–  RPG::Actor, RPG::Class, RPG::Enemy
#===========================================================================
 
module KRX
  module ANIMATED_BATTLERS
    #--------------------------------------------------------------------------
    # â— Loads the note tags
    #--------------------------------------------------------------------------
    def load_aniB_notetags
      @animation_data = {}
      @note.split(/[\r\n]+/).each do |line|
        case line
        when KRX::REGEXP::ANIM_TAG_START
          @enable_aniB_tags = true
        when KRX::REGEXP::ANIM_TAG_END
          @enable_aniB_tags = false
        when KRX::REGEXP::ANIM_STANDING
          @animation_data[:stand] = $1.to_i if @enable_aniB_tags
        when KRX::REGEXP::ANIM_DANGER
          @animation_data[:danger] = $1.to_i if @enable_aniB_tags
        when KRX::REGEXP::ANIM_HIT
          @animation_data[:hit] = $1.to_i if @enable_aniB_tags
        when KRX::REGEXP::ANIM_DEAD
          @animation_data[:dead] = $1.to_i if @enable_aniB_tags
        when KRX::REGEXP::ANIM_VICTORY
          @animation_data[:victory] = $1.to_i if @enable_aniB_tags
        when KRX::REGEXP::ANIM_ITEM_DEFAULT
          @animation_data[:dflt_item] = $1.to_i if @enable_aniB_tags
        when KRX::REGEXP::ANIM_SKILL_DEFAULT
          @animation_data[:dflt_skill] = $1.to_i if @enable_aniB_tags
        when KRX::REGEXP::ANIM_MIRROR
          @animation_data[:mirror] = true if @enable_aniB_tags
        when KRX::REGEXP::ANIM_MOV_F
          @animation_data[:move_f] = $1.to_i if @enable_aniB_tags
        when KRX::REGEXP::ANIM_MOV_B
          @animation_data[:move_b] = $1.to_i if @enable_aniB_tags
        when KRX::REGEXP::ANIM_ITEM
          if @enable_aniB_tags
            @animation_data[:item] = [] if @animation_data[:item].nil?
            $1.scan(/\d+/).each {|i| @animation_data[:item].push(i.to_i)}
          end
        when KRX::REGEXP::ANIM_SKILL
          if @enable_aniB_tags
            @animation_data[:skill] = [] if @animation_data[:skill].nil?
            $1.scan(/\d+/).each {|i| @animation_data[:skill].push(i.to_i)}
          end
        end
      end
    end
    #--------------------------------------------------------------------------
    # â— Returns the animation settings
    #--------------------------------------------------------------------------
    def animation_data(key)
      @animation_data[key]
    end
  end
end
 
class RPG::Actor < RPG::BaseItem
  include KRX::ANIMATED_BATTLERS
end
 
class RPG::Class < RPG::BaseItem
  include KRX::ANIMATED_BATTLERS
end
 
class RPG::Enemy < RPG::BaseItem
  include KRX::ANIMATED_BATTLERS
end
 
#===========================================================================
# â–  RPG::UsableItem
#===========================================================================
 
class RPG::UsableItem < RPG::BaseItem
#--------------------------------------------------------------------------
# â— Public instance variables
#--------------------------------------------------------------------------
  attr_reader     :battler_anim_id
  attr_reader     :move_to_target
#--------------------------------------------------------------------------
# â— Loads the note tags
#--------------------------------------------------------------------------
  def load_aniB_notetags
    @note.split(/[\r\n]+/).each do |line|
      case line
      when KRX::REGEXP::ANIM_ON_ITEM
        @battler_anim_id = $1.to_i
      when KRX::REGEXP::ANIM_TO_TARGET
        @move_to_target = true
      end
    end
  end
end
 
#===========================================================================
# â–  Game_Battler
#===========================================================================
 
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# â— Public instance variables
#--------------------------------------------------------------------------
  attr_accessor   :skill_pose_active
  attr_accessor   :item_pose_active
  attr_accessor   :x_destination
  attr_accessor   :y_destination
  attr_accessor   :movement_type
#--------------------------------------------------------------------------
# â— Returns the battler animation data
#--------------------------------------------------------------------------
  def animation_data(key)
    if actor?
      if actor.animation_data(key).nil?
        self.class.animation_data(key)
      else
        actor.animation_data(key)
      end
    else
      enemy.animation_data(key)
    end
  end
#--------------------------------------------------------------------------
# â— Returns the battler animation ID for a specific skill
#--------------------------------------------------------------------------
  def skill_battler_anim(id)
    data = animation_data(:skill) || []
    data.each_index do |i|
      next if i % 2 != 0
      return data[i+1] if data == id
    end
    $data_skills[id].battler_anim_id ? $data_skills[id].battler_anim_id :
    animation_data(:dflt_skill)
  end
#--------------------------------------------------------------------------
# â— Returns the battler animation ID for a specific item
#--------------------------------------------------------------------------
  def item_battler_anim(id)
    data = animation_data(:item) || []
    data.each_index do |i|
      next if i % 2 != 0
      return data[i+1] if data == id
    end
    $data_items[id].battler_anim_id ? $data_items[id].battler_anim_id :
    animation_data(:dflt_item)
  end
  #--------------------------------------------------------------------------
  # â— Clears the action data
  #--------------------------------------------------------------------------
  alias_method(:krx_aniB_gb_oae, :on_action_end)
  def on_action_end
    krx_aniB_gb_oae
    @skill_pose_active = false
    @item_pose_active = false
  end
  #--------------------------------------------------------------------------
  # â— Determine if the battler is moving on the battle screen
  #--------------------------------------------------------------------------
  def is_moving?
    (@x_destination > 0) || (@y_destination > 0)
  end
end
 
#===========================================================================
# â–  Game_Actor
#===========================================================================
 
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # â— Public instance variables
  #--------------------------------------------------------------------------
  attr_accessor   :victory_pose
  #--------------------------------------------------------------------------
  # â— Perform the collapse effect if dead
  #--------------------------------------------------------------------------
  alias_method(:krx_aniB_ga_pce, :perform_collapse_effect)
  def perform_collapse_effect
    return if animation_data(:dead) != nil
    krx_aniB_ga_pce
  end
  #--------------------------------------------------------------------------
  # â— Return x coordinates on battle screen
  #--------------------------------------------------------------------------
  def screen_x
    KRX::ACTOR_POSITIONS[index][0]
  end
  #--------------------------------------------------------------------------
  # â— Return y coordinates on battle screen
  #--------------------------------------------------------------------------
  def screen_y
    KRX::ACTOR_POSITIONS[index][1]
  end
  #--------------------------------------------------------------------------
  # â— Return z coordinates on battle screen
  #--------------------------------------------------------------------------
  def screen_z
    return 100
  end
  #--------------------------------------------------------------------------
  # â— The actors will use a sprite
  #--------------------------------------------------------------------------
  def use_sprite?
    return true
  end
end
 
#==============================================================================
# â–  Sprite_Battler
#==============================================================================
 
class Sprite_Battler < Sprite_Base
  #--------------------------------------------------------------------------
  # â— Public instance variables
  #--------------------------------------------------------------------------
  attr_reader   :screen_x
  attr_reader   :screen_y
  #--------------------------------------------------------------------------
  # â— Object Initialize
  #--------------------------------------------------------------------------
  alias_method(:krx_aniB_sb_init, :initialize)
  def initialize(viewport, battler = nil)
    krx_aniB_sb_init(viewport, battler)
    @battler_ani_duration = 0
    @blank_bitmap = Bitmap.new(48, 48)
  end
  #--------------------------------------------------------------------------
  # â— Frame Update
  #--------------------------------------------------------------------------
  alias_method(:krx_abiB_sb_update, :update)
  def update
    dispose_battler_animation unless @battler || !battler_animation?
    krx_abiB_sb_update
    update_movement
  end
  #--------------------------------------------------------------------------
  # â— Updates the initial bitmap
  #--------------------------------------------------------------------------
  def update_bitmap
    self.bitmap = @blank_bitmap if self.bitmap != @blank_bitmap
    update_battler_poses
  end
  #--------------------------------------------------------------------------
  # â— Updates the coordinates
  #--------------------------------------------------------------------------
  def update_position
    self.x = @screen_x || @battler.screen_x
    self.y = @screen_y || @battler.screen_y
    self.z = @battler.screen_z
  end
  #--------------------------------------------------------------------------
  # â— Updates the movement positions
  #--------------------------------------------------------------------------
  def update_movement
    return unless @battler
    @battler.x_destination ||= 0
    @battler.y_destination ||= 0
    @screen_x ||= @battler.screen_x
    @screen_y ||= @battler.screen_y
    if @battler.x_destination != 0
      sx, dx = @screen_x, @battler.x_destination
      @screen_x = sx > dx ? [sx-16, dx].max : [sx+16, dx].min
      mx = @screen_x - sx
      move_battler_animation(mx, 0)
      if @screen_x == dx
        @battler.x_destination = 0
        update_position
      end
    end
    if @battler.y_destination != 0
      sy, dy = @screen_y, @battler.y_destination
      @screen_y = sy > dy ? [sy-8, dy].max : [sy+8, dy].min
      my = @screen_y - sy
      move_battler_animation(0, my)
      if @screen_y == dy
        @battler.y_destination = 0
        update_position
      end
    end
  end
  #--------------------------------------------------------------------------
  # â— Updates the battler poses
  #--------------------------------------------------------------------------
  def update_battler_poses
    update_battler_animation
    return if @battler.nil? || !@battler_visible
    battler_anim_id = get_current_pose
    return if battler_animation? || @no_loop
    return if battler_anim_id.nil?
    animation = $data_animations[battler_anim_id]
    mirror = @battler.animation_data(:mirror)
    start_battler_animation(animation, mirror)
  end
  #--------------------------------------------------------------------------
  # â— Determine if an anim is playing
  #--------------------------------------------------------------------------
  def animation?
    @animation != nil || @banim_wait
  end
  #--------------------------------------------------------------------------
  # â— Determine if a battler anim is playing
  #--------------------------------------------------------------------------
  def battler_animation?
    @battler_animation != nil
  end
  #--------------------------------------------------------------------------
  # â— Start the battler animation
  #--------------------------------------------------------------------------
  def start_battler_animation(animation, mirror)
    dispose_battler_animation
    @battler_animation = animation
    @battler_mirror = mirror
    if @battler_animation
      set_animation_rate
      @battler_ani_duration = @battler_animation.frame_max * @ani_rate + 1
      load_battler_animation_bitmap
      make_battler_animation_sprites
      set_battler_animation_origin
      update_battler_animation
    end
  end
  #--------------------------------------------------------------------------
  # â— Construct the animation bitmaps
  #--------------------------------------------------------------------------
  def load_battler_animation_bitmap
    animation1_name = @battler_animation.animation1_name
    animation1_hue = @battler_animation.animation1_hue
    animation2_name = @battler_animation.animation2_name
    animation2_hue = @battler_animation.animation2_hue
    @battler_ani_bitmap1 = Cache.animation(animation1_name, animation1_hue)
    @battler_ani_bitmap2 = Cache.animation(animation2_name, animation2_hue)
    if @@_reference_count.include?(@battler_ani_bitmap1)
      @@_reference_count[@battler_ani_bitmap1] += 1
    else
      @@_reference_count[@battler_ani_bitmap1] = 1
    end
    if @@_reference_count.include?(@battler_ani_bitmap2)
      @@_reference_count[@battler_ani_bitmap2] += 1
    else
      @@_reference_count[@battler_ani_bitmap2] = 1
    end
    Graphics.frame_reset
  end
  #--------------------------------------------------------------------------
  # â— Construct the animation sprites to hold the bitmaps
  #--------------------------------------------------------------------------
  def make_battler_animation_sprites
    @battler_ani_sprites = []
    if @use_sprite && !@@ani_spr_checker.include?(@battler_animation)
      16.times do
        sprite = ::Sprite.new(viewport)
        sprite.visible = false
        @battler_ani_sprites.push(sprite)
      end
    end
    @battler_ani_duplicated = @@ani_checker.include?(@battler_animation)
  end
  #--------------------------------------------------------------------------
  # â— Pinpoint the animation origin values
  #--------------------------------------------------------------------------
  def set_battler_animation_origin
    @battler_ani_ox = x - ox + width / 2
    @battler_ani_oy = y - oy + height / 2
    if @battler_animation.position == 0
      @battler_ani_oy -= height / 2
    elsif @battler_animation.position == 2 || @battler_animation.position == 3
      @battler_ani_oy += height / 2
    end
  end
  #--------------------------------------------------------------------------
  # â— Move the animation
  #--------------------------------------------------------------------------
  def move_battler_animation(dx, dy)
    if @battler_animation
      @battler_ani_ox += dx
      @battler_ani_oy += dy
      @battler_ani_sprites.each do |sprite|
        sprite.x += dx
        sprite.y += dy
      end
    end
  end
  #--------------------------------------------------------------------------
  # â— Free the animation
  #--------------------------------------------------------------------------
  def dispose_battler_animation
    if @battler_ani_bitmap1
      @@_reference_count[@battler_ani_bitmap1] -= 1
      if @@_reference_count[@battler_ani_bitmap1] == 0
        @battler_ani_bitmap1.dispose
      end
    end
    if @battler_ani_bitmap2
      @@_reference_count[@battler_ani_bitmap2] -= 1
      if @@_reference_count[@battler_ani_bitmap2] == 0
        @battler_ani_bitmap2.dispose
      end
    end
    if @battler_ani_sprites
      @battler_ani_sprites.each {|sprite| sprite.dispose }
      @battler_ani_sprites = nil
      @battler_animation = nil
    end
    @battler_ani_bitmap1 = nil
    @battler_ani_bitmap2 = nil
  end
  #--------------------------------------------------------------------------
  # â— Update the animation
  #--------------------------------------------------------------------------
  def update_battler_animation
    return unless battler_animation?
    @battler_ani_duration -= 1
    if @battler_ani_duration % @ani_rate == 0
      if @battler_ani_duration > 0
        frame_index = @battler_animation.frame_max
        frame_index -= (@battler_ani_duration + @ani_rate - 1) / @ani_rate
        @last_frame = frame_index
        battler_animation_set_sprites(@battler_animation.frames[frame_index])
        @battler_animation.timings.each do |timing|
          battler_animation_process_timing(timing) if timing.frame == frame_index
        end
      else
        @battler_animation = nil
      end
    end
  end
  #--------------------------------------------------------------------------
  # â— Set the animation sprites' coordinates
  #--------------------------------------------------------------------------
  def battler_animation_set_sprites(frame)
    cell_data = frame.cell_data
    @battler_ani_sprites.each_with_index do |sprite, i|
      next unless sprite
      pattern = cell_data[i, 0]
      if !pattern || pattern < 0
        sprite.visible = false
        next
      end
      sprite.bitmap = pattern < 100 ? @battler_ani_bitmap1 :
      @battler_ani_bitmap2
      sprite.visible = true
      sprite.src_rect.set(pattern % 5 * 192,
      pattern % 100 / 5 * 192, 192, 192)
      if @battler_mirror
        sprite.x = @battler_ani_ox - cell_data[i, 1]
        sprite.y = @battler_ani_oy + cell_data[i, 2]
        sprite.angle = (360 - cell_data[i, 4])
        sprite.mirror = (cell_data[i, 5] == 0)
      else
        sprite.x = @battler_ani_ox + cell_data[i, 1]
        sprite.y = @battler_ani_oy + cell_data[i, 2]
        sprite.angle = cell_data[i, 4]
        sprite.mirror = (cell_data[i, 5] == 1)
      end
      sprite.z = @battler.is_moving? ? self.z + 60 : self.z + i
      sprite.ox = 96
      sprite.oy = 96
      sprite.zoom_x = cell_data[i, 3] / 100.0
      sprite.zoom_y = cell_data[i, 3] / 100.0
      sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
      sprite.blend_type = cell_data[i, 7]
      if @effect_type == :whiten
        sprite.color.set(255, 255, 255, 0)
        sprite.color.alpha = 128 - (16 - @effect_duration) * 10
      end
    end
  end
  #--------------------------------------------------------------------------
  # â— Plays sounds and flash effects
  #--------------------------------------------------------------------------
  def battler_animation_process_timing(timing)
    timing.se.play unless @battler_ani_duplicated
    case timing.flash_scope
    when 1
      self.flash(timing.flash_color, timing.flash_duration * @ani_rate)
    when 2
      if viewport && !@battler_ani_duplicated
        viewport.flash(timing.flash_color, timing.flash_duration * @ani_rate)
      end
    when 3
      self.flash(nil, timing.flash_duration * @ani_rate)
    end
  end
  #--------------------------------------------------------------------------
  # â— Determine which pose should be used right now
  #--------------------------------------------------------------------------
  def get_current_pose
    return unless @battler
    # Standing
    new_pose = @battler.animation_data(:stand)
    # Dead
    if @battler.dead?
      new_pose = @battler.animation_data(:dead)
    # Victory
    elsif @battler.is_a?(Game_Actor) && @battler.victory_pose
      new_pose = @battler.animation_data(:victory)
    # Moving toward target
    elsif @battler.is_moving? && @battler.movement_type == 0
      new_pose = @battler.animation_data(:move_f)
    # Moving back to initial position
    elsif @battler.is_moving? && @battler.movement_type == 1
      new_pose = @battler.animation_data(:move_B)
    # Skill
    elsif @battler.skill_pose_active
      new_pose = @battler.skill_battler_anim(@battler.current_action.item.id)
    # Item
    elsif @battler.item_pose_active
      new_pose = @battler.item_battler_anim(@battler.current_action.item.id)
    # Being hit
    elsif @battler.result.hp_damage > 0
      new_pose = @battler.animation_data(:hit)
    elsif @battler.hp_rate < 0.5
      new_pose = @battler.animation_data(:danger)
    end
    # Failsafe: use hit animation if no other one is found
    new_pose = @battler.animation_data(:hit) if new_pose.nil?
    # Failsafe: and in last resort, use standing anim
    new_pose = @battler.animation_data(:stand) if new_pose.nil?
    # Animation loops unless specified otherwise
    if @last_pose == new_pose
      @no_loop = !($data_animations[new_pose].name =~ /no[_|\s]loop/i).nil?
    end
    # Manage wait flag
    @banim_wait = !($data_animations[new_pose].name =~ /wait/i).nil?
    if @banim_wait
      fmax = $data_animations[new_pose].frame_max
      @banim_wait = false if @last_frame == fmax - 1
    end
    # Update animation
    if new_pose != @last_pose
      @last_pose = new_pose
      @battler_animation = nil
      @no_loop = false
    end
    new_pose
  end
  #--------------------------------------------------------------------------
  # â— Performs the collapse effect
  #--------------------------------------------------------------------------
  alias_method(:krx_aniB_sb_uc, :update_collapse)
  def update_collapse
    krx_aniB_sb_uc
    @battler_ani_sprites.each do |spr|
      spr.blend_type = 1
      spr.color.set(255, 128, 128, 128)
      spr.opacity = 256 - (48 - @effect_duration) * 6
    end
  end
  #--------------------------------------------------------------------------
  # â— Performs the boss collapse effect
  #--------------------------------------------------------------------------
  def update_boss_collapse
    @effect_duration = @battler_ani_duration
  end
end
 
# Ignore in YEA Battle Engine
unless $imported["YEA-BattleEngine"]
#==============================================================================
# â–  Window_BattleEnemy
#==============================================================================
 
class Window_BattleEnemy < Window_Selectable
  #--------------------------------------------------------------------------
  # â— Frame Update
  #--------------------------------------------------------------------------
  alias_method(:krx_aniB_wbe_update, :update)
  def update
    enemy.sprite_effect_type = :whiten if active
    krx_aniB_wbe_update
  end
end
  
end
 
# End of YEA Battle Engine check
 
#==============================================================================
# â–  Window_BattleActor
#==============================================================================
 
class Window_BattleActor < Window_BattleStatus
  #--------------------------------------------------------------------------
  # â— Frame Update
  #--------------------------------------------------------------------------
  alias_method(:krx_aniB_wba_update, :update)
  def update
    $game_party.battle_members[index].sprite_effect_type = :whiten if active
    krx_aniB_wba_update
  end
end
 
#==============================================================================
# â–  Scene_Battle
#==============================================================================
 
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # â— Execute the action previously selected
  #--------------------------------------------------------------------------
  alias_method(:krx_aniB_sb_ea, :execute_action)
  def execute_action
    move_to_target
    if @subject.current_action.item.is_a?(RPG::Skill)
      @subject.skill_pose_active = true
      wait_for_animation
    elsif @subject.current_action.item.is_a?(RPG::Item)
      @subject.item_pose_active = true
    end
    krx_aniB_sb_ea
    move_back_to_pos
  end
  #--------------------------------------------------------------------------
  # â— Moves the battler towards the target
  #--------------------------------------------------------------------------
  def move_to_target
    @subject.movement_type = 2
    return unless @subject.current_action.item.move_to_target
    target = @subject.current_action.make_targets.compact[0]
    ctx =  @subject.screen_x > target.screen_x ? 96 : -96
    @subject.x_destination = target.screen_x + ctx
    @subject.y_destination = target.screen_y
    @subject.movement_type = 0
    update_basic while @subject.is_moving?
  end
  #--------------------------------------------------------------------------
  # â— Moves the battler back to where they started
  #--------------------------------------------------------------------------
  def move_back_to_pos
    return unless @subject.movement_type == 0
    @subject.x_destination = @subject.screen_x
    @subject.y_destination = @subject.screen_y
    @subject.movement_type = 1
    update_basic while @subject.is_moving?
  end
  #--------------------------------------------------------------------------
  # â— Use a Banish skill
  #--------------------------------------------------------------------------
  if $imported['KRX-BanishSkills']
  def use_banish_skill(target, orig_item, skill_id)
    @log_window.display_use_item(@subject, orig_item)
    @subject.use_item(orig_item)
    @log_window.display_banish(orig_item, target)
    item = $data_skills[skill_id]
    @log_window.display_use_item(target, item)
    target.actions << Game_Action.new(self)
    target.current_action.set_skill(item.id)
    target.skill_pose_active = true
    wait_for_animation
    target.use_item(item)
    target.remove_banish_state
    refresh_status
    show_animation([@subject], item.animation_id)
    item.repeats.times do
      @subject.item_apply(target, item)
      refresh_status
      @log_window.display_action_results(@subject, item)
    end
    target.skill_pose_active = false
    target.actions.clear
  end; end
end

 

 

 

Here is what i am getting..

 

343q3k7.png

 

and here is the layout that I have. I think I'm doing something wrong with the tags or database..

 

359k4r8.png

Share this post


Link to post
Share on other sites
Your actor setup seems ok. Possibly your enemy setup is at fault here.

 

Really? lol. Just plugged in the enemy tags. That was the problem. Didn't know you had to plug in tags for the enemy -_-

 

Thanks for the help! :) Great Script!

Share this post


Link to post
Share on other sites

It's a script designed for full animation, not just the actors. I guess I could add some failsafe method to avoid crashing when you configure it wrong though. I'll work on it sooner or later.

Share this post


Link to post
Share on other sites
It's a script designed for full animation, not just the actors. I guess I could add some failsafe method to avoid crashing when you configure it wrong though. I'll work on it sooner or later.

 

Okay. I have one more quick question. I have the animations setup and good to go now, but.. the animation aren't jumping to the enemy at all. Am i missing something? I tested out Jet - Battle System and my actors were jumping to the enemy just fine. I do see a line where it says move to target, but its already on true and my actors just make movements standing still.

Share this post


Link to post
Share on other sites
You need to put <move_to_target> in the skill's notebox if you want the user to move at the target.

 

Man.. i feel so dumb. I feel like everything just went over my head. I thought you could put <move_to_target> possibly in actor and he would move.. silly me. Sorry to be of trouble. Now I have to get the animation frames correct. Everything is moving to fast. lol. I appreciate the help so much!  :D I realize you could be very harsh on me, since i'm asking easy answers. So i genuinely appreciate the straight forward help.

Share this post


Link to post
Share on other sites

Animation frames can be tricky to set. In the example video, I was using Ace Battle Engine (which raises the animation speed) and every animation frame was duplicated to avoid going too fast. But it also depends of what kind of battlers you are using and all.

 

There's only trial and error for this.

Share this post


Link to post
Share on other sites
I'm not sure I understand your question. There's already an animation for getting hit.

 

Ummm.. the "hit" animation is attacking the enemy and "danger" is when you have low hp. I'm not seeing a "get hit" animation. Unless I'm not looking for the right keyword.

Share this post


Link to post
Share on other sites
No, the "hit" animation is for when you get hit.

 

Ahhhhh I seee!!!!! lol. The skill_default is technically the "hit" and i noticed that earlier which is why i had the numbers switch to my character attack. I am so focused on this/my game. I need to focus on one thing at a time. But, so many ideas  :D

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×