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.

Script Fix

I get this problem when I try to fight a monster.
im using the FFVI SDK.
Script'Final Fantasy SDK'line 1459:NoMethodError occured.
undefined method 'allowed_attacks' for #<Game_Troop:0x3c14f18 @ enemies=[]>


heres the script:
HTML:
=begin
Index:
 (1.0)...Battle System 
 (1.1)......Sprite Configuration System
 (1.2)......Attack Types Package
Notes:
Almost every added script has been modified by me, Dargor, to fit this system.
Tools:
- Standard Development Kit v1.5 by Near Fantastica
- Method and Class Library V1.4 by Trickster
 
Credits and Thanks:
- Minkoff & DerVVulfman for "Animated Battlers - Enhanced"
- Trickster for "Bag Of Battle Commands","Bag Of Skill Effect", 
    "Advanced Targetting","Steal/Mug/Scan" and "Multi Attack" 
- XRXS for "Active Time Bar"
- Prexus for helping me with the damage algorithm
=end
#==============================================================================
# (1.0) Battle System
#==============================================================================
# ** Animated Battlers - Enhanced   ver. 4.5                       (09-28-2006)
#------------------------------------------------------------------------------
#  Animated Battlers by Minkoff
#  Enhancements by DerVVulfman                                
#  Low percentage and Status Poses 
#     Concept & Base coding by Twin Matrix
#  Stationary Enemies requested by jens009
#  Continuous Victory Looping for actors requested by Skyla Doragono
#  Actors readying themselves before battle requested by Clive
#  Default Battlers for Enemies requested for by WithViolence
#  Mixed Default and Spritesheet Battlers requested for by SteveE22
#  Hero & Enemy z.depth concept by Min-Chan and Caldaron ( totally redone :) )
#  Stationary Poses suggested by Twin Matrix
#  Critical Hit animation requested by Mimi-Chan
#  Both Enemy and Actor's individual Frames per Pose requested by creiz
#  
#==============================================================================
#
#   ADDITIONAL CALLS AVAILABLE PRIOR TO COMBAT:
#
#------------------------------------------------------------------------------
#  SIDEVIEW MIRROR:     This value switches  the positions  of both enemies and
#                       heroes to opposite ends of the screen.
#
#   Script : $game_system.sideview_mirror = [number]
#   number : a value indicating whether the hero & enemy positions are switched
#            0 = Default:  Enemies on the left, Heroes on the right
#            1 = Switched: Heroes on the left, Enemies on the right
#
#------------------------------------------------------------------------------
#  BATTLER FORMATIONS:  This value changes the way your heroes line up when the
#                       battle starts.
#
#   Script : $formation_style = [number]
#   number : a value indicating the type of formation your heroes will use
#            0 = Diagonal (Default)    4 = Diamond Pattern 1
#            1 = Diagonal Pattern 2    5 = Diamond Pattern 2
#            2 = Slanted Pattern 1     6 = Box Pattern 1
#            3 = Slanted Pattern 2     7 = Box Pattern 2
#
#            8 = Randomized (system will choose from 0 to 7)
#
#==============================================================================
 
 
# Things added since original version by Minkoff:
#   Can reverse the battler positions
#   Editable spritesheet layout in script
#   Able to define total/max frames per pose
#   Can define individual # of frames per each pose
#   Can use 'red-out' RTP death or 'battler death' pose
#   Can show battler falling before death.
#   'Casting' pose now available for RTAB/Skill Timing users
#   Can show battler celebrating before victory pose
#   Can tag battlers who's victory pose loops indefinitely
#   Can show actor battlers get ready before battle starts.
#   Separate poses for 'skills', 'items' or 'weapons' based on their id
#   Can allow the battlers to step forward before using items & skills (FFVII+)
#   Attacking battlers rush towards their targets while item & skill users don't
#   Certain weapons can force the battler NOT to move
#   Certain items & skills can force battlers to 'rush' the enemy
#   Certain skills or items can force movement to the center of the screen
#   Stationary enemies. In case enemies do NOT move when they attack.
#   Adjustable 'low health' checker. Set your low health to 25%... 30%... 10%...
#   Poses now available for status ailments
#   Dead revert to 'victory' pose bug fixed.
#   Default battlers now available for actors and/or enemies
#   Default battlers now usable by ID number (had to rewrite red-out for that)
#   Escaping Enemies bug found by SteveE22.  Fixed just as fast.
#   Hero Formations (total of 8 hardwired -& 1 random- ... add at your own risk)
#   Z-Depth for attack overlapping purposes
#   Corrected attack overlap offset routine.  Overlap now based on battler size
#   Certain skills and items can now prevent movement
#   Can allow battlers to take step forward before performing 'attack' pose.(FF)
#   Certain weapons can move battlers to center screen instead of a full move.
#   Escaping Enemies can now have a pose before disappearing (was a rush pose)
#   Redesigned Scene_Battle's movement routine
#   Added pose for Critical Hits
#   Added the enemy's hash for frame number based on poses
#   Added the actor's hash for frame number based on poses
#   Includes an Adaptation Switch for use with RTAB's Connected Attacking script
#   
#   35 counted.
 
#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
#  This sprite is used to display the battler.It observes the Game_Character
#  class and automatically changes sprite conditions.
#==============================================================================
 
class Sprite_Battler < RPG::Sprite
 
  attr_accessor :battler_offset         # Degree of action forcing  
  attr_accessor :skill_used             # Degree of action forcing  
  attr_accessor :item_used              # Degree of action forcing  
 
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  alias cbs_initialize initialize
  def initialize(viewport, battler = nil)
    #--------------------------------------------------------------------------
    # (1.1) Sprite Configuration System
    #--------------------------------------------------------------------------
    # * Default Battler Style Switches
    #--------------------------------------------------------------------------        
    $default_enemy = false              # If true, these switches allows the use
    $default_actor = false              # of default battlers for actors/enemies
    $default_enemy_id = []
    for i in 0...$data_enemies.size
      $default_enemy_id.push(i)         # Ids of enemies using default battlers
    end
    $default_actor_id = []              # Ids of actors using default battlers
    @default_collapse_actor   = false   # If true, restores the old 'red fade'
    @default_collapse_enemy   = true    #   collapse effect (using spritesheets)
 
 
    # * Animation Frames and Animation Speed
    #--------------------------------------------------------------------------    
    @speed              = 4      # Framerate speed of the battlers 
    @frames             = 4      # Number of frames in each pose
    @poses              = 16     # Number of poses (stances) in the template
    @frames_standard    = 4      # Standard # of frames played in each pose.
    @low_hp_percentage  = 0.25   # Determines health% of battler for WOOZY pose.
 
 
    # * Poses Control
    #--------------------------------------------------------------------------    
 
    # Editable Template (Some people wanted to change their template design)
    $p1   =   2   # Sets the 'Ready Pose'  
    $p2   =   4   # Sets the 'Struck Pose' 
    $p3   =   5   # Sets the 'Woozy Pose'  
    $p4   =   2   # Sets the 'Block Pose'  
    $p5   =   1   # Sets the 'Charge Pose' 
    $p6   =   0   # Sets the 'Retreat Pose'
    $p7   =   10   # Sets the 'Attack Pose' 
    $p8   =   7   # Sets the 'Item Pose'   
    $p9   =   9   # Sets the 'Skill Pose'  
    $p10  =   14  # Sets the 'Victory Pose'
    $p11  =   6   # Sets the 'Defeat Pose'
    # Non-Default Poses (can expand beyond the default 11 poses here)
    @poses_setup         = 3         # Choose animation pose for 'preparation'
    @poses_casting       = 8         # Set casting pose to 'Block' for example
    $poses_escaping      = nil         # Set 'coward' pose for fleeing monsters)    
    $poses_critical      = nil         # Set 'critical' hit pose for BIG hits.
    @poses_dying         = nil         # Choose animation pose for dying throws.
    @poses_winning       = 15         # Set winning dance to 'block' for examp.
    @poses_winning_loops = [1,2,3,4]   # Set victory non-freezing actor as #7
    # Non-Default Pose Hashes (poses dependant on .id values)
    @poses_status  = {3 => 2, 4 => 3}  # Default: #3(Venom)&#4(Dazzle) is 'Woozy'
    $poses_skills  = {57 => 6}         # Default: #57(Cross Cut) does 'Attack'
    $poses_items   = {13 => 3}         # Default: #13(Sharp Stone) does 'Block'
    $poses_weapons = {}                # Didn't set any weapons to any poses
 
 
    # * Frames Control
    #--------------------------------------------------------------------------    
    @frames_per_pose    = {
    0 => 4,
    1 => 4,
    2 => 1,
    3 => 1,
    4 => 4,
    5 => 1,
    6 => 1,
    7 => 1,
    8 => 2,
    9 => 4,
    10 => 2,
    11 => 2,
    12 => 4,
    13 => 4,
    14 => 4,
    15 => 4,
    }            # Set #of frames to pose(by index)
 
    # Advanced Individual Pose/Frame Hashes   # Advanced Individual Poses  uses
                                              # hashes within hashes. As a demo 
    $poses_actor = {7 => {0 => 3}}            # you can see that I didn't set a
    $poses_enemy = {1 => {0 => 1, 3 => 2}}    # hash for the enemies. This sys-
                                              # tem will allow for empty hashes 
    # fortunately. Now, as far as the heroes go, for the actor's hash, Actor #7
    # Gloria) has only 1 control hash.  It sets index pose '0' (the ready pose)
    # to use three frames of animation (even though I had set the ready pose to
    # just use '2' with the @frames_per_pose hash earlier.
 
 
    # Individual Battler Settings
    @mirror_enemies     = false    # Enemy battlers use reversed image
    @stationary_enemies = true     # 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            = false    # Characters fade in/out while attacking
 
 
    # * Movement Settings (Step-Forward / Final Fantasy-Style)
    #--------------------------------------------------------------------------    
    $rush_offset        = 0        # How much additional space between battlers
    $rush_attack        = true    # If true, battler steps forward to attack
    $rush_skill         = true     # If true, battler steps forward to use skill
    $rush_item          = true     # If true, battler steps forward to use item
 
 
    # * Movement Arrays (Arrays for skill/weapon/item IDs that affect movement)
    #--------------------------------------------------------------------------    
    $moving_item_atk    = [1]      # Examples are items that need to be applied.
    $moving_skill_atk   = [57]     # Examples are martial-arts and sneak attacks
    $move2center_atk    = []       # Moves battler to center based on weapon id!
    $move2center_item   = [3]      # Moves battler to center for a big item atk!
    $move2center_skill  = [50]     # Moves battler to center for a big skill atk!
 
 
    # * Stationary Arrays (Arrays for skill/weapon/item IDs that halt movement)
    #--------------------------------------------------------------------------    
    # Array that holds the id # of skills, items or weapons that affect movement
    $stationary_enemyid = [9]      # Enemies that don't RUN during melee attacks
    @stationary_weapons = [17,18,19,20,21,22,23,24] # (examples are bows & guns)
    @stationary_skills  = [95]     # (examples are bows & guns)
    @stationary_items   = [2]      # (examples are bows & guns)
 
 
    # Adaptation Switches
    $RTAB_Connected_Attacking = false    # Needed to be on if RTAB and Con. Attk.
 
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
    # DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING
    @frame, @pose = 0, 0
    @last_time = 0
    @last_move_time = 0
    @battler_offset = 0
    @skill_used = 0
    @item_used = 0
    $casted = false
    $casting = false
    @dying   = true
    @s_pose  = false
    $victory = false
    @winning = true
    cbs_initialize(viewport, battler)
    viewport.z = 99
    $formation = 0#$formation_style
    # if Formation is random
    if $formation == 8 then
      $formation = rand(8).to_i
    end
  end
 
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  alias cbs_update update
  def update
    return unless @battler
    # Regular Update
    cbs_update
    # Reset hash for Advanced Pose/Frames
    pose_temp = {}
    # Start Routine
    unless @started
      @pose = state
 
      if @battler.is_a?(Game_Enemy)
        if not $default_enemy
          if $default_enemy_id == nil
            # Set up Spritesheet Standards  
            @width = @width / @frames
            @height = @height / @poses
          else
            if not $default_enemy_id.include?(@battler.id)
              @width = @width / @frames
              @height = @height / @poses
            end
          end
        end
      end
 
      if @battler.is_a?(Game_Actor)
        if not $default_actor
          if $default_actor_id == nil
            # Set up Spritesheet Standards  
            @width = @width / @frames
            @height = @height / @poses
          else
            if not $default_actor_id.include?(@battler.id)
              @width = @width / @frames
              @height = @height / @poses
            end
          end
        end
      end
 
      @battler_offset = @width * 0.75
 
      @display_x = @battler.screen_x
      @display_y = @battler.screen_y
      @display_z = @battler.screen_z
      @destination_x = @display_x
      @destination_y = @display_y
      @destination_z = @display_z
      self.opacity = 0
      @started = true
    end
 
    # Cut Out Frame
    # Enemy Battler Routine
    if @battler.is_a?(Game_Enemy)
      if $default_enemy
        self.src_rect.set(@width * 0, @height * 0, @width, @height)
      else
        if $default_enemy_id !=nil
          if $default_enemy_id.include?(@battler.id)
            self.src_rect.set(@width * 0, @height * 0, @width, @height)
          else
            self.src_rect.set(@width * @frame, @height * @pose, @width, @height)
          end
        else
          self.src_rect.set(@width * @frame, @height * @pose, @width, @height)
        end
      end
    end
 
    # Actor Battler Routine
    if @battler.is_a?(Game_Actor)
      if $default_actor
        self.src_rect.set(@width * 0, @height * 0, @width, @height)
      else
        if $default_actor_id !=nil
          if $default_actor_id.include?(@battler.id)
            self.src_rect.set(@width * 0, @height * 0, @width, @height)
          else
            self.src_rect.set(@width * @frame, @height * @pose, @width, @height)
          end
        else
          self.src_rect.set(@width * @frame, @height * @pose, @width, @height)
        end
      end
    end
 
    # Position Sprite
    self.x = @display_x
    self.y = @display_y
    self.z = @display_z
    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 Frames per Pose
    poseframe = @frames_standard
    poseframe = @frames_per_pose[@pose] if @frames_per_pose.include?(@pose)
    # Set Advanced Poses for Actors
    if @battler.is_a?(Game_Actor)
      pose_temp = $poses_actor[@battler.id] if $poses_actor.include?(@battler.id)
      poseframe = pose_temp[@pose] if pose_temp.include?(@pose)
    end    
    # Set Advanced Poses for Enemies
    if @battler.is_a?(Game_Enemy)
      pose_temp = $poses_enemy[@battler.id] if $poses_enemy.include?(@battler.id)
      poseframe = pose_temp[@pose] if pose_temp.include?(@pose)
    end
 
    # Setup Animation
    time = Graphics.frame_count / (Graphics.frame_rate / @speed)
    if @last_time < time
      @frame = (@frame + 1) % poseframe
      if @frame == 0
        if @freeze
          @frame = poseframe - 1
          return
        end
        @pose = state
      end
    end
    @last_time = time
    # Setup Dying Animation
    if @battler.dead?
      if @dying == true
        @pose = state
        @dying = false
      end
    else
      if @battler.is_a?(Game_Actor)
        if @poses_setup != nil
          if @s_pose == false
            @pose = @poses_setup
            @s_pose = true
          end
        end
        if $victory == true
          if @winning == true
            @pose = state
            @winning = false
          end
        end
      end
    end
 
    # 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 * @low_hp_percentage
      # Battler Status-Effect
      for i in @battler.states
        @state = @poses_status[i] if @poses_status.include?(i)
      end
      # If Battler Dead
      if @battler.dead? 
        # If using default battlers or default collapse
        if (@default_collapse_actor and @battler.is_a?(Game_Actor)) or
          (@default_collapse_enemy and @battler.is_a?(Game_Enemy)) or
          ($default_actor and @battler.is_a?(Game_Actor)) or
          ($default_enemy and @battler.is_a?(Game_Enemy)) or
          ($default_enemy_id.include?(@battler.id) and @battler.is_a?(Game_Enemy)) or
          ($default_actor_id.include?(@battler.id) and @battler.is_a?(Game_Actor))
          # Do absolutely nothing :)
        else
          # Use Poses system
          if @poses_dying != nil
            if @dying == true
              @state = @poses_dying
            else
              @state = $p11
            end
          else
            @state = $p11
          end
          # Fix Opacity
          self.opacity = 255      
        end
      end
    end
 
    # Casting State
    if $casted
      if @battler.rtp != 0
        if @poses_casting != nil
        @state = @poses_casting
        end
      end
    end
 
    # Victory State
    if @battler.is_a?(Game_Actor)
      if $victory
        if @poses_winning != nil
          if @winning == true
            if not @battler.dead?
              @state = @poses_winning
            end
          else
            if not @battler.dead?
            @state = $p10
              if not @poses_winning_loops.include?(@battler.id)
                @freeze = true
              end
            end
          end
        else
          if not @battler.dead?
            @state = $p10
            if not @poses_winning_loops.include?(@battler.id)
              @freeze = true
            end
          end
        end        
      end
    end
 
 
    # Guarding State
    if not @battler.dead?
      @state = $p4 if @battler.guarding?
    end
    # 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
      difference_z = (@display_z - @destination_z).abs
      # Done? Reset, Stop
      if [difference_x, difference_y].max.between?(0, 8)
        @display_x = @destination_x
        @display_y = @destination_y
        @display_z = @destination_z
        @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
      increment_z = increment_y
 
      # 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
        increment_z *= speed
      end
 
      # Multiply and Move
      multiplier_x = (@destination_x - @display_x > 0 ? 8 : -8)
      multiplier_y = (@destination_y - @display_y > 0 ? 8 : -8)
      multiplier_z = (@destination_z - @display_z > 0 ? 8 : -8)
      @display_x += (increment_x * multiplier_x).to_i
      @display_y += (increment_y * multiplier_y).to_i
      @display_z += (increment_z * multiplier_z).to_i
    end
    @last_move_time = time
  end
 
  #--------------------------------------------------------------------------
  # * Set Movement
  #--------------------------------------------------------------------------
  def setmove(destination_x, destination_y, destination_z)
    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) or
             @stationary_skills.include?(@skill_used) or
             @stationary_items.include?(@item_used)
        @original_x = @display_x
        @original_y = @display_y
        @original_z = @display_z          
        @destination_x = destination_x
        @destination_y = destination_y
        @destination_z = destination_z
      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_enemy
      cbs_collapse if @battler.is_a?(Game_Enemy)
    end
    if @default_collapse_actor
      cbs_collapse if @battler.is_a?(Game_Actor)
    end
    if $default_enemy
      cbs_collapse if @battler.is_a?(Game_Enemy)
    end
    if $default_actor
      cbs_collapse if @battler.is_a?(Game_Actor)
    end
    if $default_enemy_id != nil
      if $default_enemy_id.include?(@battler.id)
        cbs_collapse if @battler.is_a?(Game_Enemy)
      end
    end
    if $defend_actor.id != nil
      if $default_actor_id.include?(@battler.id)
        cbs_collapse if @battler.is_a?(Game_Actor)
      end    
    end
  end
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   :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
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
 
class Game_Actor
  #--------------------------------------------------------------------------
  # * Get EXP String
  #--------------------------------------------------------------------------
  def exp_s
    return @exp_list[@level+1] > 0 ? @exp.to_s : @exp.to_s
  end
  #--------------------------------------------------------------------------
  # * Get Next Level EXP String
  #--------------------------------------------------------------------------
  def next_exp_s
    return @exp_list[@level+1] > 0 ? @exp_list[@level+1].to_s : "0"#"-------"
  end
  #--------------------------------------------------------------------------
  # * Get Until Next Level EXP String
  #--------------------------------------------------------------------------
  def next_rest_exp_s
    return @exp_list[@level+1] > 0 ?
      (@exp_list[@level+1] - @exp).to_s : "0"#"-------"
  end
  #--------------------------------------------------------------------------
  # * Actor X Coordinate
  #--------------------------------------------------------------------------
  def screen_x
    if self.index != nil
      case $formation
      when 0                                    # DIAGONAL PATTERN 1
        if $game_system.sideview_mirror == 1
          return self.index * -10 + 115#45 + 202        
        elsif $game_system.sideview_mirror == 0
          return self.index * 10 + 525#45 + 450
        elsif $game_system.sideview_mirror == 2
          return 300
        elsif $game_system.sideview_mirror == 3
          case self.index
          when 0,2
            return self.index * -10 + 115
          else
            return self.index * 10 + 525
          end 
        end          
      when 1                                    # DIAGONAL PATTERN 2   
        if $game_system.sideview_mirror == 1
          return self.index * 45 + 64        
        else
          return self.index * -45 + 576
        end        
      when 2                                    # SLANTED BLOCK 1   
        if $game_system.sideview_mirror == 1
          if self.index < 2
            return self.index + 155 + (45 * self.index)
          else
            return self.index + (45 * self.index) - 25
          end
        else
          if self.index < 2
            return self.index + 486 + (-45 * self.index)
          else
            return self.index + 661 + (-45 * self.index)
          end
        end
      when 3                                    # SLANTED BLOCK 2        
        if $game_system.sideview_mirror == 1
          if self.index < 2
            return self.index + 175 + (-45 * self.index) 
          else
            return self.index  + 202 + (-45 * self.index)
          end        
        else
          if self.index < 2
            return self.index + 442 + (45 * self.index) 
          else
            return self.index  + 430 + (45 * self.index)
          end        
        end
      when 4                                    # DIAMOND BLOCK 1       
        if $game_system.sideview_mirror == 1
          if self.index < 2
            return self.index + 170 + (-55 * self.index) 
          else
            return self.index  + 225 + (-55 * self.index)
          end        
        else
          if self.index < 2
            return self.index + 470 + (55 * self.index) 
          else
            return self.index  + 410 + (55 * self.index)
          end        
        end
      when 5                                    # DIAMOND BLOCK 2      
        if $game_system.sideview_mirror == 1
          if self.index < 2
            return self.index + 170 + (-55 * self.index) 
          else
            return self.index  + 225 + (-55 * self.index)
          end        
        else
          if self.index < 2
            return self.index + 470 + (55 * self.index) 
          else
            return self.index  + 410 + (55 * self.index)
          end        
        end
      when 6                                    # BASE BLOCK 1  
        if $game_system.sideview_mirror == 1
          if self.index < 2
            return self.index + 185
          else
            return self.index  + 75
          end        
        else
          if self.index < 2
            return self.index + 470
          else
            return self.index  + 550
          end        
        end
      else                                      # BASE BLOCK 2       
        if $game_system.sideview_mirror == 1
          if self.index < 2
            return self.index + 185
          else
            return self.index  + 75
          end        
        else
          if self.index < 2
            return self.index + 470
          else
            return self.index  + 550
          end        
        end
      end
    else
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # * Actor Y Coordinate
  #--------------------------------------------------------------------------
  def screen_y
    if self.index != nil
      case $formation
      when 0
        if $game_system.sideview_mirror == 3
          case self.index
          when 0,2
            return (self.index+1) * 35 + 200
          else
            return self.index * 35 + 200
          end
        else
          return self.index * 35 + 200
        end
      when 1
        return self.index * 40 + 184#35 + 200
      when 2
        if self.index < 2
          return self.index + 240 + (70 * self.index)
        else
          return self.index + 60 + (70 * self.index)
        end        
      when 3
        if self.index < 2
          return self.index + 240 + (70 * self.index)
        else
          return self.index + 60 + (70 * self.index)
        end
      when 4
        if self.index < 2
          return self.index + 270 + (50 * self.index)
        else
          return self.index + 120 + (50 * self.index)
        end
      when 5
        if self.index < 2
          return self.index + 270 + (-50 * self.index)
        else
          return self.index + 420 + (-50 * self.index)
        end
      when 6
        if self.index < 2
          return self.index + 220 + (90 * self.index)
        else
          return self.index + 40 + (90 * self.index)
        end  
      else
        if self.index < 2
          return self.index + 310 + (-90 * self.index)
        else
          return self.index + 490 + (-90 * self.index)
        end  
      end
    end
  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
      elsif $game_system.sideview_mirror == 0 or $game_system.sideview_mirror == 4
        return $data_troops[@troop_id].members[@member_index].x
      elsif $game_system.sideview_mirror == 2
        right_side = 640 - $data_troops[@troop_id].members[@member_index].x
        left_side = $data_troops[@troop_id].members[@member_index].x
        if (160 + $data_troops[@troop_id].members[@member_index].x) >= 320
          return right_side
        else
          return left_side
        end
      elsif $game_system.sideview_mirror == 3
        return 160 + $data_troops[@troop_id].members[@member_index].x
      end
    end
  end
end  
 
 
#==============================================================================
# ** Scene_Battle 
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================
 
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, plus_id = 0)
    @rtab = !@target_battlers
    if $RTAB_Connected_Attacking
      make_skill_action_result_anim(battler, plus_id)
    else
      @rtab ? make_skill_action_result_anim(battler) : make_skill_action_result_anim
    end
    @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
 
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 1 : action preparation) (Casting Routine)
  #--------------------------------------------------------------------------
  alias update_phase4_step1_anim update_phase4_step1
  def update_phase4_step1(battler = @active_battler) 
    @rtab = !@target_battlers
    if $rtab_detected == true
      update_phase4_step1_anim(battler)
      if battler.current_action.kind == 1 and
        (not battler.current_action.forcing or @force != 2)
        if battler.rtp != 0    
          $casted = true
        end
      end
    else
      update_phase4_step1_anim
    end
  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]
 
    # If enemy is a default battler
    if battler.is_a?(Game_Enemy)
      if $default_enemy
        if @rtab then battler.white_flash = true end
        if @rtab then battler.wait = 10 end
      end
      if $default_enemy_id != nil
        if $default_enemy_id.include?(@battler.id)
          if @rtab then battler.white_flash = true end
          if @rtab then battler.wait = 10 end
        end 
      end        
    end
    # If actor is a default battler
    if battler.is_a?(Game_Actor)
      if $default_actor
        if @rtab then battler.white_flash = true end
        if @rtab then battler.wait = 10 end
      end
      if $default_actor_id != nil
        if $default_actor_id.include?(@battler.id)
          if @rtab then battler.white_flash = true end
          if @rtab then battler.wait = 10 end
        end 
      end                
    end
 
    # Set values and poses based on Action
    case battler.current_action.kind
    when 0  # Attack
      rush_type = $rush_attack
      full_moving = true ; if rush_type; full_moving = false; end
      if $move2center_atk.include?(battler.weapon_id); center_move=true ; end
      if $stationary_enemyid.include?(battler.id) and battler.is_a?(Game_Enemy)
        full_moving = false
        center_move = false
        rush_type = false
      end
      if battler.current_action.basic == 2
        # If escaping, disable all movement
        full_moving = false
        center_move = false
        rush_type = false        
      end
      base_pose = $p7
      base_pose = $poses_weapons[battler.weapon_id] if $poses_weapons.include?(battler.weapon_id)      
      if battler.current_action.basic == 2
        base_pose = $poses_escaping if $poses_escaping != nil
      end
 
    when 1  # Skill
      rush_type = $rush_skill
      if $moving_skill_atk.include?(@skill_used) ; full_moving = true ; end
      if $move2center_skill.include?(@skill_used) ; center_move = true ; end        
      base_pose = $p9
      base_pose = $poses_skills[@skill_used] if $poses_skills.include?(@skill_used)
    when 2  # Item
      rush_type = $rush_item
      if $moving_item_atk.include?(@item_used) or @item_scope == 1..2 ; full_moving = true ; end
      if $move2center_item.include?(@item_used); center_move = true; end
      base_pose = $p8
      base_pose = $poses_items[@item_used] if $poses_items.include?(@item_used)
    end
 
    # Control Movement and use current pose
    @moved = {} unless @moved
    return if @spriteset.battler(battler).moving
    if not (@moved[battler] or battler.guarding?)
      offset = offset_value(battler)
      offset = 0 if offset == nil
      if rush_type        # Steps forward
        @spriteset.battler(battler).setmove(battler.screen_x - offset, battler.screen_y + 1, battler.screen_z)
      end
      if full_moving      # Runs to target
        @spriteset.battler(battler).setmove(target.screen_x + offset, target.screen_y - 1, target.screen_z + 10)
      end
      if center_move      # Runs to center
        @spriteset.battler(battler).setmove(320+(offset/4), battler.screen_y-1, battler.screen_z)
      end
      @moved[battler] = true
      return
      @spriteset.battler(battler).pose = base_pose
    elsif not battler.guarding?
      @spriteset.battler(battler).pose = base_pose
      @spriteset.battler(battler).setmove(battler.screen_x, battler.screen_y, battler.screen_z)
    end
 
    # Finish Up Skill and Item Use
    case battler.current_action.kind
    when 1
      # Flag system that skill was used
      $casted = false
      $casting = false
      @spriteset.battler(battler).skill_used = 0
    when 2
      # Flag system that item was used
      @spriteset.battler(battler).item_used = 0
    end
 
    # Done
    @moved[battler] = false
    @rtab ? cbs_update_phase4_step3(battler) : cbs_update_phase4_step3
  end
  #--------------------------------------------------------------------------
  # * Offset Calculation
  #--------------------------------------------------------------------------
  def offset_value(battler = @active_battler)
    offst = @spriteset.battler(battler).battler_offset
    offst += $rush_offset
    for target in (@rtab ? battler.target : @target_battlers)
      if battler.is_a?(Game_Actor) and target.is_a?(Game_Actor)
        battler_x = @spriteset.actor_sprites[battler.index].x
        target_x = @spriteset.actor_sprites[target.index].x
      elsif battler.is_a?(Game_Actor) and target.is_a?(Game_Enemy)
        battler_x = @spriteset.actor_sprites[battler.index].x
        target_x = @spriteset.enemy_sprites[target.index].x
      elsif battler.is_a?(Game_Enemy) and target.is_a?(Game_Enemy)
        battler_x = @spriteset.enemy_sprites[battler.index].x
        target_x = @spriteset.enemy_sprites[target.index].x
      elsif battler.is_a?(Game_Enemy) and target.is_a?(Game_Actor)
        battler_x = @spriteset.enemy_sprites[battler.index].x
        target_x = @spriteset.actor_sprites[target.index].x
      end  
      if $game_system.sideview_mirror == 1
         offset = (battler.is_a?(Game_Actor) ? -(offst) : offst)
      elsif $game_system.sideview_mirror == 0
        offset = (battler.is_a?(Game_Actor) ? offst : -(offst))
      elsif $game_system.sideview_mirror == 2
        if target_x >= 320
          offset = -offst #(battler.is_a?(Game_Actor) ? -(offst) : offst)
        elsif target_x < 320
          offset = offst #(battler.is_a?(Game_Actor) ? offst : -(offst))
        end
      elsif $game_system.sideview_mirror == 3
        if battler_x > target_x
          offset = (battler.is_a?(Game_Actor) ? -(offst) : offst)
        else
          offset = (battler.is_a?(Game_Actor) ? offst : -(offst))
        end
      else
        offset = 0
      end
    end
    return offset
  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)
       #DOMIRROR
      if battler.is_a?(Game_Enemy) and target.is_a?(Game_Enemy)
        battler_x = @spriteset.enemy_sprites[battler.index].x
        target_x = @spriteset.enemy_sprites[target.index].x
        battler_mirror = @spriteset.enemy_sprites[battler.index].mirror
        target_mirror = @spriteset.enemy_sprites[target.index].mirror
        if battler_x > target_x and battler_mirror != target_mirror 
          @spriteset.enemy_sprites[battler.index].mirror = @spriteset.enemy_sprites[target.index].mirror
        elsif battler_x < target_x and battler_mirror != target_mirror 
          @spriteset.enemy_sprites[battler.index].mirror = @spriteset.enemy_sprites[target.index].mirror
        end
      end
      if battler.is_a?(Game_Enemy) and target.is_a?(Game_Actor)
        battler_x = @spriteset.enemy_sprites[battler.index].x
        target_x = @spriteset.actor_sprites[target.index].x
        battler_mirror = @spriteset.enemy_sprites[battler.index].mirror
        target_mirror = @spriteset.actor_sprites[target.index].mirror
        if battler_x > target_x and battler_mirror != target_mirror 
          @spriteset.enemy_sprites[battler.index].mirror = @spriteset.actor_sprites[target.index].mirror
        elsif battler_x < target_x and battler_mirror != target_mirror 
          @spriteset.enemy_sprites[battler.index].mirror = @spriteset.actor_sprites[target.index].mirror
        end
      end
      damage = (@rtab ? target.damage[battler] : target.damage)
      critical = (@rtab ? target.critical[battler] : target.critical)
      if damage.is_a?(Numeric) and damage > 0
        @spriteset.battler(target).pose = $p2
        if critical == true
         @spriteset.battler(target).pose = $poses_critical if $poses_critical != nil
        end
      end
    end
    @rtab ? cbs_update_phase4_step4(battler) : cbs_update_phase4_step4
  end
  #--------------------------------------------------------------------------
  # * Victory Animation
  #--------------------------------------------------------------------------
  alias cbs_start_phase5 start_phase5
  def start_phase5
     # Shift to phase 5
    @phase = 5
    # Play battle end ME
    $game_system.me_play($game_system.battle_end_me)
    # Return to BGM before battle started
    $game_system.bgm_play($game_temp.map_bgm)
    for actor in $game_party.actors
      return if @spriteset.battler(actor).moving
    end
    for actor in $game_party.actors
      unless actor.dead?
        $victory = true
      end
    end
    cbs_start_phase5
  end
end
 
#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
#  This class brings together battle screen sprites. It's used within
#  the Scene_Battle class.
#==============================================================================
 
class Spriteset_Battle
  #--------------------------------------------------------------------------
  # * Change Enemy Viewport
  #--------------------------------------------------------------------------
  alias cbs_initialize initialize
  def initialize
    cbs_initialize
    if @real_zoom != nil
      $rtab_detected = true
    end
    @enemy_sprites = []
    for enemy in $game_troop.enemies.reverse
      sprite = Sprite_Battler.new(@viewport2, enemy)
      @enemy_sprites.push(sprite)
    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
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  alias mirror_update update
  def update
    mirror_update
    # Update actor sprite contents (corresponds with actor switching)
    if $game_system.sideview_mirror == 2
      @actor_sprites[1].mirror = true
      @actor_sprites[3].mirror = true
      for i in 0...7
        unless @enemy_sprites[i] == nil
          @enemy_sprites[i].mirror = true if @enemy_sprites[i].x >= 320
        end
      end
    elsif $game_system.sideview_mirror == 3
      @actor_sprites[0].mirror = true
      @actor_sprites[2].mirror = true
      for i in 0...7
        unless @enemy_sprites[i] == nil
            @enemy_sprites[i].mirror = true if @enemy_sprites[i].x <= 320
        end
      end
    end
  end
end
 
class Scene_Battle
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  alias ff6_battle_main main
  def main
    #  Check which attack type will be chosen
    $game_system.sideview_mirror = $game_system.check_attack_types($game_temp.battle_troop_id)
    $show = true
    @enemy_window = Window_Enemy.new
    ff6_battle_main
    @enemy_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias message_stop_cp_update update
  def update
    @enemy_window.refresh
    @spriteset.update
    message_stop_cp_update
    # If message window is showing
    if $game_temp.message_window_showing
      # If not in a preemptive strike
      if $game_system.preemptive? != true
        @cp_thread.stop = true
        return
      end
    end
    if @phase == 1 
      @cp_thread.stop = true
    end
    if @phase == 3 or @phase == 4 and @cp_thread..stop = false
      @status_window.refresh_cp
    end
    if @show
      @help_window.visible = true
      case $game_system.sideview_mirror
      when 0
        if $game_system.preemptive?
          @help_window.set_text("Preemptive Attack!")
        end
      when 1
        @help_window.set_text("Back Attack!")
      when 2
        @help_window.set_text("Pincer Attack!")
      when 0
        if $game_system.preemptive?
          @help_window.set_text("Preemptive Attack!")
        else
          @help_window.set_text("Side Attack!")
        end
      end
      for i in 0...300
        if i == 300
          @help_window.visible = false
          @show = false
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Make Basic Action Results - Attack
  #--------------------------------------------------------------------------
  def make_basic_action_result_attack
    # Set anaimation ID
    @animation1_id = @active_battler.animation1_id
    @animation2_id = @active_battler.animation2_id
    # If action battler is enemy
    if @active_battler.is_a?(Game_Enemy)
      if @active_battler.restriction == 3
        target = $game_troop.random_target_enemy
      elsif @active_battler.restriction == 2
        target = $game_party.random_target_actor
      else
        index = @active_battler.current_action.target_index
        target = $game_party.smooth_target_actor(index)
      end
    end
    # If action battler is actor
    if @active_battler.is_a?(Game_Actor)
      if @active_battler.restriction == 3
        target = $game_party.random_target_actor
      elsif @active_battler.restriction == 2
        target = $game_troop.random_target_enemy
      else
        index = @active_battler.current_action.target_index
        target = $game_troop.smooth_target_enemy(index)
      end
    end
    # Set array of targeted battlers
    @target_battlers = [target]
    # Apply normal attack results
    for target in @target_battlers
      target.damage_effect(@active_battler)
    end
  end
  #--------------------------------------------------------------------------
  # * Make Skill Action Results
  #--------------------------------------------------------------------------
  def make_skill_action_result
    # Get skill
    @skill = $data_skills[@active_battler.current_action.skill_id]
    # If not a forcing action
    unless @active_battler.current_action.forcing
      # If unable to use due to SP running out
      unless @active_battler.skill_can_use?(@skill.id)
        # Clear battler being forced into action
        $game_temp.forcing_battler = nil
        # Shift to step 1
        @phase4_step = 1
        return
      end
    end
    # Use up SP
    @active_battler.sp -= @skill.sp_cost
    # Refresh status window
    @status_window.refresh
    # Show skill name on help window
    @help_window.set_text(@skill.name, 1)
    # Set animation ID
    @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    # Set command event ID
    @common_event_id = @skill.common_event_id
    # Set target battlers
    set_target_battlers(@skill.scope)
    # Apply skill effect
    for target in @target_battlers
      target.damage_effect(@active_battler, @skill)
    end
  end
end
 
#==============================================================================
# ** Arrow_Base
#------------------------------------------------------------------------------
#  This sprite is used as an arrow cursor for the battle screen. This class
#  is used as a superclass for the Arrow_Enemy and Arrow_Actor classes.
#==============================================================================
 
class Arrow_Base < Sprite
  #--------------------------------------------------------------------------
  # * Reposition Arrows
  #--------------------------------------------------------------------------
  alias cbs_initialize initialize
  def initialize(viewport)
    cbs_initialize(viewport)
    self.ox = 14 + 130
    self.oy = 10
  end
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.
#==============================================================================
# (1.2) Attack Types Package
#------------------------------------------------------------------------------
#
#==============================================================================
 
class Game_System
  attr_accessor :preemptive
  alias ff6_attack_types_initialize initialize
  def initialize
    ff6_attack_types_initialize
    @preemptive = false
  end
  #--------------------------------------------------------------------------
  # * Check attack tyoes
  #--------------------------------------------------------------------------
  def check_attack_types(troop_id)
    case $game_troop.allowed_attacks(troop_id)
    # If all types allowed:
    when 1
      @value = rand(255)
      if @value <= 208
        return 0
      elsif @value > 208 and @value <= 216
        return 1
      elsif @value > 216 and @value <= 224
        return 2
      elsif @value > 224 and @value <= 255
        return 3
       end
    # If normal, back, and pincer allowed:
    when 2
      @value = rand(28)
      if @value < 26
        return 0
      elsif @value == 27
        return 1
      elsif @value == 28
        return 2
      end
    # If normal, back, and side allowed:
    when 3
      @value = rand(247)
      if @value <= 208
        return 0
      elsif @value > 208 and @value <= 216
        return 1
      elsif @value > 216 and @value <= 247
        return 3
      end
    # If normal, and back allowed:
    when 4
      @value = rand(27)
      if @value <= 26
        return 0
      elsif @value == 1
        return 1
      end
    # If normal, pincer, and side allowed:
    when 5
      @value = rand(247)
      if @value <= 208
        return 0
        premptive?
      elsif @value > 208 and @value <= 216
        return 2
      elsif @value > 216 and @value <= 247
        return 3
      end
    # If normal, and pincer allowed:
    when 6
      @value = rand(27)
      if @value == 26
        return 0
      elsif @value == 1
        return 2
      end
    # If normal and side allowed:
    when 7
      @value = rand(239)
      if @value <= 208
        return 0
      elsif @value > 208 and @value <= 239
        return 3
      end
    # If back, pincer, and side allowed:
    when 8
      @value = rand(47)
      if @value <= 8
        return 1
      elsif @value > 8 and @value <= 16
        return 2
      elsif @value > 16 and @value <= 31
        return 3
      end
    # If back, and pincer allowed:  
    when 9
       @value = rand(2)
      if @value <= 1
        return 1
      elsif @value == 2
        return 2
      end
    # If back, and side allowed:  
    when 10
      @value = rand(39)
      if @value <= 8
        return 1
      elsif @value > 8 and @value <= 39
        return 3
      end
    # If pincer, and side allowed:
    when 11
      @value = rand(39)
      if @value <= 8
        return 2
      elsif @value > 8 and @value <= 39
        return 3
      end
    # Only normal attack  
    when 100
      return 0
    # Only back attack
    when 101
      return 1
    # Only pincer attack
    when 102
      return 2
    # Only side attack  
    when 103
      return 3
    # Only normal attack (preemptive)
    when 104
      return 0
    # Only side attack (preemptive)
    when 105
      return 3
    else
      return 0
    end
    preemptive?
  end
  # Check if ti is a preemptive attack
  def preemptive?
    if $game_temp.force_preemptive[0]
      return $game_temp.force_preemptive[1]
    end
    if $game_system.sideview_mirror == 0
      if rand(8) == 7
        return true
      else
        return false
      end
    elsif $game_system.sideview_mirror == 3
      if rand(32) <= 7
        return true
      else
        return false
      end
    else
      return false
    end
  end
end
class Game_Temp
  attr_accessor :force_preemptive
  alias preemptive_initialize initialize
  def initialize
    preemptive_initialize
    @force_preemptive = [false,false]
  end
end
 
#==============================================================================
# â–  Window_Status
#------------------------------------------------------------------------------
#  ステータス画面で表示する、フル仕様のステータスウィンドウです。
#==============================================================================
 
class Window_Enemy < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #     actor : アクター
  #--------------------------------------------------------------------------
  def initialize
    super(0, 314, 200, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $fontface
    self.contents.font.size = $fontsize
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
=begin
    @enemy = []
    p @enemy
    for enemy in $game_troop.enemies
      @enemy.push(enemy.id)
    end
    p @enemy
    for enemy in $game_troop.enemies
      @enemy.delete(enemy.id)
    end
    p @enemy
    for enemy in $game_troop.enemies
      for i in [email=0..@enemy.size]0..@enemy.size[/email] - 1
          y = i * 32 + 4
          self.contents.font.color = normal_color
          unless @enemy.include_times(enemy.id) > 1
            self.contents.draw_text(0, y, 160, 32, $data_enemies[enemy.id].name)
            self.contents.draw_text(100, y, 160, 32, @enemy.include_times(enemy.id).to_s)
          end
        end
      end
=end
  end
end
 
#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
#  This window displays the status of all party members on the battle screen.
#==============================================================================
 
class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(200, 314, 440, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    @level_up_flags = [false, false, false, false]
    refresh
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    super
  end
  #--------------------------------------------------------------------------
  # * Set Level Up Flag
  #     actor_index : actor index
  #--------------------------------------------------------------------------
  def level_up(actor_index)
    @level_up_flags[actor_index] = true
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      actor_y = i * 32
      draw_actor_name(actor, 0, actor_y)
      draw_actor_hp(actor, 90, actor_y, 80)
      draw_actor_sp(actor, 180, actor_y, 80)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    # Slightly lower opacity level during main phase
    #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
 
#==============================================================================
# ** Window_SceneName
#------------------------------------------------------------------------------
# This window displays the name of the scene
#==============================================================================
 
class Window_SceneName < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(name="",align=1,misc=nil)
    super(0, 0, 160, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $fontface
    self.contents.font.size = $fontsize
    self.z = 150
    refresh(name="",align=1,misc)
  end
  #--------------------------------------------------------------------------
  # * Refresh (name, align)
  #--------------------------------------------------------------------------
  def refresh(name,align,misc)
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, name,align)
    if misc != nil
      self.contents.font.color = normal_color
      self.contents.draw_text(74, 0, 120, 32, misc.to_s,align)
    end
  end
  #--------------------------------------------------------------------------
  # * Set text (name, align)
  #--------------------------------------------------------------------------
  def set_text(name="",align=1,misc=nil)
    refresh(name,align,misc)
  end
end
 
#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
#  This window displays usable skills on the skill and battle screens.
#==============================================================================
 
class Window_Skill < Window_Selectable
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  alias hide_mp_draw_item draw_item
  def draw_item(index)
    hide_mp_draw_item(index)
    skill = @data[index]
    if @actor.skill_can_use?(skill.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(skill.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
    unless skill.element_set.include?(18)
      self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
    end
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    if $game_temp.in_battle
      @help_window.visible = false
    else
      @help_window.set_text(self.skill == nil ? "" : self.skill.description)
    end
  end
end
 
class Game_Party
  attr_a
 
No, I'm sure it doesn't have anything do to with Minkoff animated battlers.

'allowed_attacks' is used to determine which attack types are available for a troop.

You need to add this after the troop's name: | x
X is the id of the attack types package defined in the code bellow.

If this is the problem, then i'll fix it in the next demo so that you won't need to define which attack type package you want to be used. (Default would be all attack types)
Code:
#==============================================================================
# ** 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.
#==============================================================================
# (1.2) Attack Types Package
#------------------------------------------------------------------------------
#
#==============================================================================
 
class Game_System
  attr_accessor :preemptive
  alias ff6_attack_types_initialize initialize
  def initialize
    ff6_attack_types_initialize
    @preemptive = false
  end
  #--------------------------------------------------------------------------
  # * Check attack tyoes
  #--------------------------------------------------------------------------
  def check_attack_types(troop_id)
    case $game_troop.allowed_attacks(troop_id)
    # If all types allowed:
    when 1
      @value = rand(255)
      if @value <= 208
        return 0
      elsif @value >[/COLOR] 208 and @value [COLOR=#000080]<= 216
        return 1
      elsif @value >[/COLOR] 216 and @value [COLOR=#000080]<= 224
        return 2
      elsif @value >[/COLOR] 224 and @value [COLOR=#000080]<= 255
        return 3
       end
    # If normal, back, and pincer allowed:
    when 2
      @value = rand(28)
      if @value < 26
        return 0
      elsif @value == 27
        return 1
      elsif @value == 28
        return 2
      end
    # If normal, back, and side allowed:
    when 3
      @value = rand(247)
      if @value <= 208
        return 0
      elsif @value >[/COLOR] 208 and @value [COLOR=#000080]<= 216
        return 1
      elsif @value >[/COLOR] 216 and @value [COLOR=#000080]<= 247
        return 3
      end
    # If normal, and back allowed:
    when 4
      @value = rand(27)
      if @value <= 26
        return 0
      elsif @value == 1
        return 1
      end
    # If normal, pincer, and side allowed:
    when 5
      @value = rand(247)
      if @value <= 208
        return 0
        premptive?
      elsif @value >[/COLOR] 208 and @value [COLOR=#000080]<= 216
        return 2
      elsif @value >[/COLOR] 216 and @value [COLOR=#000080]<= 247
        return 3
      end
    # If normal, and pincer allowed:
    when 6
      @value = rand(27)
      if @value == 26
        return 0
      elsif @value == 1
        return 2
      end
    # If normal and side allowed:
    when 7
      @value = rand(239)
      if @value <= 208
        return 0
      elsif @value >[/COLOR] 208 and @value [COLOR=#000080]<= 239
        return 3
      end
    # If back, pincer, and side allowed:
    when 8
      @value = rand(47)
      if @value <= 8
        return 1
      elsif @value >[/COLOR] 8 and @value [COLOR=#000080]<= 16
        return 2
      elsif @value >[/COLOR] 16 and @value [COLOR=#000080]<= 31
        return 3
      end
    # If back, and pincer allowed:  
    when 9
       @value = rand(2)
      if @value <= 1
        return 1
      elsif @value == 2
        return 2
      end
    # If back, and side allowed:  
    when 10
      @value = rand(39)
      if @value <= 8
        return 1
      elsif @value >[/COLOR] 8 and @value [COLOR=#000080]<= 39
        return 3
      end
    # If pincer, and side allowed:
    when 11
      @value = rand(39)
      if @value <= 8
        return 2
      elsif @value >[/COLOR] 8 and @value [COLOR=#000080]<= 39
        return 3
      end
    # Only normal attack  
    when 100
      return 0
    # Only back attack
    when 101
      return 1
    # Only pincer attack
    when 102
      return 2
    # Only side attack  
    when 103
      return 3
    # Only normal attack (preemptive)
    when 104
      return 0
    # Only side attack (preemptive)
    when 105
      return 3
    else
      return 0
    end
    preemptive?
  end
  # Check if ti is a preemptive attack
  def preemptive?
    if $game_temp.force_preemptive[0]
      return $game_temp.force_preemptive[1]
    end
    if $game_system.sideview_mirror == 0
      if rand(8) == 7
        return true
      else
        return false
      end
    elsif $game_system.sideview_mirror == 3
      if rand(32) <= 7
        return true
      else
        return false
      end
    else
      return false
    end
  end
end

By the way, this version is buggy and is not an official release. I really don't suggest to use it right now. The demo is supposed to show what I have done so far.

I hope it helps you.

-Dargor
 

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