Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Problem With Side-View Battlers (Details Within) (RESOLVED)

Ok, so I'm currently using these 3 scripts for my side-view battle system and I'm getting an error in which the enemy battler image cuts up. How do I correct this?


Image Glitch
http://i14.photobucket.com/albums/a338/The7thStone/shot.jpg[/img]

The battler itself is on a 4 frame, 11 pose sheet.

RTAB Configuration System by Cogwheel 
Code:
# RTAB Configuration System
# Support bulletin board http: //www2.ezbbs.net/21/minto-aaa/
#
# Updated for use with:
# Real time active battle (RTAB) Ver 1.12
# Distribution original support URL
# http://members.jcom.home.ne.jp/cogwheel/

=begin

REVISED:
This script brings up an options menu geared to handle the speed, action and
camera functions of Cogwheel's RTAB CBS.  

Originally designed and encorporated in a working main menu, you will note on 
line 368 of this script that the designer intended the menu to return to menu 
option #6 ( $scene = Scene_Menu.new(6) ).  

As $scene = Scene_Menu.new(5) would have returned to the menu, highlighting the
"End Game" option, the designer's menu obviously had more than the default num-
ber of options.

Obviously for anyone designing their own menu, this system is already set up
to be encorporated into your own menu.  But for those who want a system where
an event (such as a savepoint-like object) brings up the RTAB configuration
menu, you merely need to alter line #368 as such:  

                          $scene = Scene_Map.new

-------------------------------------------------------------------------------

To call this script, use:  

                      $scene = Scene_Customize.new

=end



#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles data surrounding the system. Backround music, etc.
#  is managed here as well. Refer to "$game_system" for the instance of 
#  this class.
#==============================================================================
class Game_System
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor   :battle_speed           # 戦闘速度
  attr_accessor   :battle_active          # アクティブ
  attr_accessor   :battle_camera          # カメラ稼動 
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias initialize_MINT_RTAB_Customize initialize
  def initialize
    # Call original initialization process
    initialize_MINT_RTAB_Customize
    @battle_speed = 150                 # Default:  RTAB speed
    @battle_active = 2                  # Default:  Wait during Item/Skill Select
    @battle_camera = false              # Default:  Camera turned off
  end
end

#==============================================================================
# ** Window_Customize
#==============================================================================
class Window_Customize < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(160, 92, 320, 288)    
    @column_max = 1
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    @element = []
    #Acquiring the skill which you have acquired
    get_data
    get_element
    # If the number of items is not 0, drawing item
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Acquire the menu option items
  #--------------------------------------------------------------------------
  def get_data
    data = [
    "Battle speed",
    "Active",
    "Camera work"]
    @data = data
  end
  #--------------------------------------------------------------------------
  # * Acquire the menu option settings
  #--------------------------------------------------------------------------
  def get_element
    case $game_system.battle_active
    when 1
      active = "Wait"
    when 2
      active = "Semi active"
    else
      active = "Full active"
    end
    if $game_system.battle_camera
      camera = "ON"
    else
      camera = "OFF"
    end    
    data = [$game_system.battle_speed.to_s, active, camera]
    @element = data
  end    
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    deta = @element[index]
    x = 0
    y = index * 32     
    self.contents.draw_text(x + 4, y, 140, 32, item, 0)
    self.contents.draw_text(x + 144, y, 140, 32, deta, 2)
  end
  #--------------------------------------------------------------------------
  # * Set Help Text
  #--------------------------------------------------------------------------
  def help_text(index)
    case index
    when 0
      text = "Modifies the combat speed. Lower numbers increases combat speed."
    when 1
      text = "Modifies the flow of time in battle"
    else
      text = "Sets whether the camera follows the moving battler."
    end
  end
  #--------------------------------------------------------------------------
  # * Update Help Text
  #--------------------------------------------------------------------------
  def update_help    
    text = help_text(self.index)
    @help_window.set_text(text)
  end
end


#==============================================================================
# ** Window_Command2
#------------------------------------------------------------------------------
#  This window deals with new command choices.
#==============================================================================
class Window_Command2 < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object initilization
  #--------------------------------------------------------------------------
  def initialize(width, commands)
    # Calculating the height of the window from the quantity of command
    super(0, 0, width, commands.size * 32 + 32)
    @item_max = commands.size
    @commands = commands
    self.contents = Bitmap.new(width - 32, @item_max * 32)
    refresh
    self.index = 0
  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(index, color)
    self.contents.font.color = color
    self.contents.font.size = 20 
    rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index])
  end
  #--------------------------------------------------------------------------
  # * Disable Item
  #     index : item number
  #--------------------------------------------------------------------------
  def disable_item(index)
    draw_item(index, disabled_color)
  end
  #--------------------------------------------------------------------------
  # * Set Help Text
  #--------------------------------------------------------------------------
  def help_text(index)
    case index
    when 0
      text = "Pauses when choosing a Skill, an Item or an Enemy. (Beginners)"
    when 1
      text = "Pauses when the Skill or Item windows are active. (Recommended)"      
    else
      text = "Action never pauses.  (Expert-mode)"
    end
  end
  #--------------------------------------------------------------------------
  # * Update Help Text
  #--------------------------------------------------------------------------
  def update_help    
    text = help_text(self.index)
    @help_window.set_text(text)
  end
end

#==============================================================================
# ** Window_Help2
#------------------------------------------------------------------------------
#  This window shows explanations for new options.
#==============================================================================
class Window_Help2 < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 420, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.pause = false
  end
  #--------------------------------------------------------------------------
  # * Set Text
  #  text  : text string displayed in window
  #  align : alignment (0..flush left, 1..center, 2..flush right)
  #--------------------------------------------------------------------------
  def set_text(text, align = 1)   
    # If at least one part of text and alignment differ from last time
    if text != @text or align != @align
      # Redraw text
      self.contents.clear
      self.contents.font.color = normal_color
      self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
      @text = text
      @align = align
      @actor = nil
    end
    self.visible = true
  end
end

#==============================================================================
# ** Scene_Customize
#------------------------------------------------------------------------------
#  This class performs RTAB Player Options decisions
#==============================================================================

class Scene_Customize  
  #--------------------------------------------------------------------------
  # * Main processing
  #--------------------------------------------------------------------------
  def main
    # Make help window, main window
    @help_window = Window_Help2.new      
    @main_window = Window_Customize.new
    @main_window.refresh
    @dummy_window = Window_Base.new(480,92,100,64)
    @dummy_window.visible = false
    @number_window = Window_InputNumber.new(3)
    @number_window.x = 480
    @number_window.y = 92
    @number_window.visible = false
    @number_window.active = false
    command = ["Wait", "Semi-Active", "Fully-Active"]
    camera_command = ["On", "Off"]
    @command_window = Window_Command2.new(120, command)
    @command_window.x = 480
    @command_window.y = 136
    @command_window.visible = false
    @command_window.active = false    
    @camera_window = Window_Command.new(120, camera_command)
    @camera_window.x = 480
    @camera_window.y = 172
    @camera_window.visible = false
    @camera_window.active = false
    # Associate help window
    @main_window.help_window = @help_window
    @command_window.help_window = @help_window
    # Execute transition
    Graphics.transition
    # 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
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @help_window.dispose
    @main_window.dispose
    @number_window.dispose
    @dummy_window.dispose
    @command_window.dispose
    @camera_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # If main window is active: call update_main
    if @main_window.active
      @main_window.update
      update_main
      return
    end
    if @number_window.active
      @number_window.update
      update_number
      return
    end
    if @command_window.active
      @command_window.update
      update_command
      return
    end
    if @camera_window.active
      @camera_window.update
      update_camera
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Main Update (when main window is active)
  #--------------------------------------------------------------------------  
  def update_main
    # If B Button is pressed
    if Input.trigger?(Input::B)
      # Play Cancel SE
      $game_system.se_play($data_system.cancel_se)
      
      # Return to Menu (THIS is where you return from an options menu)
      #$scene = Scene_Menu.new(6)
      $scene = Scene_Map.new
      
      return
    end
    # If C Button was pressed
    if Input.trigger?(Input::C)
      # Branch by main command decision
      @index = @main_window.index
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      case @index
      when 0
        @number_window.active = true
        @number_window.visible = true
        @dummy_window.visible = true
        @main_window.active = false
      when 1
        @command_window.active = true
        @command_window.visible = true
        @main_window.active = false
      when 2
        @camera_window.active = true
        @camera_window.visible = true
        @main_window.active = false  
      when 3
        @camera_window.active = true
        @camera_window.visible = true
        @main_window.active = false 
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Number Update (when number window is active)
  #--------------------------------------------------------------------------
  def update_number
    # If B Button was pressed
    if Input.trigger?(Input::B)
      # Play Cancel SE
      $game_system.se_play($data_system.cancel_se)
      @number_window.active = false
      @number_window.visible = false
      @dummy_window.visible = false
      @main_window.active = true
      return
    end
    # If C Button was Pressed
    if Input.trigger?(Input::C)
      # Obtain Current RTAB Battle Speed
      $game_system.battle_speed = @number_window.number
      $game_system.battle_speed = 1 if @number_window.number == 0
      # Play Decision SE
      $game_system.se_play($data_system.decision_se)
      @number_window.active = false
      @number_window.visible = false
      @dummy_window.visible = false
      @main_window.active = true
      @main_window.refresh
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Command Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    # If B Button was pressed
    if Input.trigger?(Input::B)
      # Play Cancel SE
      $game_system.se_play($data_system.cancel_se)
      @command_window.active = false
      @command_window.visible = false
      @main_window.active = true
      return
    end
    # If C Button was pressed
    if Input.trigger?(Input::C)
      # Branch by "Active" window cursor position
      case @command_window.index
      when 0
        $game_system.battle_active = 1
      when 1
        $game_system.battle_active = 2
      when 2
        $game_system.battle_active = 3
      end      
      # Play Decision SE
      $game_system.se_play($data_system.decision_se)
      @command_window.active = false
      @command_window.visible = false
      @main_window.active = true
      @main_window.refresh
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Camera Update (when camera window is active)
  #--------------------------------------------------------------------------
  def update_camera
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play Cancel SE
      $game_system.se_play($data_system.cancel_se)
      @camera_window.active = false
      @camera_window.visible = false
      @main_window.active = true
      return
    end
    # If C Button was pressed
    if Input.trigger?(Input::C)
      # Branch by camera window cursor position
      case @camera_window.index
      when 0
        $game_system.battle_camera = true
      when 1
        $game_system.battle_camera = false
      end      
      # Play Decision SE
      $game_system.se_play($data_system.decision_se)
      @camera_window.active = false
      @camera_window.visible = false
      @main_window.active = true
      @main_window.refresh
      return
    end
  end
end

#==============================================================================
# Real time active battle (RTAB) Ver 1.12
#==============================================================================
# ** Scene_Battle
#==============================================================================

class Scene_Battle  
  #--------------------------------------------------------------------------
  # * ATB fundamental setup
  #--------------------------------------------------------------------------
  def atb_setup
    # ATB initialization
    #
    # speed   : Battle speed decision. The lower the value, the faster the system
    #
    # @active : Degree of active setting
    #           3 : Always active state
    #           2 : ATB pauses when selecting skill/item
    #           1 : Same as 2, but pauses during target selection
    #           0 : Same as 1, but pauses during command window selection.
    #
    # @action : Others while acting is the fact that by their causes conduct permitted?
    #           3 : If by his is not incapacitation, limited to you permit
    #           2 : If by his has not received the damage, you permit
    #           1 : In addition to the state of 2, if the target has not acted, you permit
    #           0 : Conduct is not permitted. Until it finishes to act in order, it waits
    #
    # @anime_wait : When it makes true, during battle animation damage indicating wait catches
    # @damage_wait : Damage indicatory waiting (as for unit frame)
    #
    # @after_wait : At the time of ally enemy total loss,  until moves to next processing, waiting
    #               [a, b]  a) At the time of party total loss,  b) At time of enemy total loss (unit frame)
    #
    # @enemy_speed : Thought speed of enemy. If 1 immediately conduct.
    #                In every frame, conduct is caused with the probability of 1/@enemy_speed
    #
    # @force : With forced action forced condition at time of skill use
    #          2: As for skill everything not to reside permanently, by all means immediately execution
    #          1: As for independent skill to reside permanently, only cooperation skill immediately execution
    #          0: All the skill permanent residence just are done
    #
    # ($scene.force = Usually by making x, from the script of the event modification possibility)
    #
    # CAMERA DRIVE SYSTEM:  This system moves the Camera POV to the currently moving battler
    # @drive       : Camera drive system ON/OFF.  When true, drive ON, when false drive OFF
    # @scroll_time : Time it takes to scroll/move the camera POV during battle
    #
    # @zoom_rate = [i, j] : Zoom Rate (Changes the size of the enemy based on perspective)
    #                       i) When arranging in the picture first section, enlargement ratio
    #                       j) When arranging in the picture lowest section, enlargement ratio
    #                       1  When liking to make time, 1.0 be sure to set with decimal

    speed = $game_system.battle_speed     # IN FRAMES / FOR ATB SYSTEM
    @active = $game_system.battle_active  # Active Setting (Range of 0 - 3)
    @action = 2                           # Action Setting (Range of 0 - 3)
    @anime_wait = false                   #
    @damage_wait = 10                     #
    @after_wait = [80, 0]                 #
    @enemy_speed = 40                     #
    @force = 0                            #
    @drive = $game_system.battle_camera   # Turns camera system on/off
    @scroll_time = 15                     # Speed of camera system
    @zoom_rate = [1.0, 1.0]               # Change size of battler based on perspective
    @help_time = 40
    @escape == false
    @camera = nil
    @max = 0
    @turn_cnt = 0
    @help_wait = 0
    @action_battlers = []
    @synthe = []
    @spell_p = {}
    @spell_e = {}
    @command_a = false
    @command = []
    @party = false

    for battler in $game_party.actors + $game_troop.enemies
      spell_reset(battler)
      battler.at = battler.agi * rand(speed / 2)
      battler.damage_pop = {}
      battler.damage = {}
      battler.damage_sp = {}
      battler.critical = {}
      battler.recover_hp = {}
      battler.recover_sp = {}
      battler.state_p = {}
      battler.state_m = {}
      battler.animation = []
      if battler.is_a?(Game_Actor)
        @max += battler.agi
      end
    end

    @max *= speed
    @max /= $game_party.actors.size

    for battler in $game_party.actors + $game_troop.enemies
      battler.atp = 100 * battler.at / @max
    end
  end
end 


Animated Battlers Enhanced by Minkoff/DerVVolfman 
Code:
#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
#  Animated Battlers by Minkoff
#  Enhancement v 1.2 by DerVVulfman                                (07-18-2006)
#==============================================================================
#
#   Now, an additional call can be made before combat begins:
#       Script:  $game_system.sideview_mirror = 1
#   Reverses the position and direction of the battlers on-screen.
#
#       Script:  $game_system.sideview_mirror = 0
#   Returns it to the normal style (enemies on left / heroes on right).


class Sprite_Battler < RPG::Sprite
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  alias cbs_initialize initialize
  def initialize(viewport, battler = nil)

    # * Configuration System *
    
    # Animation Frames and Animation Speed
    @speed              = 7      # Framerate speed of the battlers
    @frames             = 4      # Number of frames in each pose
    @poses              = 10     # Number of poses (stances) in the template

    # Poses Control (Some people wanted to change their template design)
    $p1   =   0   # Sets the 'Ready Pose'  ($p1) to be pose #1 in your template
    $p2   =   1   # Sets the 'Struck Pose' ($p2) to be pose #2 in your template
    $p3   =   2   # Sets the 'Woozy Pose'  ($p3) to be pose #3 in your template
    $p4   =   3   # Sets the 'Block Pose'  ($p4) to be pose #4 in your template
    $p5   =   4   # Sets the 'Charge Pose' ($p5) to be pose #5 in your template
    $p6   =   5   # Sets the 'Retreat Pose'($p6) to be pose #6 in your template
    $p7   =   6   # Sets the 'Attack Pose' ($p7) to be pose #7 in your template
    $p8   =   7   # Sets the 'Item Pose'   ($p8) to be pose #8 in your template
    $p9   =   8   # Sets the 'Skill Pose'  ($p9) to be pose #9 in your template
    $p10  =   9   # Sets the 'Victory Pose'($p10)to be pose #10 in your template
    $p11  =  10   # Sets the 'Defeat Pose' ($p11)to be pose #11 in your template
    
    # Individual Battler Settings
    @mirror_enemies     = true   # Enemy battlers use reversed image
    @stationary_enemies = false  # If the enemies don't move while attacking
    @stationary_actors  = false  # If the actors don't move while attacking
    @calculate_speed    = false  # System calculates a mean/average speed
    @phasing            = true   # Characters fade in/out while attacking
    @default_collapse   = true  # If true, restores the old 'red fade' effect.
    
    # Action Settings
    $rush_offset        = 40     # How much overlap between attackers
    $rush_skill         = false   # If true, battler steps forward to use skill
    $rush_item          = true   # If true, battler steps forward to use item
    
    # Array that holds the id # of skills, items or weapons that affect movement
    @stationary_weapons = [17,18,19,20,21,22,23,24] # (examples are bows & guns)
    $moving_item_atk    = [] # Examples poisoned... um... dunno... (didn't add)
    $moving_skill_atk   = [57] # Examples are martial-art attacks & sneak attack
    
    # DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING
    @frame, @pose = 0, 0
    @last_time = 0
    @last_move_time = 0
    cbs_initialize(viewport, battler)
    viewport.z = 99
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  alias cbs_update update
  def update
    return unless @battler

    # Regular Update
    cbs_update

    # Start Routine
    unless @started
      @pose = state
      @width = @width / @frames
      @height = @height / @poses
      @display_x = @battler.screen_x
      @display_y = @battler.screen_y
      @destination_x = @display_x
      @destination_y = @display_y
      self.opacity = 0
      @started = true
    end
    
    # Cut Out Frame
    self.src_rect.set(@width * @frame, @height * @pose, @width, @height)

    # Position Sprite
    self.x = @display_x
    self.y = @display_y
    self.z = @display_y
    self.ox = @width / 2
    self.oy = @height
    
    # Adjust sprite direction if facing the other way...
    if $game_system.sideview_mirror == 1
      if @battler.is_a?(Game_Actor)
        self.mirror = !!battler
      else
        if not @mirror_enemies
          self.mirror = !!battler
        end
      end
    else
      if @battler.is_a?(Game_Enemy)
        if @mirror_enemies
          self.mirror = !!battler
        end
      end
    end
    
    # Setup Animation
    time = Graphics.frame_count / (Graphics.frame_rate / @speed)
    if @last_time < time
      @frame = (@frame + 1) % @frames
      if @frame == 0
        if @freeze
          @frame = @frames - 1
          return
        end
        @pose = state
      end
    end
    @last_time = time

    # Move It
    move if moving
  end
  #--------------------------------------------------------------------------
  # * Current State
  #--------------------------------------------------------------------------
  def state
    # Damage State
    if [nil,{}].include?(@battler.damage)
      # Battler Fine
      @state = $p1
      # Battler Wounded
      @state = $p3 if @battler.hp < @battler.maxhp / 4
      # Battler Dead
      if @default_collapse
        # (Red-Out Collapse)
        if @battler.dead? and @battler.is_a?(Game_Actor)
          @state = $p3
          # Fix Opacity
          self.opacity = 50
        end
      else
        # (Pose-Type Collapse)
        if @battler.dead?
          @state = $p3
          # Fix Opacity
          self.opacity = 50
        end
      end
    end
    # Guarding State
    @state = $p4 if @battler.guarding?
    # Moving State
    if moving
    # Adjust sprite direction if facing the other way...
      if $game_system.sideview_mirror == 1
        # If enemy battler moving
        if @battler.is_a?(Game_Enemy) 
          # Battler Moving Left
          @state = $p5 if moving.eql?(0)
          # Battler Moving Right
          @state = $p6 if moving.eql?(1)
        # Else actor battler moving
        else
          # Battler Moving Left
          @state = $p6 if moving.eql?(0)
          # Battler Moving Right
          @state = $p5 if moving.eql?(1)
        end
              
      else      
        # If enemy battler moving
        if @battler.is_a?(Game_Enemy) 
          # Battler Moving Left
          @state = $p6 if moving.eql?(0)
          # Battler Moving Right
          @state = $p5 if moving.eql?(1)
        # Else actor battler moving
        else
          # Battler Moving Left
          @state = $p5 if moving.eql?(0)
          # Battler Moving Right
          @state = $p6 if moving.eql?(1)
        end
      end
      
    end
    # Return State
    return @state
  end
  #--------------------------------------------------------------------------
  # * Move
  #--------------------------------------------------------------------------
  def move
    time = Graphics.frame_count / (Graphics.frame_rate.to_f / (@speed * 5))
    if @last_move_time < time

      # Pause for Animation
      return if @pose != state

      # Phasing
      if @phasing
        d1 = (@display_x - @original_x).abs
        d2 = (@display_y - @original_y).abs
        d3 = (@display_x - @destination_x).abs
        d4 = (@display_y - @destination_y).abs
        self.opacity = [255 - ([d1 + d2, d3 + d4].min * 1.75).to_i, 0].max
      end

      # Calculate Difference
      difference_x = (@display_x - @destination_x).abs
      difference_y = (@display_y - @destination_y).abs

      # Done? Reset, Stop
      if [difference_x, difference_y].max.between?(0, 8)
        @display_x = @destination_x
        @display_y = @destination_y
        @pose = state
        return
      end

      # Calculate Movement Increments
      increment_x = increment_y = 1
      if difference_x < difference_y
        increment_x = 1.0 / (difference_y.to_f / difference_x)
      elsif difference_y < difference_x
        increment_y = 1.0 / (difference_x.to_f / difference_y)
      end
      
      # Calculate Movement Speed
      if @calculate_speed
        total = 0; $game_party.actors.each{ |actor| total += actor.agi }
        speed = @battler.agi.to_f / (total / $game_party.actors.size)
        increment_x *= speed
        increment_y *= speed
      end
      
      # Multiply and Move
      multiplier_x = (@destination_x - @display_x > 0 ? 8 : -8)
      multiplier_y = (@destination_y - @display_y > 0 ? 8 : -8)
      @display_x += (increment_x * multiplier_x).to_i
      @display_y += (increment_y * multiplier_y).to_i
    end
    @last_move_time = time
    
   
  end
  #--------------------------------------------------------------------------
  # * Set Movement
  #--------------------------------------------------------------------------
  def setmove(destination_x, destination_y)
    unless (@battler.is_a?(Game_Enemy) and @stationary_enemies) or
           (@battler.is_a?(Game_Actor) and @stationary_actors)
      unless @stationary_weapons.include?(@battler.weapon_id)
        @original_x = @display_x
        @original_y = @display_y
        @destination_x = destination_x
        @destination_y = destination_y
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Movement Check
  #--------------------------------------------------------------------------
  def moving
    if (@display_x != @destination_x and @display_y != @destination_y and !@battler.dead?)
      return (@display_x > @destination_x ? 0 : 1)
    end
  end
  #--------------------------------------------------------------------------
  # * Set Pose
  #--------------------------------------------------------------------------
  def pose=(pose)
    @pose = pose
    @frame = 0
  end
  #--------------------------------------------------------------------------
  # * Freeze
  #--------------------------------------------------------------------------
  def freeze
    @freeze = true
  end
  #--------------------------------------------------------------------------
  # * Fallen Pose
  #--------------------------------------------------------------------------
  alias cbs_collapse collapse
  def collapse
    if @default_collapse
      cbs_collapse if @battler.is_a?(Game_Enemy)
      end
    end
  end

#==============================================================================
# ** Game_System
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor   :sideview_mirror
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias initialize_cbs_customize initialize
  def initialize
    # Call original initialization process
    initialize_cbs_customize
    @sideview_mirror = 0
  end
end  
  

#==============================================================================
# ** Game_Actor
#==============================================================================

class Game_Actor
  #--------------------------------------------------------------------------
  # * Actor X Coordinate
  #--------------------------------------------------------------------------
  def screen_x
    if self.index != nil
      if $game_system.sideview_mirror == 1
        return self.index * -45 + 202        
      else
        return self.index * 45 + 450
      end
    else
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # * Actor Y Coordinate
  #--------------------------------------------------------------------------
  def screen_y
    return self.index * 35 + 200
  end
  #--------------------------------------------------------------------------
  # * Actor Z Coordinate
  #--------------------------------------------------------------------------
  def screen_z
    return screen_y
  end
end


#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
#  This class handles enemies. It's used within the Game_Troop class
#  ($game_troop).
#==============================================================================

class Game_Enemy < Game_Battler
  def screen_x
    if self.index != nil
      if $game_system.sideview_mirror == 1
        return 640 - $data_troops[@troop_id].members[@member_index].x
      else
        return $data_troops[@troop_id].members[@member_index].x
      end
    end
  end
end  
  

#==============================================================================
# ** Scene_Battle
#==============================================================================

class Scene_Battle
  
  #--------------------------------------------------------------------------
  # * Make Skill Action Results (alias used to determine skill used)
  #--------------------------------------------------------------------------
  alias make_skill_action_result_anim make_skill_action_result
  def make_skill_action_result(battler = @active_battler)
    @rtab = !@target_battlers
    @rtab ? make_skill_action_result_anim(battler) : make_skill_action_result_anim
    @skill_used = @skill.id
  end
  
  #--------------------------------------------------------------------------
  # * Make Item Action Results (alias used to determine item used)
  #--------------------------------------------------------------------------
  alias make_item_action_result_anim make_item_action_result
  def make_item_action_result(battler = @active_battler)
    @rtab = !@target_battlers
    @rtab ? make_item_action_result_anim(battler) : make_item_action_result_anim
    @item_used = @item.id
    @item_usage = @item.scope
  end

  #--------------------------------------------------------------------------
  # * Action Animation, Movement
  #--------------------------------------------------------------------------
  alias cbs_update_phase4_step3 update_phase4_step3
  def update_phase4_step3(battler = @active_battler)
    @rtab = !@target_battlers
    target = (@rtab ? battler.target : @target_battlers)[0]
    @moved = {} unless @moved
    return if @spriteset.battler(battler).moving
    case battler.current_action.kind
    
    when 0 # Attack
      
      # Get 1 battle points for using an attack
      $game_variables[1] += 1      
      if not (@moved[battler] or battler.guarding?)
        if $game_system.sideview_mirror == 1
          offset = (battler.is_a?(Game_Actor) ? -($rush_offset) : $rush_offset)
        else
          offset = (battler.is_a?(Game_Actor) ? $rush_offset : -($rush_offset))
        end
        @spriteset.battler(battler).setmove(target.screen_x + offset, target.screen_y)
        @moved[battler] = true
        return
      elsif not battler.guarding?
        @spriteset.battler(battler).pose = $p7
        @spriteset.battler(battler).setmove(battler.screen_x, battler.screen_y)
      end
      
    when 1 # Skill
      
      # Get 2 battle points for using a skill
      $game_variables[1] += 1
      unless $moving_skill_atk.include?(@skill_used)
        if $rush_skill
          if not (@moved[battler] or battler.guarding?)
            if $game_system.sideview_mirror == 1
              offset = (battler.is_a?(Game_Actor) ? -($rush_offset) : $rush_offset)
            else
              offset = (battler.is_a?(Game_Actor) ? $rush_offset : -($rush_offset))
            end
            @spriteset.battler(battler).setmove(battler.screen_x - offset, battler.screen_y + 1)
            @moved[battler] = true
            return
          elsif not battler.guarding?
            @spriteset.battler(battler).pose = $p9
            @spriteset.battler(battler).setmove(battler.screen_x, battler.screen_y)
          end
        else
          @spriteset.battler(battler).pose = $p9
        end  
      else
        if not (@moved[battler] or battler.guarding?)
          if $game_system.sideview_mirror == 1
            offset = (battler.is_a?(Game_Actor) ? -($rush_offset) : $rush_offset)
          else
            offset = (battler.is_a?(Game_Actor) ? $rush_offset : -($rush_offset))
          end
          @spriteset.battler(battler).setmove(target.screen_x + offset, target.screen_y)
          @moved[battler] = true
          return
        elsif not battler.guarding?
          @spriteset.battler(battler).pose = $p9
          @spriteset.battler(battler).setmove(battler.screen_x, battler.screen_y)
        end
      end
      
    when 2 # Item
      
      unless $moving_item_atk.include?(@item_used) or @item_scope == 1..2
        # Perform attacks as normal
        if $rush_item
          if not (@moved[battler] or battler.guarding?)
            if $game_system.sideview_mirror == 1
              offset = (battler.is_a?(Game_Actor) ? -($rush_offset) : $rush_offset)
            else
              offset = (battler.is_a?(Game_Actor) ? $rush_offset : -($rush_offset))
            end
            @spriteset.battler(battler).setmove(battler.screen_x - offset, battler.screen_y + 1)
            @moved[battler] = true
            return
          elsif not battler.guarding?
            @spriteset.battler(battler).pose = $p8
            @spriteset.battler(battler).setmove(battler.screen_x, battler.screen_y)
          end
        else
          @spriteset.battler(battler).pose = $p8
        end  
      else
        # Perform rushing attack styled item
        if not (@moved[battler] or battler.guarding?)
          if $game_system.sideview_mirror == 1
            offset = (battler.is_a?(Game_Actor) ? -($rush_offset) : $rush_offset)
          else
            offset = (battler.is_a?(Game_Actor) ? $rush_offset : -($rush_offset))
          end
          @spriteset.battler(battler).setmove(target.screen_x + offset, target.screen_y)
          @moved[battler] = true
          return
        elsif not battler.guarding?
          @spriteset.battler(battler).pose = $p8
          @spriteset.battler(battler).setmove(battler.screen_x, battler.screen_y)
        end
      end
    end
    @moved[battler] = false
    @rtab ? cbs_update_phase4_step3(battler) : cbs_update_phase4_step3
  end
  #--------------------------------------------------------------------------
  # * Hit Animation
  #--------------------------------------------------------------------------
  alias cbs_update_phase4_step4 update_phase4_step4
  def update_phase4_step4(battler = @active_battler)
    for target in (@rtab ? battler.target : @target_battlers)
      damage = (@rtab ? target.damage[battler] : target.damage)
      if damage.is_a?(Numeric) and damage > 0
        @spriteset.battler(target).pose = $p2
      end
    end
    @rtab ? cbs_update_phase4_step4(battler) : cbs_update_phase4_step4
  end
  #--------------------------------------------------------------------------
  # * Victory Animation
  #--------------------------------------------------------------------------
  alias cbs_start_phase5 start_phase5
  def start_phase5
    for actor in $game_party.actors
      return if @spriteset.battler(actor).moving
    end
    for actor in $game_party.actors
      unless actor.dead?
        @spriteset.battler(actor).pose = $p10
        @spriteset.battler(actor).freeze
      end
    end
    cbs_start_phase5
  end
  #--------------------------------------------------------------------------
  # * Change Arrow Viewport
  #--------------------------------------------------------------------------
  alias cbs_start_enemy_select start_enemy_select
  def start_enemy_select
    cbs_start_enemy_select
    @enemy_arrow.dispose
    @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport2)
    @enemy_arrow.help_window = @help_window
  end
end

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

class Spriteset_Battle
  #--------------------------------------------------------------------------
  # * Change Enemy Viewport
  #--------------------------------------------------------------------------
  alias cbs_initialize initialize
  def initialize
    cbs_initialize
    @enemy_sprites = []
    for enemy in $game_troop.enemies.reverse
      @enemy_sprites.push(Sprite_Battler.new(@viewport2, enemy))
    end
  end
  #--------------------------------------------------------------------------
  # * Find Sprite From Battler Handle
  #--------------------------------------------------------------------------
  def battler(handle)
    for sprite in @actor_sprites + @enemy_sprites
      return sprite if sprite.battler == handle
    end
  end
end

#==============================================================================
# ** Arrow_Base
#==============================================================================

class Arrow_Base < Sprite
  #--------------------------------------------------------------------------
  # * Reposition Arrows
  #--------------------------------------------------------------------------
  alias cbs_initialize initialize
  def initialize(viewport)
    cbs_initialize(viewport)
    self.ox = 14
    self.oy = 10
  end
end
 
And the RTAB Script itself:

Part 1
Code:
# Real time active battle (RTAB) Ver 1.12
# Distribution original support URL
# http://members.jcom.home.ne.jp/cogwheel/

class Scene_Battle

  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :status_window            # Status Window
  attr_reader   :spriteset                # Battle sprite
  attr_reader   :scroll_time              # Screen portable basic time
  attr_reader   :zoom_rate                # Enemy battler basic position
  attr_reader   :drive                    # Camera drive
  attr_accessor :force                    # Degree of action forcing
  attr_accessor :camera                   # Present camera possession person

  #--------------------------------------------------------------------------
  # * ATB fundamental setup
  #--------------------------------------------------------------------------
  def atb_setup
    # ATB initialization
    #
    # speed   : Battle speed decision. The lower the value, the faster the system
    #
    # @active : Degree of active setting
    #           3 : Always active state
    #           2 : ATB pauses when selecting skill/item
    #           1 : Same as 2, but pauses during target selection
    #           0 : Same as 1, but pauses during command window selection.
    #
    # @action : Others while acting is the fact that by their causes conduct permitted?
    #           3 : If the enemy's not dead, you can still act
    #           2 : If by his has not received the damage, you permit
    #           1 : In addition to the state of 2, if the target has not acted, you permit
    #           0 : Conduct is not permitted. Until it finishes to act in order, it waits
    #
    # @anime_wait : When it makes true, during battle animation damage indicating wait catches
    # @damage_wait : Damage indicatory waiting (as for unit frame)
    #
    # @after_wait : At the time of ally enemy total loss,  until moves to next processing, waiting
    #               [a, b]  a) At the time of party total loss,  b) At time of enemy total loss (unit frame)
    #
    # @enemy_speed : Thought speed of enemy. If 1 immediately conduct.
    #                In every frame, conduct is caused with the probability of 1/@enemy_speed
    #
    # @force : With forced action forced condition at time of skill use
    #          2: As for skill everything not to reside permanently, by all means immediately execution
    #          1: As for independent skill to reside permanently, only cooperation skill immediately execution
    #          0: All the skill permanent residence just are done
    #
    # ($scene.force = Usually by making x, from the script of the event modification possibility)
    #
    # CAMERA DRIVE SYSTEM:  This system moves the Camera POV to the currently moving battler
    # @drive       : Camera drive system ON/OFF.  When true, drive ON, when false drive OFF
    # @scroll_time : Time it takes to scroll/move the camera POV during battle
    #
    # @zoom_rate = [i, j] : Zoom Rate (Changes the size of the enemy based on perspective)
    #                       i) When arranging in the picture first section, enlargement ratio
    #                       j) When arranging in the picture lowest section, enlargement ratio
    #                       1  When liking to make time, 1.0 be sure to set with decimal

    speed = 150             # IN FRAMES / FOR ATB SYSTEM
    @active = 1             # Active Setting (Range of 0 - 3)
    @action = 2             # Action Setting (Range of 0 - 3)
    @anime_wait = false     #
    @damage_wait = 10       #
    @after_wait = [80, 0]   #
    @enemy_speed = 40       # How fast the enemy attacks (1 is continuously)
    @force = 2              #
    @drive = true         # Turns camera system on/off
    @scroll_time = 15       # Speed of camera system
    @zoom_rate = [1.0, 1.0] # Change size of battler based on perspective
    @help_time = 40
    @escape == false
    @camera = nil
    @max = 0
    @turn_cnt = 0
    @help_wait = 0
    @action_battlers = []
    @synthe = []
    @spell_p = {}
    @spell_e = {}
    @command_a = false
    @command = []
    @party = false

    for battler in $game_party.actors + $game_troop.enemies
      spell_reset(battler)
      battler.at = battler.agi * rand(speed / 2)
      battler.damage_pop = {}
      battler.damage = {}
      battler.damage_sp = {}
      battler.critical = {}
      battler.recover_hp = {}
      battler.recover_sp = {}
      battler.state_p = {}
      battler.state_m = {}
      battler.animation = []
      if battler.is_a?(Game_Actor)
        @max += battler.agi
      end
    end

    @max *= speed
    @max /= $game_party.actors.size

    for battler in $game_party.actors + $game_troop.enemies
      battler.atp = 100 * battler.at / @max
    end
  end

  #--------------------------------------------------------------------------
  # * Full AT Gauge SE
  #--------------------------------------------------------------------------
  def fullat_se
    Audio.se_play("Audio/SE/033-switch02", 80, 100)
  end

  #--------------------------------------------------------------------------
  # * Leveling Up SE
  #--------------------------------------------------------------------------
  def levelup_se
    Audio.se_play("Audio/SE/056-Right02", 80, 100)
  end

  #--------------------------------------------------------------------------
  # * Skill Acquisition SE
  #--------------------------------------------------------------------------
  def skill_se
    Audio.se_play("Audio/SE/056-Right02", 80, 150)
  end
end

class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Draw Actor ATG
  #     actor : Actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  def draw_actor_atg(actor, x, y, width = 144)
    if @at_gauge == nil
      # plus_x:     revised x-coordinate
      # rate_x:     revised X-coordinate as (%)
      # plus_y:     revised y-coordinate
      # plus_width: revised width
      # rate_width: revised width as (%)
      # height:     Vertical width
      # align1: Type 1 ( 0: left justify  1: center justify 2: right justify )
      # align2: Type 2 ( 0: Upper stuffing 1: Central arranging  2:Lower stuffing )
      # align3: Gauge type 0:Left justify 1: Right justify
      @plus_x = 0
      @rate_x = 0
      @plus_y = 16
      @plus_width = 0
      @rate_width = 100
      @width = @plus_width + width * @rate_width / 100
      @height = 16
      @align1 = 0
      @align2 = 1
      @align3 = 0
      # Gradation settings:  grade1: Empty gauge   grade2:Actual gauge
      # (0:On side gradation   1:Vertically gradation    2: Slantedly gradation)
      grade1 = 1
      grade2 = 0
      # Color setting. color1: Outermost framework, color2: Medium framework
      # color3: Empty framework dark color, color4: Empty framework light/write color
      color1 = Color.new(0, 0, 0)
      color2 = Color.new(255, 255, 192)
      color3 = Color.new(0, 0, 0, 192)
      color4 = Color.new(0, 0, 64, 192)
      # Color setting of gauge
      # Usually color setting of the time
      color5 = Color.new(0, 64, 80)
      color6 = Color.new(0, 128, 160)
      # When gauge is MAX, color setting
      color7 = Color.new(80, 0, 0)
      color8 = Color.new(240, 0, 0)
      # Color setting at time of cooperation skill use
      color9 = Color.new(80, 64, 32)
      color10 = Color.new(240, 192, 96)
      # Color setting at time of skill permanent residence
      color11 = Color.new(80, 0, 64)
      color12 = Color.new(240, 0, 192)
      # Drawing of gauge
      gauge_rect_at(@width, @height, @align3, color1, color2,
                  color3, color4, color5, color6, color7, color8,
                  color9, color10, color11, color12, grade1, grade2)
    end
    # Variable at substituting the width of the gauge which is drawn
    if actor.rtp == 0
      at = (width + @plus_width) * actor.atp * @rate_width / 10000
    else
      at = (width + @plus_width) * actor.rt * @rate_width / actor.rtp / 100
    end
    if at > width
      at = width
    end
    # Revision such as the left stuffing central posture of gauge
    case @align1
    when 1
      x += (@rect_width - width) / 2
    when 2
      x += @rect_width - width
    end
    case @align2
    when 1
      y -= @height / 2
    when 2
      y -= @height
    end
    self.contents.blt(x + @plus_x + width * @rate_x / 100, y + @plus_y,
                      @at_gauge, Rect.new(0, 0, @width, @height))
    if @align3 == 0
      rect_x = 0
    else
      x += @width - at - 1
      rect_x = @width - at - 1
    end
    # Color setting of gauge
    if at == width
        # Gauge drawing at the time of MAX
      self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
                        @at_gauge, Rect.new(rect_x, @height * 2, at, @height))
    else
      if actor.rtp == 0
        # Usually gauge drawing of the time
        self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
                          @at_gauge, Rect.new(rect_x, @height, at, @height))
      else
        if actor.spell == true
          #Gauge drawing at time of cooperation skill use
          self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
                        @at_gauge, Rect.new(rect_x, @height * 3, at, @height))
        else
          # Gauge drawing at time of skill permanent residence
          self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
                        @at_gauge, Rect.new(rect_x, @height * 4, at, @height))
        end
      end
    end
  end
end

#==============================================================================
# ** Scene_Battle (part 1)
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

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)
    atb_setup
    # Make actor command window
    s1 = $data_system.words.attack
    s2 = $data_system.words.skill
    s3 = $data_system.words.guard
    s4 = $data_system.words.item
    @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
    @actor_command_window.y = 160
    @actor_command_window.back_opacity = 160
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # Make other windows
    @party_command_window = Window_PartyCommand.new
    @help_window = Window_Help.new
    @help_window.back_opacity = 160
    @help_window.visible = false
    @status_window = Window_BattleStatus.new
    @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)
      # Fade out screen
      Graphics.transition
      Graphics.freeze
    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
  #--------------------------------------------------------------------------
  # * Determine Battle Win/Loss Results
  #--------------------------------------------------------------------------
  def judge
    # If all dead determinant is true, or number of members in party is 0
    if $game_party.all_dead? or $game_party.actors.size == 0
      # If possible to lose
      if $game_temp.battle_can_lose
        # Return to BGM before battle starts
        $game_system.bgm_play($game_temp.map_bgm)
        # Battle end
        battle_end(2)
        # Return true
        return true
      end
      # Setting the game over flag
      $game_temp.gameover = true
      # Return true
      return true
    end
    # Return false if even 1 enemy exists
    for enemy in $game_troop.enemies
      if enemy.exist?
        return false
      end
    end
    # Start after battle phase (win)
    start_phase5
    # Return true
    return true
  end
  #--------------------------------------------------------------------------
  # * Frame renewal
  #--------------------------------------------------------------------------
  def update
    # If battle event is running
    if $game_system.battle_interpreter.running?
      if @command.size > 0
        @command_a = false
        @command = []
        command_delete
      end
      @status_window.at_refresh
      # 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?
          # Refresh status window
          @status_window.refresh
          setup_battle_event
        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 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 help window is waiting	
    if @help_wait > 0
      @help_wait -= 1
      if @help_wait == 0
        # Hide help window
        @help_window.visible = false
      end
    end
    # Branch according to phase
    case @phase
    when 0  # AT gauge renewal phase
      if anime_wait_return
        update_phase0
      end
    when 1  # pre-battle phase
      update_phase1
      return
    when 2  # party command phase
      update_phase2
      return
    when 5  # after battle phase
      update_phase5
      return
    end
    if $scene != self
      return
    end
    if @phase == 0
      if @command.size != 0  # Actor command phase
        if @command_a == false
          start_phase3
        end
        update_phase3
      end
      # If waiting
      if @wait_count > 0
        # Decrease wait count
        @wait_count -= 1
        return
      end
      update_phase4
    end
  end
 
RTAB Script Part 2

Code:
#==============================================================================
# ** Scene_Battle (part 2)
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

  #--------------------------------------------------------------------------
  # * Frame renewal (AT gauge renewal phase)
  #--------------------------------------------------------------------------
  def update_phase0
    if $game_temp.battle_turn == 0
      $game_temp.battle_turn = 1
    end
    # If B button was pressed
    if @command_a == false and @party == false
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        @party = true
      end
    end
    if @party == true and
        ((@action > 0 and @action_battlers.empty?) or (@action == 0 and 
        (@action_battlers.empty? or @action_battlers[0].phase == 1)))
      # Start party command phase
      start_phase2
      return
    end
    # AT gauge increase processing
    cnt = 0
    for battler in $game_party.actors + $game_troop.enemies
      active?(battler)
      if battler.rtp == 0
        if battler.at >= @max
          if battler.is_a?(Game_Actor)
            if battler.inputable?
              unless @action_battlers.include?(battler) or
                  @command.include?(battler) or @escape == true
                if battler.current_action.forcing
                  fullat_se
                  force_action(battler)
                  action_start(battler)
                else
                  fullat_se
                  @command.push(battler)
                end
              end
            else
              unless @action_battlers.include?(battler) or
                      battler == @command[0]
                battler.current_action.clear
                if @command.include?(battler)
                  @command.delete(battler)
                else
                  if battler.movable?
                    fullat_se
                  end
                end
                action_start(battler)
              end
            end
          else
            unless @action_battlers.include?(battler)
              if battler.current_action.forcing
                force_action(battler)
                action_start(battler)
              else
                if @enemy_speed != 0
                  if rand(@enemy_speed) == 0
                    number = cnt - $game_party.actors.size
                    enemy_action(number)
                  end
                else
                  number = cnt - $game_party.actors.size
                  enemy_action(number)
                end
              end
            end
          end
        else
          battler.at += battler.agi
          if battler.guarding?
            battler.at += battler.agi
          end
          if battler.movable?
            battler.atp = 100 * battler.at / @max
          end
        end
      else
        if battler.rt >= battler.rtp
          speller = synthe?(battler)
          if speller != nil
            battler = speller[0]
          end
          unless @action_battlers.include?(battler)
            if battler.is_a?(Game_Actor)
              fullat_se
            end
            battler.rt = battler.rtp
            action_start(battler)
          end
        else
          battler.rt += battler.agi
          speller = synthe?(battler)
          if speller != nil
            for spell in speller
              if spell != battler
                spell.rt += battler.agi
              end
            end
          end
        end
      end
      cnt += 1
    end
    # Refresh AT gauge
    @status_window.at_refresh
    # Escape processing
    if @escape == true and
        ((@action > 0 and @action_battlers.empty?) or (@action == 0 and 
        (@action_battlers.empty? or @action_battlers[0].phase == 1)))
      temp = false
      for battler in $game_party.actors
        if battler.inputable?
          temp = true
        end
      end
      if temp == true
        for battler in $game_party.actors
          if battler.at < @max and battler.inputable?
            temp = false
            break
          end
        end
        if temp == true
          @escape = false
          for battler in $game_party.actors
            battler.at %= @max
          end
          $game_temp.battle_main_phase = false
          update_phase2_escape
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Start Party Command Phase
  #--------------------------------------------------------------------------
  def start_phase2
    # Shift to phase 2
    @phase = 2
    @party = false
    # Enable party command window
    @party_command_window.active = true
    @party_command_window.visible = true
    # Set actor to non-selecting
    @actor_index = -1
    # Disable actor command window
    @actor_command_window.active = false
    @actor_command_window.visible = false
    if @command.size != 0
      # Actor blink effect OFF
      if @active_actor != nil
        @active_actor.blink = false
      end
    end
    # Camera set
    @camera == "party"
    @spriteset.screen_target(0, 0, 1)
    # Clear main phase flag
    $game_temp.battle_main_phase = false
  end
  #--------------------------------------------------------------------------
  # * Frame renewal (party command phase)
  #--------------------------------------------------------------------------
  def update_phase2
    # When C button is pushed
    if Input.trigger?(Input::C)
      # It diverges at cursor position of the party command window
      case @party_command_window.index
      when 0  # It fights
        # Nullifying the party command window
        @party_command_window.active = false
        @party_command_window.visible = false
        # Performing decision SE
        $game_system.se_play($data_system.decision_se)
        @escape = false
        @phase = 0
        if $game_temp.battle_turn == 0
          $game_temp.battle_turn = 1
        end
        if @command_a == true
          # Actor command phase start
          start_phase3
        else
          $game_temp.battle_main_phase = true
        end
      when 1  # It escapes
        # When it is not flight possible,
        if $game_temp.battle_can_escape == false
          # Performing buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Performing decision SE
        $game_system.se_play($data_system.decision_se)
        @phase = 0
        # Nullifying the party command window
        @party_command_window.active = false
        @party_command_window.visible = false
        $game_temp.battle_main_phase = true
        if $game_temp.battle_turn == 0
          update_phase2_escape
          $game_temp.battle_turn = 1
          for battler in $game_party.actors
            battler.at -= @max / 2
          end
          return
        end
        # Performing decision SE
        $game_system.se_play($data_system.decision_se)
        @escape = true
        for battler in $game_party.actors
          @command_a = false
          @command.delete(battler)
          @action_battlers.delete(battler)
          skill_reset(battler)
        end
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame renewal (party command phase: It escapes)
  #--------------------------------------------------------------------------
  def update_phase2_escape
    # The enemy it is fast, calculating mean value
    enemies_agi = 0
    enemies_number = 0
    for enemy in $game_troop.enemies
      if enemy.exist?
        enemies_agi += enemy.agi
        enemies_number += 1
      end
    end
    if enemies_number > 0
      enemies_agi /= enemies_number
    end
    # The actor it is fast, calculating mean value
    actors_agi = 0
    actors_number = 0
    for actor in $game_party.actors
      if actor.exist?
        actors_agi += actor.agi
        actors_number += 1
      end
    end
    if actors_number > 0
      actors_agi /= actors_number
    end
    # Flight success decision
    success = rand(100) < 50 * actors_agi / enemies_agi
    # In case of flight success
    if success
      # Performing flight SE
      $game_system.se_play($data_system.escape_se)
      # You reset to BGM before the battle starting
      $game_system.bgm_play($game_temp.map_bgm)
      # Battle end
      battle_end(1)
    # In case of failure of flight
    else
      @help_window.set_text("Cannot escape", 1)
      @help_wait = @help_time
      # Clearing the action of party everyone
      $game_party.clear_actions
      # Main phase start
      start_phase4
    end
  end
  #--------------------------------------------------------------------------
  # * After battle phase start
  #--------------------------------------------------------------------------
  def start_phase5
    # It moves to phase 5
    @phase = 5
    # Performing battle end ME
    $game_system.me_play($game_system.battle_end_me)
    # You reset to BGM before the battle starting
    $game_system.bgm_play($game_temp.map_bgm)
    # Initializing EXP, the gold and the treasure
    exp = 0
    gold = 0
    treasures = []
    if @active_actor != nil
      @active_actor.blink = false
    end
    # Setting the main phase flag
    $game_temp.battle_main_phase = true
    # Nullifying the party command window
    @party_command_window.active = false
    @party_command_window.visible = false
    # Nullifying the actor command window
    @actor_command_window.active = false
    @actor_command_window.visible = false
    if @skill_window != nil
      # Releasing the skill window
      @skill_window.dispose
      @skill_window = nil
    end
    if @item_window != nil
      # Releasing the item window
      @item_window.dispose
      @item_window = nil
    end
    # The help window is hidden
    @help_window.visible = false
    # Loop
    for enemy in $game_troop.enemies
      # When the enemy hides and it is not state,
      unless enemy.hidden
        # Adding acquisition EXP and the gold
        exp += enemy.exp
        gold += enemy.gold
        # Treasure appearance decision
        if rand(100) < enemy.treasure_prob
          if enemy.item_id > 0
            treasures.push($data_items[enemy.item_id])
          end
          if enemy.weapon_id > 0
            treasures.push($data_weapons[enemy.weapon_id])
          end
          if enemy.armor_id > 0
            treasures.push($data_armors[enemy.armor_id])
          end
        end
      end
    end
    # It limits the number of treasures up to 6
    treasures = treasures[0..5]
    # EXP acquisition
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += exp
        if actor.level > last_level
          @status_window.level_up(i)
          actor.damage[[actor, -1]] = "Level up!"
          actor.up_level = actor.level - last_level
        end
      end
    end
    # Gold acquisition
    $game_party.gain_gold(gold)
    # Treasure acquisition
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    # Drawing up the battle result window
    @result_window = Window_BattleResult.new(exp, gold, treasures)
    # Setting wait count
    @phase5_wait_count = 100
  end
  #--------------------------------------------------------------------------
  # * Frame renewal (after battle phase)
  #--------------------------------------------------------------------------
  def update_phase5
    # When wait count is larger than 0,
    if @phase5_wait_count > 0
      # Wait count is decreased
      @phase5_wait_count -= 1
      # When wait count becomes 0,
      if @phase5_wait_count == 0
        # Indicating the result window
        @result_window.visible = true
        # Clearing the main phase flag
        $game_temp.battle_main_phase = false
        # Refreshing the status window
        @status_window.refresh
        for actor in $game_party.actors
          if actor.damage.include?([actor, 0])
            @phase5_wait_count = 20
            actor.damage_pop[[actor, 0]] = true
          end
          if actor.damage.include?([actor, -1])
            @phase5_wait_count = 20
            actor.damage_pop[[actor, -1]] = true
            for level in actor.level - actor.up_level + 1..actor.level
              for skill in $data_classes[actor.class_id].learnings
                if level == skill.level and not actor.skill_learn?(skill.id)
                  actor.damage[[actor, 0]] = "New Skill!"
                  break
                end
              end
            end
          end
        end
      end
      return
    end
    # When C button is pushed,
    if Input.trigger?(Input::C)
      # Battle end
      battle_end(0)
    end
  end

#==============================================================================
# ** Scene_Battle (Division definition 3)
#------------------------------------------------------------------------------
# * It is the class which processes the battle picture.
#==============================================================================

  #--------------------------------------------------------------------------
  # * Actor command phase start
  #--------------------------------------------------------------------------
  def start_phase3
    if victory?
      return
    end
    # Clearing the main phase flag
    $game_temp.battle_main_phase = false
    @command_a = true
    @active_actor = @command[0]
    cnt = 0
    for actor in $game_party.actors
      if actor == @active_actor
        @actor_index = cnt
      end
      cnt += 1
    end
    @active_actor.blink = true
    unless @active_actor.inputable?
      @active_actor.current_action.clear
      phase3_next_actor
      return
    end
    phase3_setup_command_window
    # Setting of camera
    @camera = "command"
    plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
    y = [(plus.abs - 1.5) * 10 , 0].min
    @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
  end
  #--------------------------------------------------------------------------
  # * Command input end of actor
  #--------------------------------------------------------------------------
  def phase3_next_actor
    @command.shift
    @command_a = false
    # Setting the main phase flag
    $game_temp.battle_main_phase = true
    # Nullifying the actor command window
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # Blinking effect OFF of actor
    if @active_actor != nil
      @active_actor.blink = false
    end
    action_start(@active_actor)
    # You reset on the basis of the camera
    if @camera == "command"
      @spriteset.screen_target(0, 0, 1)
    end
    return
  end
  #--------------------------------------------------------------------------
  # * Setup of actor command window
  #--------------------------------------------------------------------------
  def phase3_setup_command_window
    # Nullifying the party command window
    @party_command_window.active = false
    @party_command_window.visible = false
    # Enabling the actor command window
    @actor_command_window.active = true
    @actor_command_window.visible = true
    # Setting the position of the actor command window
    @actor_command_window.x = @actor_index * 160 +
                              (4 - $game_party.actors.size) * 80
    # Setting the index to 0
    @actor_command_window.index = 0
  end
  #--------------------------------------------------------------------------
  # * Enemy action compilation
  #--------------------------------------------------------------------------
  def enemy_action(number)
    enemy = $game_troop.enemies[number]
    unless enemy.current_action.forcing
      enemy.make_action
    end
    action_start(enemy)
  end
 
RTAB Part 3

Code:
#--------------------------------------------------------------------------
  # * Frame renewal (actor command phase)
  #--------------------------------------------------------------------------
  def update_phase3
    if victory? and @command_a
      command_delete
      @command.push(@active_actor)
      return
    end
    # When the enemy arrow is valid
    if @enemy_arrow != nil
      update_phase3_enemy_select
    # When the actor arrow is valid
    elsif @actor_arrow != nil
      update_phase3_actor_select
    # When the skill window is valid
    elsif @skill_window != nil
      update_phase3_skill_select
    # When the item window is valid
    elsif @item_window != nil
      update_phase3_item_select
    # When the actor command window is valid
    elsif @actor_command_window.active
      update_phase3_basic_command
    end
  end
  #--------------------------------------------------------------------------
  # * Frame renewal (actor command phase: Basic command)
  #--------------------------------------------------------------------------
  def update_phase3_basic_command
    unless @active_actor.inputable?
      @active_actor.current_action.clear
      phase3_next_actor
      return
    end
    # The B when button is pushed,
    if Input.trigger?(Input::B) and @party == false
      # Performing cancellation SE
      $game_system.se_play($data_system.cancel_se)
      @party = true
    end
    if @party == true and
        ((@action > 0 and @action_battlers.empty?) or (@action == 0 and 
        (@action_battlers.empty? or @action_battlers[0].phase == 1)))
      # To party command phase
      start_phase2
      return
    end
    # When C button is pushed,
    if Input.trigger?(Input::C)
      @party = false
      # It diverges at cursor position of the actor command window
      case @actor_command_window.index
      when 0  # Attack
        # Performing decision SE
        $game_system.se_play($data_system.decision_se)
        # Starting the selection of the enemy
        start_enemy_select
      when 1  # Skill
        # Performing decision SE
        $game_system.se_play($data_system.decision_se)
        # Starting the selection of skill
        start_skill_select
      when 2  # Defense
        # Performing decision SE
        $game_system.se_play($data_system.decision_se)
        # Setting action
        @active_actor.current_action.kind = 0
        @active_actor.current_action.basic = 1
        # To command input of the following actor
        phase3_next_actor
      when 3  # Item
        # Performing decision SE
        $game_system.se_play($data_system.decision_se)
        # Starting the selection of the item
        start_item_select
      end
      return
    end
    # キャラãƒ
 
Part 4

Code:
#--------------------------------------------------------------------------
  # * Action renewal (main phase)
  #--------------------------------------------------------------------------
  def action_phase(battler)
    # When action 1 is, verification whether or not the battler while acting
    if @action == 1 and battler.phase <= 3
      for target in battler.target
        speller = synthe?(target)
        if speller == nil
          # When the target is in the midst of usual acting,
          if @action_battlers.include?(target)
            if target.phase > 2
              return
            end
          end
        else
          # When the target is in the midst of cooperation skill moving,
          for spell in speller
            if @action_battlers.include?(spell)
              if spell.phase > 2
                return
              end
            end
          end
        end
      end
    end
    case battler.phase
    when 1
      update_phase4_step1(battler)
    when 2
      update_phase4_step2(battler)
    when 3
      update_phase4_step3(battler)
    when 4
      update_phase4_step4(battler)
    when 5
      update_phase4_step5(battler)
    when 6
      update_phase4_step6(battler)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame renewal (main phase step 1: Action preparation)
  #--------------------------------------------------------------------------
  def update_phase4_step1(battler)
    # Already, when it is removed from battle
    if battler.index == nil
      @action_battlers.delete(battler)
      anime_wait_return
      return
    end
    speller = synthe?(battler)
    if speller == nil
      # When it is while the damage receiving
      unless battler.damage.empty? or @action > 2
        return
      end
      # Whether or not conduct possibility decision
      unless battler.movable?
        battler.phase = 6
        return
      end
    else
      # When it is while the damage receiving,
      for spell in speller
        unless spell.damage.empty? or @action > 2
          return
        end
        # Whether or not conduct possibility decision
        unless spell.movable?
          battler.phase = 6
          return
        end
      end
    end
    # At the time of skill use, permanent residence time setting
    # When forced action and @force 2 being, skill immediately motion
    if battler.current_action.kind == 1 and
      (not battler.current_action.forcing or @force != 2)
      if battler.rtp == 0
        # If it is in the midst of skill residing permanently, cancellation
        skill_reset(battler)
        # Skill permanent residence time setting
        recite_time(battler)
        # Cooperation skill setting
        synthe_spell(battler)
        # When skill you reside permanently,
        if battler.rtp > 0
          # When forced action and @force 1 being, only cooperation skill immediately motion
          speller = synthe?(battler)
          if battler.current_action.forcing and @force > 0 and speller != nil
            for spell in speller
              spell.rt = spell.rtp
            end
          else
            battler.blink = true
            if battler.current_action.forcing
              $game_temp.forcing_battler = nil
              battler.current_action.forcing = false
            end
            @action_battlers.delete(battler)
            return
          end
        end
      end
    end
    # Blinking effect OFF of actor
    if battler != nil
      battler.blink = false
    end
    speller = synthe?(battler)
    if speller == nil
      @spell_p.delete(battler)
      @spell_e.delete(battler)
    else
      for spell in speller
        spell.blink = false
        @spell_p.delete(spell)
        @spell_e.delete(spell)
      end
    end
    # It moves to step 2
    battler.phase = 2
  end
  #--------------------------------------------------------------------------
  # * Frame renewal (main phase step 2: Action start)
  #--------------------------------------------------------------------------
  def update_phase4_step2(battler)
    # If it is not forced action
    unless battler.current_action.forcing
      # When restriction [ the enemy is attacked ] [ friend attacks ] usually usually
      if battler.restriction == 2 or battler.restriction == 3
        # Setting attack to action
        battler.current_action.kind = 0
        battler.current_action.basic = 0
      end
    end
    # It diverges with classification of action
    case battler.current_action.kind
    when 0  # Basis
      if fin?
        battler.phase = 6
        return
      end
      make_basic_action_result(battler)
    when 1  # Skill
      if fin? and $data_skills[battler.current_action.skill_id].scope == 1..2
        battler.phase = 6
        return
      end
      make_skill_action_result(battler)
    when 2  # Item
      if fin? and $data_items[battler.current_action.item_id].scope == 1..2
        battler.phase = 6
        return
      end
      make_item_action_result(battler)
    end
    if battler.phase == 2
      # It moves to step 3
      battler.phase = 3
    end
  end
  #--------------------------------------------------------------------------
  # * Basic action result compilation
  #--------------------------------------------------------------------------
  def make_basic_action_result(battler)
    # In case of attack
    if battler.current_action.basic == 0
      # Setting animation ID
      battler.anime1 = battler.animation1_id
      battler.anime2 = battler.animation2_id
      # When the conduct side battler is the enemy
      if battler.is_a?(Game_Enemy)
        if battler.restriction == 3
          target = $game_troop.random_target_enemy
        elsif battler.restriction == 2
          target = $game_party.random_target_actor
        else
          index = battler.current_action.target_index
          target = $game_party.smooth_target_actor(index)
        end
      end
      # When the conduct side battler is the actor
      if battler.is_a?(Game_Actor)
        if battler.restriction == 3
          target = $game_party.random_target_actor
        elsif battler.restriction == 2
          target = $game_troop.random_target_enemy
        else
          index = battler.current_action.target_index
          target = $game_troop.smooth_target_enemy(index)
        end
      end
      # Setting the arrangement of the object side battler
      battler.target = [target]
      # Applying the effect of normality attack
      for target in battler.target
        target.attack_effect(battler)
      end
      return
    end
    # In case of defense
    if battler.current_action.basic == 1
      return
    end
    # When escapes and is
    if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
      # It escapes
      @help_window.set_text("逃ã
 
Part 5

Code:
#--------------------------------------------------------------------------
  # * Frame renewal (main phase step 5: Damage indication)
  #--------------------------------------------------------------------------
  def update_phase4_step5(battler)
    # Damage indication
    for target in battler.target
      if target.damage[battler] != nil
        target.damage_pop[battler] = true
        target.damage_effect(battler, battler.current_action.kind)
        battler.wait = @damage_wait
        # Refreshing the status window
        status_refresh(target)
      end
    end
    # It moves to step 6
    battler.phase = 6
  end
  #--------------------------------------------------------------------------
  # * Frame renewal (main phase step 6: Refreshment)
  #--------------------------------------------------------------------------
  def update_phase4_step6(battler)
    # The camera is reset
    if battler.target[0].is_a?(Game_Enemy) and @camera == battler
      @spriteset.screen_target(0, 0, 1)
    end
    # Skill learning
    if battler.target[0].is_a?(Game_Actor) and battler.current_action.kind == 1
      for target in battler.target
        skill_learning(target, target.class_id,
                        battler.current_action.skill_id)
      end
    end
    # Clearing the battler of the action forced object
    if battler.current_action.forcing == true and
        battler.current_action.force_kind == 0 and
        battler.current_action.force_basic == 0 and
        battler.current_action.force_skill_id == 0
      $game_temp.forcing_battler = nil
      battler.current_action.forcing = false
    end
    refresh_phase(battler)
    speller = synthe?(battler)
    if speller != nil
      for spell in speller
        if spell != battler
          refresh_phase(spell)
        end
      end
      synthe_delete(speller)
    end
    # When common event ID is valid
    if battler.event > 0
      # Setting up the event
      common_event = $data_common_events[battler.event]
      $game_system.battle_interpreter.setup(common_event.list, 0)
    end
    act = 0
    for actor in $game_party.actors + $game_troop.enemies
      if actor.movable?
        act += 1
      end
    end
    if @turn_cnt >= act and act > 0
      @turn_cnt %= act
      $game_temp.battle_turn += 1
      # Searching the full page of the battle event
      for index in 0...$data_troops[@troop_id].pages.size
        # Acquiring the event page
        page = $data_troops[@troop_id].pages[index]
        # When the span of this page [ turn ] is
        if page.span == 1
          # Clearing the execution being completed flag
          $game_temp.battle_event_flags[index] = false
        end
      end
    end
    battler.phase = 1
    @action_battlers.delete(battler)
  end
  #--------------------------------------------------------------------------
  # * Refreshment
  #--------------------------------------------------------------------------
  def refresh_phase(battler)
    battler.at -= @max
    if battler.movable?
      battler.atp = 100 * battler.at / @max
    end
    spell_reset(battler)
    # Slip damage
    if battler.hp > 0 and battler.slip_damage?
      battler.slip_damage_effect
      battler.damage_pop["slip"] = true
    end
    # State natural cancellation
    battler.remove_states_auto
    # Refreshing the status window
    status_refresh(battler, true)
    unless battler.movable?
      return
    end
    # Turn several counts
    @turn_cnt += 1
  end
  #--------------------------------------------------------------------------
  # * Battler action start
  #--------------------------------------------------------------------------
  def action_start(battler)
    battler.phase = 1
    battler.anime1 = 0
    battler.anime2 = 0
    battler.target = []
    battler.event = 0
    @action_battlers.unshift(battler)
  end
  #--------------------------------------------------------------------------
  # * Refreshing the status window
  #--------------------------------------------------------------------------
  def status_refresh(battler, at = false)
    if battler.is_a?(Game_Actor)
      for i in 0...$game_party.actors.size
        if battler == $game_party.actors[i]
          number = i + 1
        end
      end
      @status_window.refresh(number)
      if at == true
        @status_window.at_refresh(number)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Animation wait judgement processing
  #--------------------------------------------------------------------------
  def anime_wait_return
    if (@action_battlers.empty? or @anime_wait == false) and
        not $game_system.battle_interpreter.running?
      # When the enemy arrow is valid
      if @enemy_arrow != nil
        return [@active - 2, 0].min == 0
      # When the actor arrow is valid
      elsif @actor_arrow != nil
        return [@active - 2, 0].min == 0
      # When the skill window is valid
      elsif @skill_window != nil
        return [@active - 3, 0].min == 0
      # When the item window is valid
      elsif @item_window != nil
        return [@active - 3, 0].min == 0
      # When the actor command window is valid
      elsif @actor_command_window.active
        return [@active - 1, 0].min == 0
      else
        return true
      end
    else
      return false
    end
  end
  #--------------------------------------------------------------------------
  # * Actor command elimination judgement
  #--------------------------------------------------------------------------
  def command_delete
    # When the enemy arrow is valid
    if @enemy_arrow != nil
      end_enemy_select
    # When the actor is valid
    elsif @actor_arrow != nil
      end_actor_select
    end
    # When the skill window is valid
    if @skill_window != nil
      end_skill_select
    # When the item window is valid
    elsif @item_window != nil
      end_item_select
    end
    # When the actor command window is valid
    if @actor_command_window.active
      @command.shift
      @command_a = false
      # Setting the main phase flag
      $game_temp.battle_main_phase = true
      # Hides the actor command window when it is invalid
      @actor_command_window.active = false
      @actor_command_window.visible = false
      # Blinking effect OFF of actor
      if @active_actor != nil
        @active_actor.blink = false
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Forcing action setting
  #--------------------------------------------------------------------------
  def force_action(battler)
    battler.current_action.kind = battler.current_action.force_kind
    battler.current_action.basic = battler.current_action.force_basic
    battler.current_action.skill_id = battler.current_action.force_skill_id
    battler.current_action.force_kind = 0
    battler.current_action.force_basic = 0
    battler.current_action.force_skill_id = 0
  end
  #--------------------------------------------------------------------------
  # * Camera set
  #--------------------------------------------------------------------------
  def camera_set(battler)
    @camera = battler
    if battler.target.size == 1
      if battler.current_action.kind == 0
        zoom = 1.2 / battler.target[0].zoom
      elsif synthe?(battler) == nil
        zoom = 1.5 / battler.target[0].zoom
      else
        zoom = 2.0 / battler.target[0].zoom
      end
      @spriteset.screen_target(battler.target[0].attack_x(zoom),
                                battler.target[0].attack_y(zoom), zoom)
    else
      @spriteset.screen_target(0, 0, 0.75)
    end
  end
  #--------------------------------------------------------------------------
  # * Skill permanent residence time compilation
  #--------------------------------------------------------------------------
  def recite_time(battler)
  end
  #--------------------------------------------------------------------------
  # * Cooperation skill distinction
  #--------------------------------------------------------------------------
  def synthe_spell(battler)
  end
  #--------------------------------------------------------------------------
  # * Skill learning system
  #--------------------------------------------------------------------------
  def skill_learning(actor, class_id, skill_id)
  end
  #--------------------------------------------------------------------------
  # * Conduct possible decision
  #--------------------------------------------------------------------------
  def active?(battler)
    speller = synthe?(battler)
    if speller != nil
      if synthe_delete?(speller)
        return false
      end
    else
      unless battler.inputable?
        spell_reset(battler)
        unless battler.movable?
          battler.atp = 0
          return false
        end
      end
      if battler.current_action.forcing
        spell_reset(battler)
      end
    end
    return true
  end
  #--------------------------------------------------------------------------
  # * During synthesis skill residing permanently?
  #--------------------------------------------------------------------------
  def synthe?(battler)
    for speller in @synthe
      if speller.include?(battler)
        return speller
      end
    end
    return nil
  end
  #--------------------------------------------------------------------------
  # * Synthesis skill elimination judgement
  #--------------------------------------------------------------------------
  def synthe_delete?(speller)
    for battler in speller
      if not battler.inputable? and dead_ok?(battler)
        synthe_delete(speller)
        return true
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Synthesis skill elimination
  #--------------------------------------------------------------------------
  def synthe_delete(speller)
    for battler in speller
      spell_reset(battler)
      if dead_ok?(battler)
        @action_battlers.delete(battler)
      end
    end
    @synthe.delete(speller)
  end
  #--------------------------------------------------------------------------
  # * Cooperation the skill permanent residence cancellation which is included
  #--------------------------------------------------------------------------
  def skill_reset(battler)
    speller = synthe?(battler)
    if speller != nil
      synthe_delete(speller)
    else
      spell_reset(battler)
    end
  end
  #--------------------------------------------------------------------------
  # * Skill permanent residence cancellation
  #--------------------------------------------------------------------------
  def spell_reset(battler)
    battler.rt = 0
    battler.rtp = 0
    battler.blink = false
    battler.spell = false
    battler.current_action.spell_id = 0
    @spell_p.delete(battler)
    @spell_e.delete(battler)
  end
  #--------------------------------------------------------------------------
  # * Battle end decision
  #--------------------------------------------------------------------------
  def fin?
   return (victory? or $game_party.all_dead? or $game_party.actors.size == 0)
  end
  #--------------------------------------------------------------------------
  # * Enemy total destruction decision
  #--------------------------------------------------------------------------
  def victory?
    for battler in $game_troop.enemies
      if not battler.hidden and (battler.rest_hp > 0 or
          battler.immortal or battler.damage_pop.size > 0)
        return false
      end
    end
    return true
  end
  #--------------------------------------------------------------------------
  # * Death permission decision
  #--------------------------------------------------------------------------
  def dead_ok?(battler)
    speller = synthe?(battler)
    if speller == nil
      if @action_battlers.include?(battler)
        if battler.phase > 2
          return false
        end
      end
    else
      for battler in speller
        if @action_battlers.include?(battler)
          if battler.phase > 2
            return false
          end
        end
      end
    end
    return true
  end
end

#==============================================================================
# â–  Game_Actor
#------------------------------------------------------------------------------
#  アクターを扱ã
 
Part 8

Code:
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# *  It is superclass of all windows in the game.
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Drawing of gauge
  #--------------------------------------------------------------------------
  def gauge_rect_at(width, height, align3,
                    color1, color2, color3, color4, color5, color6, color7,
                    color8, color9, color10, color11, color12, grade1, grade2)
    # Framework drawing
    @at_gauge = Bitmap.new(width, height * 5)
    @at_gauge.fill_rect(0, 0, width, height, color1)
    @at_gauge.fill_rect(1, 1, width - 2, height - 2, color2)
    if (align3 == 1 and grade1 == 0) or grade1 > 0
      color = color3
      color3 = color4
      color4 = color
    end
    if (align3 == 1 and grade2 == 0) or grade2 > 0
      color = color5
      color5 = color6
      color6 = color
      color = color7
      color7 = color8
      color8 = color
      color = color9
      color9 = color10
      color10 = color
      color = color11
      color11 = color12
      color12 = color
    end
    if align3 == 0
      if grade1 == 2
        grade1 = 3
      end
      if grade2 == 2
        grade2 = 3
      end
    end
    # Drawing vertically of empty gauge gradation indication
    @at_gauge.gradation_rect(2, 2, width - 4, height - 4,
                                  color3, color4, grade1)
    # Drawing of actual gauge
    @at_gauge.gradation_rect(2, height + 2, width- 4, height - 4,
                                  color5, color6, grade2)
    @at_gauge.gradation_rect(2, height * 2 + 2, width- 4, height - 4,
                                  color7, color8, grade2)
    @at_gauge.gradation_rect(2, height * 3 + 2, width- 4, height - 4,
                                  color9, color10, grade2)
    @at_gauge.gradation_rect(2, height * 4 + 2, width- 4, height - 4,
                                  color11, color12, grade2)
  end
end


#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
# * It is the window which indicates the item description the skill and the
#   status etc. of the actor.
#==============================================================================

class Window_Help < Window_Base
  #--------------------------------------------------------------------------
  # * Enemy Setting
  #     enemy : The enemy which indicates name and the state
  #--------------------------------------------------------------------------
  def set_enemy(enemy)
    text = enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {""}
    state_text = make_battler_state_text(enemy, 112, false)
    if state_text != ""
      text += "  " + state_text
    end
    set_text(text, 1)
  end
end

#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
# * It is the window which indicates the status of the party member in the 
#   battle picture.
#==============================================================================

class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    x = (4 - $game_party.actors.size) * 80
    width = $game_party.actors.size * 160
    super(x, 320, width, 160)
    self.back_opacity = 160
    @actor_window = []
    for i in 0...$game_party.actors.size
      @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
    end
    @level_up_flags = [false, false, false, false]
    refresh
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    for window in @actor_window
      window.dispose
    end
    super
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh(number = 0)
    if number == 0
      cnt = 0
      for window in @actor_window
        window.refresh(@level_up_flags[cnt])
        cnt += 1
      end
    else
      @actor_window[number - 1].refresh(@level_up_flags[number - 1])
    end
  end
  #--------------------------------------------------------------------------
  # * AT gauge refreshment
  #--------------------------------------------------------------------------
  def at_refresh(number = 0)
    if number == 0
      for window in @actor_window
        window.at_refresh
      end
    else
      @actor_window[number - 1].at_refresh
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Renewal
  #--------------------------------------------------------------------------
  def update
    super
    if self.x != (4 - $game_party.actors.size) * 80
      self.x = (4 - $game_party.actors.size) * 80
      self.width = $game_party.actors.size * 160
      for window in @actor_window
        window.dispose
      end
      @actor_window = []
      for i in 0...$game_party.actors.size
        @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
      end
      refresh
    end
    for window in @actor_window
      window.update
    end
  end
end

#==============================================================================
# ** Window_ActorStatus
#------------------------------------------------------------------------------
# * It is the window which indicates the status of the party member respectively
#   in the battle picture.
#==============================================================================

class Window_ActorStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(id, x)
    @actor_num = id
    super(x, 320, 160, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    self.back_opacity = 0
    actor = $game_party.actors[@actor_num]
    @actor_nm = actor.name
    @actor_mhp = actor.maxhp
    @actor_msp = actor.maxsp
    @actor_hp = actor.hp
    @actor_sp = actor.sp
    @actor_st = make_battler_state_text(actor, 120, true)
    @status_window = []
    for i in 0...5
      @status_window.push(Window_DetailsStatus.new(actor, i, x))
    end
    refresh(false)
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    for i in 0...5
      @status_window[i].dispose
    end
    super
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh(level_up_flags)
    self.contents.clear
    actor = $game_party.actors[@actor_num]
    @status_window[0].refresh(actor) if @actor_nm != actor.name
    @status_window[1].refresh(actor) if
      @actor_mhp != actor.maxhp or @actor_hp != actor.hp
    @status_window[2].refresh(actor) if
      @actor_msp != actor.maxsp or @actor_sp != actor.sp
    @status_window[3].refresh(actor, level_up_flags) if
      @actor_st != make_battler_state_text(actor, 120, true) or level_up_flags
    @actor_nm = actor.name
    @actor_mhp = actor.maxhp
    @actor_msp = actor.maxsp
    @actor_hp = actor.hp
    @actor_sp = actor.sp
    @actor_st = make_battler_state_text(actor, 120, true)
  end
  #--------------------------------------------------------------------------
  # * AT gauge refreshment
  #--------------------------------------------------------------------------
  def at_refresh
    @status_window[4].refresh($game_party.actors[@actor_num])
  end
  #--------------------------------------------------------------------------
  # * Frame Renewal
  #--------------------------------------------------------------------------
  def update
    for window in @status_window
      window.update
    end
  end
end

#==============================================================================
# ** Window_DetailsStatus
#------------------------------------------------------------------------------
# * It is the window which indicates the status of the actor in individually in
#   the battle picture.
#==============================================================================

class Window_DetailsStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(actor, id, x)
    @status_id = id
    super(x, 320 + id * 26, 160, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    self.back_opacity = 0
    refresh(actor, false)
  end


  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    super
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh(actor, level_up_flags = false)
    self.contents.clear
    case @status_id
    when 0
      draw_actor_name(actor, 4, 0)
    when 1
      draw_actor_hp(actor, 4, 0, 120)
    when 2
      draw_actor_sp(actor, 4, 0, 120)
    when 3
      if level_up_flags
        self.contents.font.color = normal_color
        self.contents.draw_text(4, 0, 120, 32, "LEVEL UP!")
      else
        draw_actor_state(actor, 4, 0)
      end
    when 4
      draw_actor_atg(actor, 4, 0, 120)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame renewal
  #--------------------------------------------------------------------------
  def update
    #At the time of main phase opacity is lowered a little
    if $game_temp.battle_main_phase
      self.contents_opacity -= 4 if self.contents_opacity > 191
    else
      self.contents_opacity += 4 if self.contents_opacity < 255
    end
  end
end

#==============================================================================
# ** Arrow_Base
#------------------------------------------------------------------------------
#  It is sprite for the arrow cursor indication which is used in the battle picture.
#  This class is used as superclass of Arrow_Enemy class and Arrow_Actor class.
#==============================================================================

class Arrow_Base < Sprite
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     viewport :viewport
  #--------------------------------------------------------------------------
  def initialize(viewport)
    super(viewport)
    self.bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
    self.ox = 16
    self.oy = 32
    self.z = 2500
    @blink_count = 0
    @index = 0
    @help_window = nil
    update
  end
end


#==============================================================================
# ** Arrow_Enemy
#------------------------------------------------------------------------------
#  It is arrow cursor in order to make the enemy select. 
#  This class succeeds Arrow_Base.
#==============================================================================

class Arrow_Enemy < Arrow_Base
  #--------------------------------------------------------------------------
  # * Frame renewal
  #--------------------------------------------------------------------------
  def update
    super
    # When it points to the enemy which does not exist, it throws
    $game_troop.enemies.size.times do
      break if self.enemy.exist?
      @index += 1
      @index %= $game_troop.enemies.size
    end
    # The cursor right
    if Input.repeat?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      $game_troop.enemies.size.times do
        @index += 1
        @index %= $game_troop.enemies.size
        break if self.enemy.exist?
      end
      $scene.camera = "select"
      zoom = 1 / self.enemy.zoom
      $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
                                      self.enemy.attack_y(zoom) * 0.75, zoom)
    end
    # The cursor left
    if Input.repeat?(Input::LEFT)
      $game_system.se_play($data_system.cursor_se)
      $game_troop.enemies.size.times do
        @index += $game_troop.enemies.size - 1
        @index %= $game_troop.enemies.size
        break if self.enemy.exist?
      end
      $scene.camera = "select"
      zoom = 1 / self.enemy.zoom
      $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
                                      self.enemy.attack_y(zoom) * 0.75, zoom)
    end
    # Setting the coordinate of sprite
    if self.enemy != nil
      self.x = self.enemy.screen_x
      self.y = self.enemy.screen_y
    end
  end
end
 
Part 9

Code:
#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
#  It is the interpreter which executes event command. This class is used inside 
#  the Game_System class and Game_Event class.
#==============================================================================

class Interpreter
  
  #--------------------------------------------------------------------------
  # * Replacement of actor
  #--------------------------------------------------------------------------
  def command_129
    # Acquiring the actor
    actor = $game_actors[@parameters[0]]
    # When the actor is valid
    if actor != nil
      # It diverges with operation
      if @parameters[1] == 0
        if @parameters[2] == 1
          $game_actors[@parameters[0]].setup(@parameters[0])
        end
        $game_party.add_actor(@parameters[0])
        if $game_temp.in_battle
          $game_actors[@parameters[0]].at = 0
          $game_actors[@parameters[0]].atp = 0
          $scene.spell_reset($game_actors[@parameters[0]])
          $game_actors[@parameters[0]].damage_pop = {}
          $game_actors[@parameters[0]].damage = {}
          $game_actors[@parameters[0]].damage_sp = {}
          $game_actors[@parameters[0]].critical = {}
          $game_actors[@parameters[0]].recover_hp = {}
          $game_actors[@parameters[0]].recover_sp = {}
          $game_actors[@parameters[0]].state_p = {}
          $game_actors[@parameters[0]].state_m = {}
          $game_actors[@parameters[0]].animation = []
        end
      else
        $game_party.remove_actor(@parameters[0])
      end
    end
    if $game_temp.in_battle
      $scene.status_window.update
    end
    # Continuation
    return true
  end



  #--------------------------------------------------------------------------
  # * The increase and decrease of HP
  #--------------------------------------------------------------------------
  alias :command_311_rtab :command_311
  def command_311
    command_311_rtab
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end
  #--------------------------------------------------------------------------
  # *The increase and decrease of SP
  #--------------------------------------------------------------------------
  alias :command_312_rtab :command_312
  def command_312
    command_312_rtab
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end
  
  #--------------------------------------------------------------------------
  # * Modification of state
  #--------------------------------------------------------------------------
  alias :command_313_rtab :command_313
  def command_313
    command_313_rtab
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end
  
  #--------------------------------------------------------------------------
  # * All recovery
  #--------------------------------------------------------------------------
  alias :command_314_rtab :command_314
  def command_314
    command_314_rtab
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end
  
  #--------------------------------------------------------------------------
  # * The increase and decrease of EXP
  #--------------------------------------------------------------------------
  alias :command_315_rtab :command_315
  def command_315
    command_315_rtab
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end

  #--------------------------------------------------------------------------
  # * Increase and decrease of level
  #--------------------------------------------------------------------------
  alias :command_316_rtab :command_316
  def command_316
    command_316_rtab
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end

  #--------------------------------------------------------------------------
  # * Increase and decrease of parameter
  #--------------------------------------------------------------------------
  alias :command_317_rtab :command_317
  def command_317
    command_317_rtab
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end

  #--------------------------------------------------------------------------
  # * Modification of equipment
  #--------------------------------------------------------------------------
  alias :command_319_rtab :command_319
  def command_319
    command_319_rtab
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end

  #--------------------------------------------------------------------------
  # * Name modification of actor
  #--------------------------------------------------------------------------
  alias :command_320_rtab :command_320
  def command_320
    command_320_rtab
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end

  #--------------------------------------------------------------------------
  # * Class modification of actor
  #--------------------------------------------------------------------------
  alias :command_321_rtab :command_321
  def command_321
    command_321_rtab
    if $game_temp.in_battle
      $scene.status_window.refresh
    end
  end

  #-------------------------------------------------------------------------- 
  # * Indication of animation
  #--------------------------------------------------------------------------
  def command_337
    # Process iteration
    iterate_battler(@parameters[0], @parameters[1]) do |battler|
      # When the battler exists
      if battler.exist?
      #  Setting animation ID
        battler.animation.push([@parameters[2], true])
      end 
    end 
    # continuous 
    return true 
  end 

  #-------------------------------------------------------------------------- 
  # - the processing 
  #-------------------------------------------------------------------------- 
  def command_338 
  # of the damage the value which is operated acquisition 
  value = operate_value(0, @parameters[2], @parameters[3])
  # Process iteration
  iterate_battler(@parameters[0], @parameters[1]) do |battler|
  # battler exists with 
    if battler.exist? 
      # HP modification 
      battler.hp -= value 
      # fighting 
        if $game_temp.in_battle 
          # damage setting 
          battler.damage["event"] = value
          battler.damage_pop["event"] = true
        end 
      end 
    end 
    if $game_temp.in_battle 
      $scene.status_window.refresh 
    end 
    # continuation 
  return true 
  end

  #--------------------------------------------------------------------------
  # * Forcing the action
  #--------------------------------------------------------------------------
  def command_339
    # If it is not in the midst of fighting, disregard
    unless $game_temp.in_battle
      return true
    end
    # If the number of turns 0 disregard
    if $game_temp.battle_turn == 0
      return true
    end
    # Processing (With convenient ones, there are no times when it becomes plural)
    iterate_battler(@parameters[0], @parameters[1]) do |battler|
      # When the battler exists,
      if battler.exist?
      # Setting action
        battler.current_action.force_kind = @parameters[2]
        if battler.current_action.force_kind == 0
          battler.current_action.force_basic = @parameters[3]
        else
          battler.current_action.force_skill_id = @parameters[3]
        end
        #  Setting the conduct object
        if @parameters[4] == -2
          if battler.is_a?(Game_Enemy)
            battler.current_action.decide_last_target_for_enemy
          else
            battler.current_action.decide_last_target_for_actor
          end
        elsif @parameters[4] == -1
          if battler.is_a?(Game_Enemy)
            battler.current_action.decide_random_target_for_enemy
          else
            battler.current_action.decide_random_target_for_actor
          end
        elsif @parameters[4] >= 0
          battler.current_action.target_index = @parameters[4]
        end
        # When action validity and [ directly execution ] is,
        if battler.current_action.valid? and @parameters[5] == 1
          # Setting the battler of the forced object
          $game_temp.forcing_battler = battler
          # The index is advanced
          @index += 1
          # end 
          return false
        elsif battler.current_action.valid? and @parameters[5] == 0
          battler.current_action.forcing = true
        end
      end
    end
  # continuation
    return true
  end
end




#==============================================================================
# * Sprite module 
#------------------------------------------------------------------------------
# This module manages and controls animation. 
#============================================================================== 
module RPG
  class Sprite < ::Sprite
    def initialize(viewport = nil)
      super(viewport)
      @_whiten_duration = 0
      @_appear_duration = 0
      @_escape_duration = 0
      @_collapse_duration = 0
      @_damage = []                 
      @_animation = []              
      @_animation_duration = 0
      @_blink = false
    end
    def damage(value, critical, type = 0)
      if value.is_a?(Numeric)
        damage_string = value.abs.to_s
      else
        damage_string = value.to_s
      end
      bitmap = Bitmap.new(160, 48)
      bitmap.font.name = "Arial Black"
      bitmap.font.size = 32
      bitmap.font.color.set(0, 0, 0)
      bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
      bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
      bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
      bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
      if value.is_a?(Numeric) and value < 0
        if type == 0
          bitmap.font.color.set(176, 255, 144)
        else
          bitmap.font.color.set(176, 144, 255)
        end
      else
        if type == 0
          bitmap.font.color.set(255, 255, 255)
        else
          bitmap.font.color.set(255, 176, 144)
        end
      end
      if type == 2
        bitmap.font.color.set(255, 224, 128)
      end
      bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
      if critical
        string = "CRITICAL"
        bitmap.font.size = 20
        bitmap.font.color.set(0, 0, 0)
        bitmap.draw_text(-1, -1, 160, 20, string, 1)
        bitmap.draw_text(+1, -1, 160, 20, string, 1)
        bitmap.draw_text(-1, +1, 160, 20, string, 1)
        bitmap.draw_text(+1, +1, 160, 20, string, 1)
        bitmap.font.color.set(255, 255, 255)
        bitmap.draw_text(0, 0, 160, 20, string, 1)
      end
      num = @_damage.size
      if type != 2
        @_damage.push([::Sprite.new, 40, 0, rand(40) - 20, rand(30) + 50])
      else
        @_damage.push([::Sprite.new, 40, 0, rand(20) - 10, rand(20) + 60])
      end
      @_damage[num][0].bitmap = bitmap
      @_damage[num][0].ox = 80 + self.viewport.ox
      @_damage[num][0].oy = 20 + self.viewport.oy
      if self.battler.is_a?(Game_Actor)
        @_damage[num][0].x = self.x
        @_damage[num][0].y = self.y - self.oy / 2
      else
        @_damage[num][0].x = self.x + self.viewport.rect.x -
                            self.ox + self.src_rect.width / 2
        @_damage[num][0].y = self.y - self.oy * self.zoom_y / 2 +
                            self.viewport.rect.y
        @_damage[num][0].zoom_x = self.zoom_x
        @_damage[num][0].zoom_y = self.zoom_y
        @_damage[num][0].z = 3000
      end
    end
    def animation(animation, hit)
      return if animation == nil
      num = @_animation.size
      @_animation.push([animation, hit, animation.frame_max, []])   
      bitmap = RPG::Cache.animation(animation.animation_name,
                                    animation.animation_hue)
      if @@_reference_count.include?(bitmap)
        @@_reference_count[bitmap] += 1
      else
        @@_reference_count[bitmap] = 1
      end
      if @_animation[num][0] != 3 or not @@_animations.include?(animation)
        for i in 0..15
          sprite = ::Sprite.new
          sprite.bitmap = bitmap
          sprite.visible = false
          @_animation[num][3].push(sprite)
        end
        unless @@_animations.include?(animation)
          @@_animations.push(animation)
        end
      end
      update_animation(@_animation[num])
    end
    def loop_animation(animation)
      return if animation == @_loop_animation
      dispose_loop_animation
      @_loop_animation = animation
      return if @_loop_animation == nil
      @_loop_animation_index = 0
      animation_name = @_loop_animation.animation_name
      animation_hue = @_loop_animation.animation_hue
      bitmap = RPG::Cache.animation(animation_name, animation_hue)
      if @@_reference_count.include?(bitmap)
        @@_reference_count[bitmap] += 1
      else
        @@_reference_count[bitmap] = 1
      end
      @_loop_animation_sprites = []
      for i in 0..15
        sprite = ::Sprite.new
        sprite.bitmap = bitmap
        sprite.visible = false
        @_loop_animation_sprites.push(sprite)
      end
      # update_loop_animation
    end
    def dispose_damage
      for damage in @_damage.reverse
        damage[0].bitmap.dispose
        damage[0].dispose
        @_damage.delete(damage)
      end
    end
    def dispose_animation
      for anime in @_animation.reverse
        sprite = anime[3][0]
        if sprite != nil
          @@_reference_count[sprite.bitmap] -= 1
          if @@_reference_count[sprite.bitmap] == 0
            sprite.bitmap.dispose
          end
        end
        for sprite in anime[3]
          sprite.dispose
        end
        @_animation.delete(anime)
      end
    end
    def effect?
      @_whiten_duration > 0 or
      @_appear_duration > 0 or
      @_escape_duration > 0 or
      @_collapse_duration > 0 or
      @_damage.size == 0 or
      @_animation.size == 0
    end
    def update
      super
      if @_whiten_duration > 0
        @_whiten_duration -= 1
        self.color.alpha = 128 - (16 - @_whiten_duration) * 10
      end
      if @_appear_duration > 0
        @_appear_duration -= 1
        self.opacity = (16 - @_appear_duration) * 16
      end
      if @_escape_duration > 0
        @_escape_duration -= 1
        self.opacity = 256 - (32 - @_escape_duration) * 10
      end
      if @_collapse_duration > 0
        @_collapse_duration -= 1
        self.opacity = 256 - (48 - @_collapse_duration) * 6
      end
      for damage in @_damage
        if damage[1] > 0
          damage[1] -= 1
          damage[4] -= 3
          damage[2] -= damage[4]
          if self.battler.is_a?(Game_Actor)
            damage[0].x = self.x + (40 - damage[1]) * damage[3] / 10
            damage[0].y = self.y - self.oy / 2 + damage[2] / 10
          else
            damage[0].x = self.x + self.viewport.rect.x -
                          self.ox + self.src_rect.width / 2 +
                          (40 - damage[1]) * damage[3] / 10
            damage[0].y = self.y - self.oy * self.zoom_y / 2 +
                          self.viewport.rect.y + damage[2] / 10
            damage[0].zoom_x = self.zoom_x
            damage[0].zoom_y = self.zoom_y
          end
          damage[0].z = 2960 + damage[1]
          damage[0].opacity = 256 - (12 - damage[1]) * 32
          if damage[1] == 0
            damage[0].bitmap.dispose
            damage[0].dispose
            @_damage.delete(damage)
          end
        end
      end
      for anime in @_animation
        if (Graphics.frame_count % 2 == 0)
          anime[2] -= 1
          update_animation(anime)
        end
      end
      if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
        update_loop_animation
        @_loop_animation_index += 1
        @_loop_animation_index %= @_loop_animation.frame_max
      end
      if @_blink
        @_blink_count = (@_blink_count + 1) % 32
        if @_blink_count < 16
          alpha = (16 - @_blink_count) * 6
        else
          alpha = (@_blink_count - 16) * 6
        end
        self.color.set(255, 255, 255, alpha)
      end
      @@_animations.clear
    end
    def update_animation(anime)
      if anime[2] > 0
        frame_index = anime[0].frame_max - anime[2]
        cell_data = anime[0].frames[frame_index].cell_data
        position = anime[0].position
        animation_set_sprites(anime[3], cell_data, position)
        for timing in anime[0].timings
          if timing.frame == frame_index
            animation_process_timing(timing, anime[1])
          end
        end
      else
        @@_reference_count[anime[3][0].bitmap] -= 1
        if @@_reference_count[anime[3][0].bitmap] == 0
            anime[3][0].bitmap.dispose
        end
        for sprite in anime[3]
          sprite.dispose
        end
        @_animation.delete(anime)
      end
    end
 
Part 10 -_-'

Code:
 def animation_set_sprites(sprites, cell_data, position)
      for i in 0..15
        sprite = sprites[i]
        pattern = cell_data[i, 0]
        if sprite == nil or pattern == nil or pattern == -1
          sprite.visible = false if sprite != nil
          next
        end
        sprite.visible = true
        sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
        if position == 3
          if self.viewport != nil
            sprite.x = self.viewport.rect.width / 2
            if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
              sprite.y = self.viewport.rect.height - 320
            else
              sprite.y = self.viewport.rect.height - 160
            end
          else
            sprite.x = 320
            sprite.y = 240
          end
        else
          sprite.x = self.x + self.viewport.rect.x -
                      self.ox + self.src_rect.width / 2
          if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
            sprite.y = self.y - self.oy * self.zoom_y / 2 +
                        self.viewport.rect.y
            if position == 0
              sprite.y -= self.src_rect.height * self.zoom_y / 4
            elsif position == 2
              sprite.y += self.src_rect.height * self.zoom_y / 4
            end
          else
            sprite.y = self.y + self.viewport.rect.y -
                        self.oy + self.src_rect.height / 2
            sprite.y -= self.src_rect.height / 4 if position == 0
            sprite.y += self.src_rect.height / 4 if position == 2
          end
        end
        sprite.x += cell_data[i, 1]
        sprite.y += cell_data[i, 2]
        sprite.z = 2000
        sprite.ox = 96
        sprite.oy = 96
        sprite.zoom_x = cell_data[i, 3] / 100.0
        sprite.zoom_y = cell_data[i, 3] / 100.0
        if position != 3
          sprite.zoom_x *= self.zoom_x
          sprite.zoom_y *= self.zoom_y
        end
        sprite.angle = cell_data[i, 4]
        sprite.mirror = (cell_data[i, 5] == 1)
        sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
        sprite.blend_type = cell_data[i, 7]
      end
    end
    def x=(x)
      sx = x - self.x
      if sx != 0
        for anime in @_animation
          if anime[3] != nil
            for i in 0..15
              anime[3][i].x += sx
            end
          end
        end
        if @_loop_animation_sprites != nil
          for i in 0..15
            @_loop_animation_sprites[i].x += sx
          end
        end
      end
      super
    end
    def y=(y)
      sy = y - self.y
      if sy != 0
        for anime in @_animation
          if anime[3] != nil
            for i in 0..15
              anime[3][i].y += sy
            end
          end
        end
        if @_loop_animation_sprites != nil
          for i in 0..15
            @_loop_animation_sprites[i].y += sy
          end
        end
      end
      super
    end
  end
end

#------------------------------------------------------------------------------
# New routine added to the Bitmap class. 
#============================================================================== 

class Bitmap
#-------------------------------------------------------------------------- 
# * Rectangle Gradation Indicator
#   color1: Start color 
#   color2: Ending color 
#   align: 0: On side gradation 
#          1: Vertically gradation 
#          2: The gradation (intense concerning slantedly heavily note) 
#-------------------------------------------------------------------------- 
  def gradation_rect(x, y, width, height, color1, color2, align = 0)
    if align == 0
      for i in x...x + width
        red   = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
        green = color1.green +
                (color2.green - color1.green) * (i - x) / (width - 1)
        blue  = color1.blue +
                (color2.blue - color1.blue) * (i - x) / (width - 1)
        alpha = color1.alpha +
                (color2.alpha - color1.alpha) * (i - x) / (width - 1)
        color = Color.new(red, green, blue, alpha)
        fill_rect(i, y, 1, height, color)
      end
    elsif align == 1
      for i in y...y + height
        red   = color1.red +
                (color2.red - color1.red) * (i - y) / (height - 1)
        green = color1.green +
                (color2.green - color1.green) * (i - y) / (height - 1)
        blue  = color1.blue +
                (color2.blue - color1.blue) * (i - y) / (height - 1)
        alpha = color1.alpha +
                (color2.alpha - color1.alpha) * (i - y) / (height - 1)
        color = Color.new(red, green, blue, alpha)
        fill_rect(x, i, width, 1, color)
      end
    elsif align == 2
      for i in x...x + width
        for j in y...y + height
          red   = color1.red + (color2.red - color1.red) *
                  ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
          green = color1.green + (color2.green - color1.green) *
                  ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
          blue  = color1.blue + (color2.blue - color1.blue) *
                  ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
          alpha = color1.alpha + (color2.alpha - color1.alpha) *
                  ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
          color = Color.new(red, green, blue, alpha)
          set_pixel(i, j, color)
        end
      end
    elsif align == 3
      for i in x...x + width
        for j in y...y + height
          red   = color1.red + (color2.red - color1.red) *
              ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
          green = color1.green + (color2.green - color1.green) *
              ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
          blue  = color1.blue + (color2.blue - color1.blue) *
              ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
          alpha = color1.alpha + (color2.alpha - color1.alpha) *
              ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
          color = Color.new(red, green, blue, alpha)
          set_pixel(i, j, color)
        end
      end
    end
  end
end

Yeah, this code didn't seem to fit in a single post so I had to split it. Sorry for the inconvenience. Annoyed me as much as it's probably annoying you.
 
Martinez":z720csn5 said:
change the positions to 10, instead of 11.
Now, when you say position, do you mean "Number of poses?"
Cause if thats the case, then a already tried this, brother.
Didn't work.
In fact, this only made my actor battlers clip as well as the enemy battler. o_O
Thanks anyway though.
The problem is not resolved yet so any help anyone can give me is appreciated.
 
under this line, up at the top.  look at your battlers. count how many frames they have and how many poses.
Most have 11, some have 10. all have 4 frames though.


    # * Configuration System *
   
    # Animation Frames and Animation Speed
    @speed              = 7      # Framerate speed of the battlers
    @frames            = 4      # Number of frames in each pose
    @poses              = 11    # Number of poses (stances) in the template

  As a matter of fact i know that the battler that is cutting up there, only has 10 poses :thumb:
 
Martinez":18jambyx said:
under this line, up at the top.  look at your battlers. count how many frames they have and how many poses.
Most have 11, some have 10. all have 4 frames though.



    # * Configuration System *
   
    # Animation Frames and Animation Speed
    @speed              = 7      # Framerate speed of the battlers
    @frames            = 4      # Number of frames in each pose
    @poses              = 11    # Number of poses (stances) in the template

  As a matter of fact i know that the battler that is cutting up there, only has 10 poses :thumb:

If I do that, then my actor battlers start clipping also. (Trust me, I tried)
Would adding an extra line of animation to the enemy battler help??
 
Martinez":3ozncozj said:
See, im trying to explain to you, you have different battlers,  the one your using in which has 10 poses instead of all the rest that have 11.
Which is why I asked if adding an extra line of poses to the enemy battler would help.

And it did, I tried it out, problem fixed. Thanks for the help.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top