[SOLVED] Skill window breaks in battle system

Started by TrueCynder, January 20, 2014, 07:08:29 pm

Previous topic - Next topic

TrueCynder

January 20, 2014, 07:08:29 pm Last Edit: January 20, 2014, 07:44:30 pm by TrueCynder
Okay so i edited more of the Asar tear battle system
and i changed the skills and items windows
The item window works just fine but the skill window makes the game crush
once the actor has an skill



Im using the Skill equip script so only when i activate a skill it will crush


What could i do ? :/

Spoiler: ShowHide
$antbs = true

module RyexCFG
 BATTLE_MENU_ICONS = []
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 # To change the icons in the actor command window change the names below
 BATTLE_MENU_ICONS[1] = "Attack" #Icon name for the Attack option on the battle menu
 BATTLE_MENU_ICONS[2] = "Skill" #Icon name for the Skill option on the battle menu
 BATTLE_MENU_ICONS[3] = "Defend"#Icon name for the Defend option on the battle menu
 BATTLE_MENU_ICONS[4] = "Item" #Icon name for the Item option on the battle menu

 # how many REAL frames that should be skipped before updating the battlers while
 # in idle mode, note that using anything below 2 is not recommended and that
 # using low values can increase lag dramatically

 B_SPEED = 8

 BATTLE_NAMES_FONT = '8bitoperator'
 BATTLE_HP_SP_FONT = '8bitoperator'

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
end
#==============================================================================
#  New methods added to Bitmap
#==============================================================================
class Bitmap
 def draw_bar_ryex(x, y, w, h, p, c)
   gray = Color.new(100, 100, 100)
   white = Color.new(255, 255, 255)
   fill_rect(x, y, w, h, Color.new(0, 0, 0))
   for i in 0...(h - 1)
     gr = gray.red * i / (h - 1)
     gg = gray.green * i / (h - 1)
     gb = gray.blue * i / (h - 1)
     fill_rect(x + 1, y + h - i - 1, w - 2, 1, Color.new(gr, gg, gb))
   end
   for i in 0...(h / 2)
     r = c.red * i / (h / 2)
     g = c.green * i / (h / 2)
     b = c.blue * i / (h / 2)
     fill_rect(x + 1, y + h - i - 1, p * (w - 2), 1, Color.new(r, g, b))
   end
   for i in 0...(h / 2 - 1)
     r = c.red + (white.red - c.red) * i / (h / 2 - 1)
     g = c.green + (white.green - c.green) * i / (h / 2 - 1)
     b = c.blue + (white.blue - c.blue) * i / (h / 2 - 1)
     fill_rect(x + 1, y + (h / 2 - 1) - i, p * (w - 2), 1, Color.new(r, g, b))
   end
 end
end

class Sprite
 #--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
alias moving_sprite_init initialize
def initialize(viewport = nil)
  moving_sprite_init(viewport)
  @dest_x, @dest_y = self.x, self.y
  @tot_x = @tot_y = 0
 end
 #--------------------------------------------------------------------------
 # * moving? - checks if the window needs moving
 #--------------------------------------------------------------------------
 def moving?
   return self.x != @dest_x || self.y != @dest_y
 end
 #--------------------------------------------------------------------------
 # * Move - prepares variables and sets off the moving process
 #--------------------------------------------------------------------------  
 def move(dest_x, dest_y)
   @dest_x = dest_x
   @dest_y = dest_y
   @tot_x = (dest_x - self.x).abs
   @tot_y = (dest_y - self.y).abs
 end
 #--------------------------------------------------------------------------
 # Move Windows - the actual processing of movement
 #--------------------------------------------------------------------------  
 def move_sprite
   x = self.x
   y = self.y
   dist_x = [((@dest_x-x).abs/3.0).ceil, (@tot_x/3.0).ceil].min
   dist_y = [((@dest_y-y).abs/3.0).ceil, (@tot_y/3.0).ceil].min
   @dest_x > x ? self.x += dist_x : self.x -= dist_x
   @dest_y > y ? self.y += dist_y : self.y -= dist_y
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 alias upd_sprite_move update
 def update
   move_sprite if moving?
   upd_sprite_move
 end
 #--------------------------------------------------------------------------
 # * Get Normal Text Color
 #--------------------------------------------------------------------------
 def normal_color
   return Color.new(255, 255, 255, 255)
 end
 #--------------------------------------------------------------------------
 # * Get Disabled Text Color
 #--------------------------------------------------------------------------
 def disabled_color
   return Color.new(255, 255, 255, 128)
 end
 #--------------------------------------------------------------------------
 # * Get System Text Color
 #--------------------------------------------------------------------------
 def system_color
   return Color.new(192, 224, 255, 255)
 end
 #--------------------------------------------------------------------------
 # * Get Crisis Text Color
 #--------------------------------------------------------------------------
 def crisis_color
   return Color.new(255, 255, 64, 255)
 end
 #--------------------------------------------------------------------------
 # * Get Knockout Text Color
 #--------------------------------------------------------------------------
 def knockout_color
   return Color.new(255, 64, 0)
 end
 def draw_actor_graphic(actor, x, y)
   bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
   cw = bitmap.width / 4
   ch = bitmap.height / 4
   src_rect = Rect.new(0, 0, cw, ch)
   self.bitmap.blt(x - cw / 2, y - ch, bitmap, src_rect)
 end
 #--------------------------------------------------------------------------
 # * Draw Name
 #     actor : actor
 #     x     : draw spot x-coordinate
 #     y     : draw spot y-coordinate
 #--------------------------------------------------------------------------
 def draw_actor_name(actor, x, y)
   self.bitmap.font.color = normal_color
   self.bitmap.draw_text(x, y, 120, 30, actor.name)
 end
 #--------------------------------------------------------------------------
 # * Make State Text String for Drawing
 #     actor       : actor
 #     width       : draw spot width
 #     need_normal : Whether or not [normal] is needed (true / false)
 #--------------------------------------------------------------------------
 def make_battler_state_text(battler, width, need_normal)
   # Get width of brackets
   brackets_width = self.bitmap.text_size("[]").width
   # Make text string for state names
   text = ""
   for i in battler.states
     if $data_states[i].rating >= 1
       if text == ""
         text = $data_states[i].name
       else
         new_text = text + "/" + $data_states[i].name
         text_width = self.bitmap.text_size(new_text).width
         if text_width > width - brackets_width
           break
         end
         text = new_text
       end
     end
   end
   # If text string for state names is empty, make it [normal]
   if text == ""
     if need_normal
       text = "[Normal]"
     end
   else
     # Attach brackets
     text = "[" + text + "]"
   end
   # Return completed text string
   return text
 end
 #--------------------------------------------------------------------------
 # * Draw State
 #     actor : actor
 #     x     : draw spot x-coordinate
 #     y     : draw spot y-coordinate
 #     width : draw spot width
 #--------------------------------------------------------------------------
 def draw_actor_state(actor, x, y, width = 120)
   text = make_battler_state_text(actor, width, true)
   self.bitmap.font.color = actor.hp == 0 ? knockout_color : normal_color
   self.bitmap.draw_text(x, y, width, 32, text)
 end
 #--------------------------------------------------------------------------
 # * Draw HP
 #     actor : actor
 #     x     : draw spot x-coordinate
 #     y     : draw spot y-coordinate
 #     width : draw spot width
 #--------------------------------------------------------------------------
 def draw_actor_hp(actor, x, y, width = 144)
   # Draw "HP" text string
   self.bitmap.font.color = system_color
   self.bitmap.draw_text(x, y, 32, 32, $data_system.words.hp)
   # Calculate if there is draw space for MaxHP
   if width - 32 >= 108
     hp_x = x + width - 108
     flag = true
   elsif width - 32 >= 48
     hp_x = x + width - 48
     flag = false
   end
   # Draw HP
   self.bitmap.font.color = actor.hp == 0 ? knockout_color :
     actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
   self.bitmap.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
   # Draw MaxHP
   if flag
     self.bitmap.font.color = normal_color
     self.bitmap.draw_text(hp_x + 48, y, 12, 32, "/", 1)
     self.bitmap.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
   end
 end
 #--------------------------------------------------------------------------
 # * Draw SP
 #     actor : actor
 #     x     : draw spot x-coordinate
 #     y     : draw spot y-coordinate
 #     width : draw spot width
 #--------------------------------------------------------------------------
 def draw_actor_sp(actor, x, y, width = 144)
   # Draw "SP" text string
   self.bitmap.font.color = system_color
   self.bitmap.draw_text(x, y, 32, 32, $data_system.words.sp)
   # Calculate if there is draw space for MaxHP
   if width - 32 >= 108
     sp_x = x + width - 108
     flag = true
   elsif width - 32 >= 48
     sp_x = x + width - 48
     flag = false
   end
   # Draw SP
   self.bitmap.font.color = actor.sp == 0 ? knockout_color :
     actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
   self.bitmap.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
   # Draw MaxSP
   if flag
     self.bitmap.font.color = normal_color
     self.bitmap.draw_text(sp_x + 48, y, 12, 32, "/", 1)
     self.bitmap.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
   end
 end
 #----------------------------------------------------------------------------
 # * Draws a gradiant bar fo the actor's HP
 #----------------------------------------------------------------------------
 def draw_actor_hp_bar_ryex(x, y, m, actor)
   h = 12
   p = actor.hp.to_f / actor.maxhp
   c = Color.new(200, 70, 70)
   self.bitmap.draw_bar_ryex(x, y, m, h, p, c)
 end
 #----------------------------------------------------------------------------
 # * Draws a gradiant bar fo the actor's SP
 #----------------------------------------------------------------------------
 def draw_actor_sp_bar_ryex(x, y, m, actor)
   h = 12
   p = actor.sp.to_f / actor.maxsp
   c = Color.new(70, 70, 200)
   self.bitmap.draw_bar_ryex(x, y, m, h, p, c)
 end
 #--------------------------------------------------------------------------
 # * Draw HP
 #     actor : actor
 #     x     : draw spot x-coordinate
 #     y     : draw spot y-coordinate
 #     width : draw spot width
 #--------------------------------------------------------------------------
 def draw_actor_hp_Ryex(actor, x, y, width = 144)
   # Draw "HP" text string
   self.bitmap.font.color = Color.new(0, 0, 0, 255)
   self.bitmap.draw_text(x-1, y-1, 32, 32, $data_system.words.hp)
   self.bitmap.draw_text(x+1, y-1, 32, 32, $data_system.words.hp)
   self.bitmap.draw_text(x-1, y+1, 32, 32, $data_system.words.hp)
   self.bitmap.draw_text(x+1, y+1, 32, 32, $data_system.words.hp)
   self.bitmap.font.color = system_color
   self.bitmap.draw_text(x, y, 32, 32, $data_system.words.hp)
   hp_x = x + width - 108
   # Draw HP
   self.bitmap.font.color = Color.new(0, 0, 0, 255)
   self.bitmap.draw_text(hp_x + 60 - 1, y - 1, 48, 32, actor.hp.to_s, 2)
   self.bitmap.draw_text(hp_x + 60 + 1, y - 1, 48, 32, actor.hp.to_s, 2)
   self.bitmap.draw_text(hp_x + 60 - 1, y + 1, 48, 32, actor.hp.to_s, 2)
   self.bitmap.draw_text(hp_x + 60 + 1, y + 1, 48, 32, actor.hp.to_s, 2)
   self.bitmap.font.color = actor.hp == 0 ? knockout_color :
     actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
   self.bitmap.draw_text(hp_x + 60, y, 48, 32, actor.hp.to_s, 2)
 end
 #--------------------------------------------------------------------------
 # * Draw SP
 #     actor : actor
 #     x     : draw spot x-coordinate
 #     y     : draw spot y-coordinate
 #     width : draw spot width
 #--------------------------------------------------------------------------
 def draw_actor_sp_Ryex(actor, x, y, width = 144)
   # Draw "SP" text string
   self.bitmap.font.color = Color.new(0, 0, 0, 255)
   self.bitmap.draw_text(x - 1, y - 1, 32, 32, $data_system.words.sp)
   self.bitmap.draw_text(x + 1, y - 1, 32, 32, $data_system.words.sp)
   self.bitmap.draw_text(x - 1, y + 1, 32, 32, $data_system.words.sp)
   self.bitmap.draw_text(x + 1, y + 1, 32, 32, $data_system.words.sp)
   self.bitmap.font.color = system_color
   self.bitmap.draw_text(x, y, 32, 32, $data_system.words.sp)
   sp_x = x + width - 108
   # Draw SP
   self.bitmap.font.color = Color.new(0, 0, 0, 255)
   self.bitmap.draw_text(sp_x + 60 - 1, y - 1, 48, 32, actor.sp.to_s, 2)
   self.bitmap.draw_text(sp_x + 60 + 1, y - 1, 48, 32, actor.sp.to_s, 2)
   self.bitmap.draw_text(sp_x + 60 - 1, y + 1, 48, 32, actor.sp.to_s, 2)
   self.bitmap.draw_text(sp_x + 60 + 1, y + 1, 48, 32, actor.sp.to_s, 2)
   self.bitmap.font.color = actor.sp == 0 ? knockout_color :
     actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
   self.bitmap.draw_text(sp_x + 60, y, 48, 32, actor.sp.to_s, 2)
 end
 #--------------------------------------------------------------------------
 # * Get Up Text Color
 #--------------------------------------------------------------------------
 def up_color
   return Color.new(0, 255, 0 )
 end
 #--------------------------------------------------------------------------
 # * Get Down Text Color
 #--------------------------------------------------------------------------
 def down_color
   return Color.new(255, 0, 0)
 end
end


#==============================================================================
# Moving windows (Alpha 2)
# by Fantasist
#------------------------------------------------------------------------------
#  This adds the 'move' function to windows. Syntax is
#    @window.move(dest_x, dest_y)
#  where
#       @window :The window you want to move
#       dest_x    :Destination x coordinate
#       dest_y    :Destination y coordinate
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
alias moving_win_base_init initialize
def initialize(x, y, w, h)
  moving_win_base_init(x, y, w, h)
  @dest_x, @dest_y = x, y
  @tot_x = @tot_y = 0
 end
 #--------------------------------------------------------------------------
 # * moving? - checks if the window needs moving
 #--------------------------------------------------------------------------
 def moving?
   return self.x != @dest_x || self.y != @dest_y
 end
 #--------------------------------------------------------------------------
 # * Move - prepares variables and sets off the moving process
 #--------------------------------------------------------------------------  
 def move(dest_x, dest_y)
   @dest_x = dest_x
   @dest_y = dest_y
   @tot_x = (dest_x - self.x).abs
   @tot_y = (dest_y - self.y).abs
 end
 #--------------------------------------------------------------------------
 # Move Windows - the actual processing of movement
 #--------------------------------------------------------------------------  
 def move_wins
   x = self.x
   y = self.y
   dist_x = [((@dest_x-x).abs/3.0).ceil, (@tot_x/3.0).ceil].min
   dist_y = [((@dest_y-y).abs/3.0).ceil, (@tot_y/3.0).ceil].min
   @dest_x > x ? self.x += dist_x : self.x -= dist_x
   @dest_y > y ? self.y += dist_y : self.y -= dist_y
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 alias upd_win_base_move update
 def update
   upd_win_base_move
   move_wins if moving?
 end
end

class Sprite_BattleStatus_Ryex_AnTeBS < RPG::Sprite
 attr_accessor :actor
 attr_accessor :level_up_flag
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize(x, y, actor_id, recreate_flag = false)
   super(nil)
   self.x = x
   self.y = y
   self.bitmap = Bitmap.new(150, 74)
   @level_up_flag = false
   @actor = $game_party.actors[actor_id]
   @box_number = actor_id
   refresh
 end
 #--------------------------------------------------------------------------
 # * Dispose
 #--------------------------------------------------------------------------
 def dispose
   super
 end
 #--------------------------------------------------------------------------
 # * Set Level Up Flag
 #     actor_index : actor index
 #--------------------------------------------------------------------------
 def level_up
   @level_up_flag = true
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   self.bitmap.clear
   self.bitmap.font.name, self.bitmap.font.size = RyexCFG::BATTLE_NAMES_FONT, 22
   self.bitmap.font.italic, self.bitmap.font.bold = true, true
   draw_actor_name(@actor, 15, 0)
   self.bitmap.font.italic, self.bitmap.font.bold = false, false
   self.bitmap.font.name, self.bitmap.font.size = RyexCFG::BATTLE_HP_SP_FONT, 20
   draw_actor_hp_bar_ryex(15, 24, 120, @actor)
   draw_actor_hp_Ryex(@actor, 15, 14, 120)
   draw_actor_sp_bar_ryex(15, 38, 120, @actor)
   draw_actor_sp_Ryex(@actor, 15, 28, 120)
   if @level_up_flag
     self.bitmap.font.color = normal_color
     self.bitmap.draw_text(15, 42, 120, 32, 'LEVEL UP!')
   else
     draw_actor_state(@actor, 15, 42)
   end
   self.bitmap.font.name, self.bitmap.font.size = '8bitoperator', 25
 end
 #--------------------------------------------------------------------------
 # * Draw Background
 #--------------------------------------------------------------------------
 def draw_background
   back_color = Color.new(75, 75, 75)
   74.times do |i|
     bcr = back_color.red * i / 74
     bcg = back_color.green * i / 74
     bcb = back_color.blue * i / 74
     self.bitmap.fill_rect(0, 74 - i - 1, 150, 1, Color.new(bcr, bcg, bcb, 200))
   end
   case @box_number
   when 0
     if $game_party.actors.size == 1
       self.bitmap.fill_rect(149, 0, 1, 74, Color.new(0, 0, 0, 200))
     end
     self.bitmap.fill_rect(0, 0, 1, 74, Color.new(0, 0, 0, 200))
   when ($game_party.actors.size - 1)
     self.bitmap.fill_rect(149, 0, 1, 74, Color.new(0, 0, 0, 200))
   end
   self.bitmap.fill_rect(0, 0, 150, 1, Color.new(0, 0, 0, 200))
   self.bitmap.fill_rect(0, 73, 150, 1, Color.new(0, 0, 0, 200))
 end
end

class Battle_Status_Bar_Ryex_AnTeBS
 attr_accessor :actor_status_boxs, :level_up_flags
 def initialize(x, y)
   @actor_status_boxs = []
   @level_up_flags = []
   @party_size = $game_party.actors.size
   (0...$game_party.actors.size).each do |i|
     @actor_status_boxs.push(Sprite_BattleStatus_Ryex_AnTeBS.new(x + (i * 150), y, i))
   end
   @actor_status_boxs.each do |status_box|
     status_box.z = 300
   end
   @actor_status_boxs.each_index do |i|
     @level_up_flags[i] = @actor_status_boxs[i].level_up_flag
   end
 end
 def level_up(actor_index)
   @actor_status_boxs[actor_index].level_up
   @level_up_flags[actor_index] = @actor_status_boxs[actor_index].level_up_flag
 end
 def dispose
   @actor_status_boxs.each do |status_box|
     status_box.dispose
   end
 end
 def refresh(actor_index = nil)
   if @party_size != $game_party.actors.size
     @actor_status_boxs.each do |status_box|
       status_box.dispose
     end
     @actor_status_boxs = []
     @party_size = $game_party.actors.size
     (0...$game_party.actors.size).each do |i|
       @actor_status_boxs.push(Sprite_BattleStatus_Ryex_AnTeBS.new(0 + (i * 150), 0, i, true))
     end
   else
     (0...$game_party.actors.size).each do |i|
       actor = $game_party.actors[i]
       @actor_status_boxs[i].actor = actor unless actor == nil
     end
     unless actor_index == nil
       @actor_status_boxs[actor_index].refresh
     else
       @actor_status_boxs.each do |status_box|
         status_box.refresh
       end
     end
   end
 end
 def update
   @actor_status_boxs.each_index do |i|
     @actor_status_boxs[i].level_up_flag = @level_up_flags[i]
   end
   @actor_status_boxs.each do |status_box|
     status_box.update
   end
 end
 def move(x, y)
   (0...$game_party.actors.size).each do |i|
     @actor_status_boxs[i].move(x + (i * 150), y)
   end
 end
 def x
   return @actor_status_boxs[0].x
 end
 def y
   return @actor_status_boxs[0].y
 end
end

#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
#  This window displays items in possession on the item and battle screens.
#==============================================================================

class Window_Item_Battle_Ryex < Window_Item
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   super
   self.x, self.y, self.width, self.height, self.z = -305, 96, 640, 192, 300
   @column_max = 2
   self.index = 0
   refresh
 end
 #--------------------------------------------------------------------------
 # * Draw Item
 #     index : item number
 #--------------------------------------------------------------------------
 def draw_item(index)
   item = @data[index]
   case item
   when RPG::Item
     number = $game_party.item_number(item.id)
   when RPG::Weapon
     number = $game_party.weapon_number(item.id)
   when RPG::Armor
     number = $game_party.armor_number(item.id)
   end
   if item.is_a?(RPG::Item) and
      $game_party.item_can_use?(item.id)
     self.contents.font.color = normal_color
   else
     self.contents.font.color = disabled_color
   end
   x = 4 + index % 2 * (288 + 32)
   y = index / 2 * 32
   rect = Rect.new(x, y, self.width / @column_max - 32, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   bitmap = RPG::Cache.icon(item.icon_name)
   opacity = self.contents.font.color == normal_color ? 255 : 128
   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
   self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
   self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
   self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
 end
end
#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
#  This window displays usable skills on the skill and battle screens.
#==============================================================================

class Window_Skill_Battle_Ryex < Window_Skill
 #--------------------------------------------------------------------------
 # * Object Initialization
 #     actor : actor
 #--------------------------------------------------------------------------
 def initialize(actor)
   super
   self.x, self.y, self.width, self.height, self.z = -305, 96, 640, 192, 300
   @actor = actor
   @column_max = 2
   self.index = 0
   refresh
 end
 #--------------------------------------------------------------------------
 # * Draw Item
 #     index : item number
 #--------------------------------------------------------------------------
 def draw_item(index)
   skill = @data[index]
   if @actor.skill_can_use?(skill.id)
     self.contents.font.color = normal_color
   else
     self.contents.font.color = disabled_color
   end
   x = 4 + index % 2 * (288 + 32)
   y = index / 2 * 32
   rect = Rect.new(x, y, self.width / @column_max - 32, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   bitmap = RPG::Cache.icon(item.icon_name)
   opacity = self.contents.font.color == normal_color ? 255 : 128
   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
   self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
   self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
   self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
 end
end
#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
#  This window shows skill and item explanations along with actor status.
#==============================================================================

class Window_Help_Battle_Ryex < Window_Help
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   super
 end
 #--------------------------------------------------------------------------
 # * Set Text
 #  text  : text string displayed in window
 #  align : alignment (0..flush left, 1..center, 2..flush right)
 #--------------------------------------------------------------------------
 def set_text(text, align = 0)
   super(text, align)
   self.move(self.x, 0)
 end
 #--------------------------------------------------------------------------
 # * Set Actor
 #     actor : status displaying actor
 #--------------------------------------------------------------------------
 def set_actor(actor)
   super(actor)
   self.move(self.x, 0)
 end
 #--------------------------------------------------------------------------
 # * Set Enemy
 #     enemy : name and status displaying enemy
 #--------------------------------------------------------------------------
 def set_enemy(enemy)
   text = enemy.name
   state_text = make_battler_state_text(enemy, 112, false)
   if state_text != ""
     text += "  " + state_text
   end
   set_text(text, 1)
 end
end

#==============================================================================
# ** Window_HCommand_WI Modified from Blizzard's Window_HCommand By Ryex
#------------------------------------------------------------------------------
#  This window deals with general command choices, but the display is
#  horizontal.
#==============================================================================

class Window_HCommand_WI_Battle < Window_Selectable
 #--------------------------------------------------------------------------
 # * Object Initialization
 #     width    : window width
 #     commands : command text string array
 #--------------------------------------------------------------------------
 def initialize(width, commands)
   super(0, 0, width, 64)
   self.width, self.height = width, 64
   @commands = commands
   @item_max = commands.size
   @column_max = commands.size
   self.contents = Bitmap.new( @item_max * 152, self.height - 32)
   refresh
   update_cursor_rect
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   for i in 0...@item_max
     draw_item(i, normal_color)
   end
 end
 #--------------------------------------------------------------------------
 # * Draw Item
 #     index : item number
 #     color : text color
 #--------------------------------------------------------------------------
 def draw_item(i, color)
   self.contents.font.color = color
   w = 152
   x = i * 152
   rect = Rect.new(x, 0, w, 32)
   #self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   self.contents.draw_text(rect, @commands[i][1], 1)
   self.contents.blt(x + 4, 4, RPG::Cache.icon(@commands[i][0]),
         Rect.new(0, 0, 24, 24))
 end
 #--------------------------------------------------------------------------
 # * Disable Item
 #     index : item number
 #--------------------------------------------------------------------------
 def disable_item(index)
   draw_item(index, disabled_color)
 end
 #--------------------------------------------------------------------------
 # * Update Cursor Rectangle
 #--------------------------------------------------------------------------
 def update_cursor_rect
   # If cursor position is less than 0
   if @index < 0
     self.cursor_rect.empty
     return
   end
   # Get current row
   row = @index
   # If current row is before top row
   if row < self.top_row
     # Scroll so that current row becomes top row
     self.top_row = row
   end
   # If current row is more to back than back row
   if row > self.top_row + (self.page_row_max - 1)
     # Scroll so that current row becomes back row
     self.top_row = row - (self.page_row_max - 1)
   end
   # Calculate cursor width
   cursor_width = 152
   # Calculate cursor coordinates
   x = @index * 152 - self.ox
   # Update cursor rectangle
   self.cursor_rect.set(x, 0, cursor_width, 32)
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   super
   # If cursor is movable
   if self.active and @item_max > 0 and @index >= 0
     # If the right directional button was pressed
     if Input.repeat?(Input::RIGHT)
       # If column count is 2 or more, and cursor position is closer to front
       # than (item count -1)
       if @column_max >= 2 and @index < @item_max - 1
         # Move cursor right
         $game_system.se_play($data_system.cursor_se)
         @index = (@index + @column_max) % @item_max
       end
     end
     # If the left directional button was pressed
     if Input.repeat?(Input::LEFT)
       # If column count is 2 or more, and cursor position is more back than 0
       if @column_max >= 2 and @index > 0
         # Move cursor left
         $game_system.se_play($data_system.cursor_se)
         @index = (@index - @column_max + @item_max) % @item_max
       end
     end
   end
   # Update help text (update_help is defined by the subclasses)
   if self.active and @help_window != nil
     update_help
   end
   # Update cursor rectangle
   update_cursor_rect
 end
 #--------------------------------------------------------------------------
 # * Update Help Window
 #--------------------------------------------------------------------------
 def update_help
   @help_window.set_text(@commands[self.index][1])
 end
end


class Spriteset_Battle
 def update
   if @viewport0 == nil
     @weather.dispose
     @viewport0 = Viewport.new(0, 0, 640, 480)
     @viewport0.z = @viewport1.z - 1
     @weather = RPG::Weather.new(@viewport2)
   end
   if @battleback_name != $game_temp.battleback_name
     @battleback_name = $game_temp.battleback_name
     @battleback_sprite.dispose
     @battleback_sprite = Sprite.new(@viewport0)
     @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
   end
   # Update actor sprite contents (corresponds with actor switching)
   @actor_sprites[0].battler = $game_party.actors[0]
   @actor_sprites[1].battler = $game_party.actors[1]
   @actor_sprites[2].battler = $game_party.actors[2]
   @actor_sprites[3].battler = $game_party.actors[3]
   # If battleback file name is different from current one
   if @battleback_name != $game_temp.battleback_name
     @battleback_name = $game_temp.battleback_name
     if @battleback_sprite.bitmap != nil
       @battleback_sprite.bitmap.dispose
     end
     @battleback_sprite = Sprite.new(@viewport0)
     @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
   end
   # Update battler sprites
   for sprite in @enemy_sprites + @actor_sprites
     sprite.update
   end
   # Update weather graphic
   @weather.type = $game_screen.weather_type
   @weather.max = $game_screen.weather_max
   @weather.update
   # Update picture sprites
   for sprite in @picture_sprites
     sprite.update
   end
   # Update timer sprite
   @timer_sprite.update
   # Set screen color tone and shake position
   @viewport2.tone = $game_screen.tone
   @viewport2.ox = $game_screen.shake
   @viewport0.ox = $game_screen.shake
   @viewport1.ox = $game_screen.shake
   # Set screen flash color
   @viewport4.color = $game_screen.flash_color
   # Update viewports
   @viewport1.update
   @viewport2.update
   @viewport4.update
   @viewport0.update
 end

 alias ryex_AnTBS_SpBattle_dispose_later dispose
 def dispose
   ryex_AnTBS_SpBattle_dispose_later
   @viewport0.dispose
 end
end

class Scene_Battle
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
   # Initialize each kind of temporary battle data
   $game_temp.in_battle = true
   $game_temp.battle_turn = 0
   $game_temp.battle_event_flags.clear
   $game_temp.battle_abort = false
   $game_temp.battle_main_phase = false
   $game_temp.battleback_name = $game_map.battleback_name
   $game_temp.forcing_battler = nil
   # Initialize battle event interpreter
   $game_system.battle_interpreter.setup(nil, 0)
   # Prepare troop
   @troop_id = $game_temp.battle_troop_id
   $game_troop.setup(@troop_id)
   # Make actor command window
   commands = [[RyexCFG::BATTLE_MENU_ICONS[1], $data_system.words.attack],
     [RyexCFG::BATTLE_MENU_ICONS[2], $data_system.words.skill],
     [RyexCFG::BATTLE_MENU_ICONS[3], $data_system.words.guard],
     [RyexCFG::BATTLE_MENU_ICONS[4], $data_system.words.item]]
   @actor_command_window = Window_HCommand_WI_Battle.new(640, commands)
   @actor_command_window.y = -64
   @actor_command_window.z = 300
   @actor_command_window.back_opacity = 160
   @actor_command_window.active = false
   # Make other windows
   @party_command_window = Window_PartyCommand.new
   @party_command_window.y, @party_command_window.z = 0, 300
   @party_command_window.visible = true
   @help_window = Window_Help_Battle_Ryex.new
   @help_window.y, @help_window.back_opacity, @help_window.z = -64, 160, 400
   @help_window.visible = true
   @status_window = Battle_Status_Bar_Ryex_AnTeBS.new(26, 480)
   @message_window = Window_Message.new
   # Make sprite set
   @spriteset = Spriteset_Battle.new
   # Initialize wait count
   @wait_count = 0
   # Execute transition
   if $data_system.battle_transition == ""
     Graphics.transition(20)
   else
     Graphics.transition(40, "Graphics/Transitions/" +
       $data_system.battle_transition)
   end
   # Start pre-battle phase
   start_phase1
   # Main loop
   loop do
     # Update game screen
     Graphics.update
     # Update input information
     Input.update
     # Frame update
     update
     # Abort loop if screen is changed
     if $scene != self
       break
     end
   end
   # Refresh map
   $game_map.refresh
   # Prepare for transition
   Graphics.freeze
   # Dispose of windows
   @actor_command_window.dispose
   @party_command_window.dispose
   @help_window.dispose
   @status_window.dispose
   @message_window.dispose
   if @skill_window != nil
     @skill_window.dispose
   end
   if @item_window != nil
     @item_window.dispose
   end
   if @result_window != nil
     @result_window.dispose
   end
   # Dispose of sprite set
   @spriteset.dispose
   # If switching to title screen
   if $scene.is_a?(Scene_Title)
     Graphics.transition
     Graphics.freeze
   else
     Graphics.transition(40, "Graphics/Transitions/Battle.png")
   end
   # If switching from battle test to any screen other than game over screen
   if $BTEST and not $scene.is_a?(Scene_Gameover)
     $scene = nil
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   # If battle event is running
   if $game_system.battle_interpreter.running?
     # Update interpreter
     $game_system.battle_interpreter.update
     # If a battler which is forcing actions doesn't exist
     if $game_temp.forcing_battler == nil
       # If battle event has finished running
       unless $game_system.battle_interpreter.running?
         # Rerun battle event set up if battle continues
         unless judge
           setup_battle_event
         end
       end
       # If not after battle phase
       if @phase != 5
         # Refresh status window
         @status_window.refresh
       end
     end
   end
   # Update system (timer) and screen
   $game_system.update
   $game_screen.update
   # If timer has reached 0
   if $game_system.timer_working and $game_system.timer == 0
     # Abort battle
     $game_temp.battle_abort = true
   end
   # Update windows
   @help_window.update
   @party_command_window.update
   @actor_command_window.update
   @status_window.update
   @message_window.update
   # Update sprite set
   @spriteset.update
   # If transition is processing
   if $game_temp.transition_processing
     # Clear transition processing flag
     $game_temp.transition_processing = false
     # Execute transition
     if $game_temp.transition_name == ""
       Graphics.transition(20)
     else
       Graphics.transition(40, "Graphics/Transitions/" +
         $game_temp.transition_name)
     end
   end
   # If message window is showing
   if $game_temp.message_window_showing
     return
   end
   # If effect is showing
   if @spriteset.effect?
     return
   end
   # If game over
   if $game_temp.gameover
     # Switch to game over screen
     $scene = Scene_Gameover.new
     return
   end
   # If returning to title screen
   if $game_temp.to_title
     # Switch to title screen
     $scene = Scene_Title.new
     return
   end
   # If battle is aborted
   if $game_temp.battle_abort
     # Return to BGM used before battle started
     $game_system.bgm_play($game_temp.map_bgm)
     # Battle ends
     battle_end(1)
     return
   end
   # If waiting
   if @wait_count > 0
     # Decrease wait count
     @wait_count -= 1
     return
   end
   # If battler forcing an action doesn't exist,
   # and battle event is running
   if $game_temp.forcing_battler == nil and
      $game_system.battle_interpreter.running?
     return
   end
   # Branch according to phase
   case @phase
   when 1  # pre-battle phase
     update_phase1
   when 2  # party command phase
     update_phase2
   when 3  # actor command phase
     update_phase3
   when 4  # main phase
     update_phase4
   when 5  # after battle phase
     update_phase5
   end
 end
 #--------------------------------------------------------------------------
 # * Start Party Command Phase
 #--------------------------------------------------------------------------
 def start_phase2
   # Shift to phase 2
   @phase = 2
   # Set actor to non-selecting
   @actor_index = -1
   @active_battler = nil
   # move windows into position
   @status_window.move(@status_window.x, 427)
   @party_command_window.move(@party_command_window.x, 0)
   # Enable party command window
   @party_command_window.active = true
   # Disable actor command window
   @actor_command_window.active = false
   @actor_command_window.move(@actor_command_window.x, -64)
   #@info_window.move(@info_window.x, 481)
   # Clear main phase flag
   $game_temp.battle_main_phase = false
   # Clear all party member actions
   $game_party.clear_actions
   # If impossible to input command
   unless $game_party.inputable?
     # Start main phase
     start_phase4
   end
 end
 #--------------------------------------------------------------------------
 # * Go to Command Input for Next Actor
 #--------------------------------------------------------------------------
 def phase3_next_actor
   # Loop
   begin
     # Actor blink effect OFF
     if @active_battler != nil
       @active_battler.blink = false
       @status_window.actor_status_boxs[@actor_index].blink_off
     end
     # If last actor
     if @actor_index == $game_party.actors.size-1
       # Start main phase
       start_phase4
       return
     end
     # Advance actor index
     @actor_index += 1
     @active_battler = $game_party.actors[@actor_index]
     @active_battler.blink = true
     @status_window.actor_status_boxs[@actor_index].blink_on
   # Once more if actor refuses command input
   end until @active_battler.inputable?
   # Set up actor command window
   phase3_setup_command_window
 end
 #--------------------------------------------------------------------------
 # * Go to Command Input of Previous Actor
 #--------------------------------------------------------------------------
 def phase3_prior_actor
   # Loop
   begin
     # Actor blink effect OFF
     if @active_battler != nil
       @active_battler.blink = false
       @status_window.actor_status_boxs[@actor_index].blink_off
     end
     # If first actor
     if @actor_index == 0
       # Start party command phase
       start_phase2
       return
     end
     # Return to actor index
     @actor_index -= 1
     @active_battler = $game_party.actors[@actor_index]
     @active_battler.blink = true
     @status_window.actor_status_boxs[@actor_index].blink_on
   # Once more if actor refuses command input
   end until @active_battler.inputable?
   # Set up actor command window
   phase3_setup_command_window
 end
 #--------------------------------------------------------------------------
 # * Actor Command Window Setup
 #--------------------------------------------------------------------------
 def phase3_setup_command_window
   # Disable party command window
   @party_command_window.active = false
   @party_command_window.move(@party_command_window.x, -64)
   # Enable actor command window
   @actor_command_window.active = true
   @actor_command_window.move(@actor_command_window.x, 0)
   #@info_window.move(@info_window.x, 416)
   # Set index to 0
   @actor_command_window.index = 0
 end
 #--------------------------------------------------------------------------
 # * Start Enemy Selection
 #--------------------------------------------------------------------------
 def start_enemy_select
   # Make enemy arrow
   @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport1)
   # Associate help window
   @enemy_arrow.help_window = @help_window
   # Disable actor command window
   @actor_command_window.active = false
   #@info_window.move(@info_window.x, 481)
   @actor_command_window.move(@actor_command_window.x, -64)
 end
 #--------------------------------------------------------------------------
 # * End Enemy Selection
 #--------------------------------------------------------------------------
 def end_enemy_select
   # Dispose of enemy arrow
   @enemy_arrow.dispose
   @enemy_arrow = nil
   # If command is [fight]
   if @actor_command_window.index == 0
     # Enable actor command window
     @actor_command_window.active = true
     #@info_window.move(@info_window.x, 416)
     @actor_command_window.move(@actor_command_window.x, 0)
     # Hide help window
     @help_window.move(@help_window.x, -64)
   end
 end
 #--------------------------------------------------------------------------
 # * Start Actor Selection
 #--------------------------------------------------------------------------
 def start_actor_select
   # Make actor arrow
   @actor_arrow = Arrow_Actor.new(@spriteset.viewport2)
   @actor_arrow.index = @actor_index
   # Associate help window
   @actor_arrow.help_window = @help_window
   # Disable actor command window
   @actor_command_window.active = false
   #@info_window.move(@info_window.x, 481)
   @actor_command_window.move(@actor_command_window.x,-64)
 end
 #--------------------------------------------------------------------------
 # * End Actor Selection
 #--------------------------------------------------------------------------
 def end_actor_select
   # Dispose of actor arrow
   @actor_arrow.dispose
   @actor_arrow = nil
 end
 #--------------------------------------------------------------------------
 # * Start Skill Selection
 #--------------------------------------------------------------------------
 def start_skill_select
   # Make skill window
   @skill_window = Window_Skill_Battle_Ryex.new(@active_battler)
   @skill_window.move(0, @skill_window.y)
   # Associate help window
   @skill_window.help_window = @help_window
   # Disable actor command window
   @actor_command_window.active = false
   #@info_window.move(@info_window.x, 481)
   @actor_command_window.move(@actor_command_window.x, -64)
 end
 #--------------------------------------------------------------------------
 # * End Skill Selection
 #--------------------------------------------------------------------------
 def end_skill_select
   # Dispose of skill window
   @skill_window.dispose
   @skill_window = nil
   # Hide help window
   @help_window.move(@help_window.x, -64)
   # Enable actor command window
   @actor_command_window.active = true
   #@info_window.move(@info_window.x, 416)
   @actor_command_window.move(@actor_command_window.x, 0)
 end
 #--------------------------------------------------------------------------
 # * Start Item Selection
 #--------------------------------------------------------------------------
 def start_item_select
   # Make item window
   @item_window = Window_Item_Battle_Ryex.new
   @item_window.move(0, @item_window.y)
   # Associate help window
   @item_window.help_window = @help_window
   # Disable actor command window
   @actor_command_window.active = false
   #@info_window.move(@info_window.x, 481)
   @actor_command_window.move(@actor_command_window.x, -64)
 end
 #--------------------------------------------------------------------------
 # * End Item Selection
 #--------------------------------------------------------------------------
 def end_item_select
   # Dispose of item window
   @item_window.dispose
   @item_window = nil
   # Hide help window
   @help_window.move(@help_window.x, -64)
   # Enable actor command window
   @actor_command_window.active = true
   #@info_window.move(@info_window.x, 416)
   @actor_command_window.move(@actor_command_window.x, 0)
 end
 #--------------------------------------------------------------------------
 # * Start Main Phase
 #--------------------------------------------------------------------------
 def start_phase4
   # Shift to phase 4
   @phase = 4
   # Turn count
   $game_temp.battle_turn += 1
   # Search all battle event pages
   for index in 0...$data_troops[@troop_id].pages.size
     # Get event page
     page = $data_troops[@troop_id].pages[index]
     # If this page span is [turn]
     if page.span == 1
       # Clear action completed flags
       $game_temp.battle_event_flags[index] = false
     end
   end
   # Set actor as unselectable
   @actor_index = -1
   @active_battler = nil
   # Enable party command window
   @party_command_window.active = false
   @party_command_window.move(@party_command_window.x, -64)
   # Disable actor command window
   @actor_command_window.active = false
   @actor_command_window.move(@actor_command_window.x,  -64)
   #@info_window.move(@info_window.x, 481)
   # Set main phase flag
   $game_temp.battle_main_phase = true
   # Make enemy action
   for enemy in $game_troop.enemies
     enemy.make_action
   end
   # Make action orders
   make_action_orders
   # Shift to step 1
   @phase4_step = 1
 end
 #--------------------------------------------------------------------------
 # * Frame Update (main phase step 1 : action preparation)
 #--------------------------------------------------------------------------
 def update_phase4_step1
   # Hide help window
   @help_window.move(@help_window.x, -64)
   # Determine win/loss
   if judge
     # If won, or if lost : end method
     return
   end
   # If an action forcing battler doesn't exist
   if $game_temp.forcing_battler == nil
     # Set up battle event
     setup_battle_event
     # If battle event is running
     if $game_system.battle_interpreter.running?
       return
     end
   end
   # If an action forcing battler exists
   if $game_temp.forcing_battler != nil
     # Add to head, or move
     @action_battlers.delete($game_temp.forcing_battler)
     @action_battlers.unshift($game_temp.forcing_battler)
   end
   # If no actionless battlers exist (all have performed an action)
   if @action_battlers.size == 0
     # Start party command phase
     start_phase2
     return
   end
   # Initialize animation ID and common event ID
   @animation1_id = 0
   @animation2_id = 0
   @common_event_id = 0
   # Shift from head of actionless battlers
   @active_battler = @action_battlers.shift
   # If already removed from battle
   if @active_battler.index == nil
     return
   end
   # Slip damage
   if @active_battler.hp > 0 and @active_battler.slip_damage?
     @active_battler.slip_damage_effect
     @active_battler.damage_pop = true
   end
   # Natural removal of states
   @active_battler.remove_states_auto
   # Refresh status window
   @status_window.refresh
   # Shift to step 2
   @phase4_step = 2
 end
 #--------------------------------------------------------------------------
 # * Frame Update (main phase step 5 : damage display)
 #--------------------------------------------------------------------------
 def update_phase4_step5
   # Hide help window
   @help_window.move(@help_window.x, -64)
   # Refresh status window
   @status_window.refresh
   # Display damage
   for target in @target_battlers
     if target.damage != nil
       target.damage_pop = true
     end
   end
   # Shift to step 6
   @phase4_step = 6
 end
end

#==============================================================================
# Game_Battler
#==============================================================================

class Game_Battler

 attr_accessor :frame
 attr_accessor :allow_state_change
 attr_accessor :allow_death_change
 attr_accessor :force_idle
 attr_accessor :reset_frame
 attr_accessor :action_state
 attr_accessor :max_frame_idle
 attr_accessor :max_frame_attack
 attr_accessor :max_frame_skill
 attr_accessor :max_frame_item
 attr_accessor :max_frame_defend
 attr_accessor :max_frame_death
 attr_accessor :origin_name
 attr_accessor :battler_name

end

#==============================================================================
# Sprite_Battler
#==============================================================================

class Sprite_Battler

 alias ryex_AnTBS_initialize_later initialize
 def initialize(viewport, battler = nil)
   ryex_AnTBS_initialize_later(viewport, battler)
   @is_dead = false
   @appeared = false
   @time2 = false
   @collapsed = false
 end


 alias upd_animated_battlers_AnTBS_later update
 def update
   if @battler != nil
     if @battler.origin_name != @battler.battler_name
       setup_battler_AnTBS
     end
     set_action_state
     if Graphics.frame_count % RyexCFG::B_SPEED == 0
       case @battler.action_state
       when 0 # Idle state
         if @battler.max_frame_idle > 0
           @battler.frame = (@battler.frame + 1) % @battler.max_frame_idle
         end
       when 1 # Attack state
         if @battler.max_frame_attack > 0
           @battler.frame = (@battler.frame + 1) % @battler.max_frame_attack
         end
       when 2 # Skill state
         if @battler.max_frame_skill > 0
           @battler.frame = (@battler.frame + 1) % @battler.max_frame_skill
         end
       when 3 # Item state
         if @battler.max_frame_item > 0
           @battler.frame = (@battler.frame + 1) % @battler.max_frame_item
         end
       when 4 # Defend state
         if @battler.max_frame_defend > 0
           @battler.frame = (@battler.frame + 1) % @battler.max_frame_defend
         end
       when 5 # Death state
         if @battler.max_frame_death > 0
           @battler.frame = (@battler.frame + 1) % @battler.max_frame_death
         end
       end
     end
     if @battler.reset_frame == true
       @battler.frame = 0
       @battler.reset_frame = false
     end
     if @frame != @battler.frame
       @frame = @battler.frame
       name = @battler.origin_name
       flag = false
       case @battler.action_state
       when 1 # Attack state
         name += '_atk' unless @battler.max_frame_attack == 0
         if @frame == @battler.max_frame_attack - 1
           @battler.force_idle = true
           flag = true
         end
       when 2 # Skill state
         name += '_skl' unless @battler.max_frame_skill == 0
         if @frame == @battler.max_frame_skill - 1
           @battler.force_idle = true
           flag = true
         end
       when 3 # Item state
         name += '_itm' unless @battler.max_frame_item == 0
         if @frame == @battler.max_frame_item - 1
           @battler.force_idle = true
           flag = true
         end
       when 4 # Defend state
         name += '_def' unless @battler.max_frame_defend == 0
         if @frame == @battler.max_frame_defend - 1
           flag = true
         end
       when 5 # Death state
         name += '_death' unless @battler.max_frame_death == 0
         if @frame == @battler.max_frame_death - 1
           flag = true
         end
       end
       name += @frame.to_s if @frame > 0
       self.bitmap = RPG::Cache.battler(name, @battler.battler_hue)
       @width = bitmap.width
       @height = bitmap.height
       self.ox = @width / 2
       self.oy = @height
       if flag == true
         @battler.reset_frame = true
         flag = false
       end
     end
   end
   upd_animated_battlers_AnTBS_later
   if @battler != nil
     if @battler.allow_death_change && @battler.dead? &&
       @collapsed && (@_collapse_duration == 0)
       @collapsed = false
       @battler.allow_death_change = false
       @battler.action_state = 5
       if @battler.max_frame_death > 0
         appear
       end
     end
   end
 end

 def collapse
   super
   @battler.allow_death_change = true
   @battler.allow_state_change = true
   @collapsed = true
   @is_dead = true
   set_action_state
 end

 def appear
   super
   @battler.allow_state_change = true
   if @is_dead
     if @time2
       @appeared = true
       @time2 = false
       set_action_state
       return
     end
     @time2 = true
     set_action_state
   end
 end

 def set_action_state
   flag = false
   if @is_dead
     flag = true
     if @appeared && (@_appear_duration == 0)
       flag = false
       @appeared = false
       @is_dead = false
     end
   end
   if @battler.force_idle
     unless @battler.dead? || @is_dead
       @battler.action_state = 0
       @battler.allow_state_change = false
       @battler.force_idle = false
       @battler.reset_frame = true
     end
   end
   unless @battler.allow_state_change
     if @battler.action_state == nil
       @battler.action_state = 0
     end
   else
     if @battler.dead?
       @battler.action_state = 5
       @is_dead = true
     else
       unless flag
         @battler.reset_frame = true        
         case @battler.current_action.kind
         when 0  # basic
           case @battler.current_action.basic
           when 0 # attack
             @battler.action_state = 1
           when 1 # guard
             @battler.action_state = 4
           when 2 # exscape
             @battler.action_state = 0
           when 3 # do nothing
             @battler.action_state = 0
           end
         when 1  # skill
           @battler.action_state = 2
         when 2  # item
           @battler.action_state = 3
         end
         @battler.allow_state_change = false
       end
     end
   end
   return
 end

 def setup_battler_AnTBS
   @battler.origin_name = @battler.battler_name
   @battler.frame = @frame = 0
   @battler.max_frame_idle = 0
   @battler.max_frame_attack = 0
   @battler.max_frame_skill = 0
   @battler.max_frame_item = 0
   @battler.max_frame_defend = 0
   @battler.max_frame_death = 0
   loop do
     name = @battler.origin_name
     name += @battler.max_frame_idle.to_s if @battler.max_frame_idle > 0
     if FileTest.exist?("Graphics/Battlers/#{name}.jpg") ||
        FileTest.exist?("Graphics/Battlers/#{name}.png")
        @battler.max_frame_idle += 1
     else
       break
     end
   end
   loop do
     name = @battler.origin_name + '_atk'
     name += @battler.max_frame_attack.to_s if @battler.max_frame_attack > 0
     if FileTest.exist?("Graphics/Battlers/#{name}.jpg") ||
        FileTest.exist?("Graphics/Battlers/#{name}.png")
       @battler.max_frame_attack += 1
     else
       break
     end
   end
   loop do
     name = @battler.origin_name + '_skl'
     name += @battler.max_frame_skill.to_s if @battler.max_frame_skill > 0
     if FileTest.exist?("Graphics/Battlers/#{name}.jpg") ||
        FileTest.exist?("Graphics/Battlers/#{name}.png")
       @battler.max_frame_skill += 1
     else
       break
     end
   end
   loop do
     name = @battler.origin_name + '_itm'
     name += @battler.max_frame_item.to_s if @battler.max_frame_item> 0
     if FileTest.exist?("Graphics/Battlers/#{name}.jpg") ||
        FileTest.exist?("Graphics/Battlers/#{name}.png")
       @battler.max_frame_item += 1
     else
       break
     end
   end
   loop do
     name = @battler.origin_name + '_def'
     name += @battler.max_frame_defend.to_s if @battler.max_frame_defend > 0
     if FileTest.exist?("Graphics/Battlers/#{name}.jpg") ||
        FileTest.exist?("Graphics/Battlers/#{name}.png")
       @battler.max_frame_defend += 1
     else
       break
     end
   end
   loop do
     name = @battler.origin_name + '_death'
     name += @battler.max_frame_death.to_s if @battler.max_frame_death > 0
     if FileTest.exist?("Graphics/Battlers/#{name}.jpg") ||
        FileTest.exist?("Graphics/Battlers/#{name}.png")
        @battler.max_frame_death += 1
     else
       break
     end
   end
   return
 end
end

class Scene_Battle

 alias ryex_AnTBS_SBattle_update_phase4_step3_later update_phase4_step3
 def update_phase4_step3
   @active_battler.allow_state_change = true
   ryex_AnTBS_SBattle_update_phase4_step3_later
 end

 alias ryex_AnTBS_SBattle_update_phase4_step6_later update_phase4_step6
 def update_phase4_step6
   ryex_AnTBS_SBattle_update_phase4_step6_later
 end

 alias ryex_AnTBS_SBattle_start_phase2_later start_phase2
 def start_phase2
   for actor in $game_party.actors
     actor.force_idle = true
   end
   
   ryex_AnTBS_SBattle_start_phase2_later
 end

end

AliveDrive

January 20, 2014, 07:17:28 pm #1 Last Edit: January 20, 2014, 11:38:02 pm by AliveDrive
EDIT:

:)
Quote from: Blizzard on September 09, 2011, 02:26:33 am
The permanent solution for your problem would be to stop hanging out with stupid people.

KK20


Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

TrueCynder

guys im sorry ... i DID put it into a code tag but apperntly i didnt work o0
i fixed it tho

KK20

You're using item when you should be using skill.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

TrueCynder

you know what ...
:shy:

i should realy put more thought into things before posting new topics on here
this was so silly of me

thanks for all your help KK20