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.

Add a formation to RTAB please!

hi there
could someone please add a formation to this script for the animated battlers for the RTAB scripts.
here is the script with the other 8 formations.
Code:
#==============================================================================
# ** Animated Battlers - Enhanced   ver. 8.4                       (06-17-2007)
#
#------------------------------------------------------------------------------
#  * (4) Battle System:  The Scene Battle class
#==============================================================================    

#==============================================================================
# ** Scene_Battle 
#------------------------------------------------------------------------------ 
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  alias mnkmain main
  def main
    # Obtain the formation style
    # Only once per battle start
    $formation = $formation_style
    $formation = 2 if $formation_style == nil
    # if Formation is random 
    if $formation == 8 then
      $formation = rand(8).to_i
    end
    mnkmain
  end
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 1 : action preparation)
  #--------------------------------------------------------------------------
  alias mkf_up4s1 update_phase4_step1
  def update_phase4_step1(battler = @active_battler)
    if $rtab_detected == true
      mkf_up4s1(battler)
    else
      mkf_up4s1
    end
    if $scd_detect == true
      if battler != nil
        if battler.sd_casting
          battler.casted = true
        end
      end
    end    
  end
  
  #--------------------------------------------------------------------------
  # *  End Skill Selection
  #--------------------------------------------------------------------------  
  alias mkf_endss end_skill_select
  def end_skill_select
    mkf_endss
    if $rtab_detected
      @active_actor.skill_casted = @skill.id
    else
      @active_battler.skill_casted = @skill.id
    end
  end
  
  #--------------------------------------------------------------------------
  # * 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
    if $para_spell_detect == true
      if battler.spelling?
        battler.casted = true
      end
    end    
  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    
          battler.casted = true
        end
      end
    else
      update_phase4_step1_anim
    end
  end
  
  #-------------------------------------------------------------------------- 
  # * Action Animation, Movement
  #--------------------------------------------------------------------------
  alias mnk_update_phase4_step3 update_phase4_step3
  def update_phase4_step3(battler = @active_battler)
    @rtab = !@target_battlers
    target = (@rtab ? battler.target : @target_battlers)[0]

    # Battle Delay System
    if $animbat_at_delay    
      # Fomar's Action Cost Detection
      if $f_acb_detect
        for actor in $game_party.actors
          actor.vitality= 0
        end
        for enemy in $game_troop.enemies
          enemy.vitality= 0
        end
      end
      # Trickster's AT Detection
      if $t_abs_detect
        for actor in $game_party.actors
          actor.at_multiplier= 0
        end
        for enemy in $game_troop.enemies
          enemy.at_multiplier= 0
        end
      end
      # Cogwheel RTAB Detection
      if $rtab_detected
        @rtab_wait_flag = true
      end
    end

    # 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
    # Reset the 'Do Nothing' flag
    dn_flag = false
    # Set values and poses based on Action 
    case battler.current_action.kind
    when 0  # Attack
      # if Do Nothing, just return
      if battler.current_action.basic == 3
        dn_flag = true
      end
      if dn_flag != true
        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
        
        base_pose = pose_obtain(battler, $p7, $ap7, $ep7)
        base_pose2 = pose_array_obtain(battler, $poses_weapons, $poses_weaps_a, $poses_weaps_e, battler.weapon_id)
        base_pose = base_pose2 if base_pose2 != nil        
        
        if battler.current_action.basic == 2
          # If escaping, disable all movement
          full_moving = false
          center_move = false
          rush_type = false    
          # Set the graphics
          temp_pose = pose_obtain(battler, $poses_escape, $poses_escape_a, $poses_escape_e)
          base_pose = temp_pose if temp_pose != nil
        end
      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 = pose_obtain(battler, $p9, $ap9, $ep9)
      base_pose2 = pose_array_obtain(battler, $poses_skills, $poses_skills_a, $poses_skills_e, @skill_used)
      base_pose = base_pose2 if base_pose2 != nil
    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 = pose_obtain(battler, $p8, $ap8, $ep8)
      base_pose2 = pose_array_obtain(battler, $poses_items, $poses_items_a, $poses_items_e, @item_used)
      base_pose = base_pose2 if base_pose2 != nil
    end

    # Only perform action if 'Do Nothing' flag is off, ie... doing something...
    if dn_flag != true
      # 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)        
        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
        battler.casted = false
        battler.casting = false
        @spriteset.battler(battler).skill_used = 0
      when 2
        # Flag system that item was used
        @spriteset.battler(battler).item_used = 0
      end
      
      # Battle_Charge value for BattleCry script
      $battle_charge = true
    end

    # Battle Delay System
    if $animbat_at_delay    
      # Fomar's Action Cost Detection
      if $f_acb_detect
        for actor in $game_party.actors
          actor.vitality= 1
        end
        for enemy in $game_troop.enemies
          enemy.vitality= 1
        end
      end
      # Trickster's AT Detection
      if $t_abs_detect
        for actor in $game_party.actors
          actor.at_multiplier= 1.0
        end
        for enemy in $game_troop.enemies
          enemy.at_multiplier= 1.0
        end
      end
      # Cogwheel RTAB Detection
      if $rtab_detected
        @rtab_wait_flag = false
      end
    end
    
    # Done 
    @moved[battler] = false
    @rtab ? mnk_update_phase4_step3(battler) : mnk_update_phase4_step3
  end
  #--------------------------------------------------------------------------
  # * Offset Calculation
  #--------------------------------------------------------------------------
  def offset_value(battler = @active_battler)
    offst = @spriteset.battler(battler).battler_offset
    offst += $rush_offset
    if $sv_mirror == 1
      offset = (battler.is_a?(Game_Actor) ? -(offst) : offst)
    else
      offset = (battler.is_a?(Game_Actor) ? offst : -(offst))
    end
    return offset
  end
  #--------------------------------------------------------------------------
  # * Hit Animation
  #--------------------------------------------------------------------------
  alias mnk_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)
      critical = (@rtab ? target.critical[battler] : target.critical)
      if damage.is_a?(Numeric) and damage > 0
        base_pose = pose_obtain(target, $p2, $ap2, $ep2)
        @spriteset.battler(target).pose = base_pose
        if critical == true
          temp_pose = pose_obtain(target, $poses_crit, $poses_crit_a, $poses_crit_e)
          @spriteset.battler(target).pose = temp_pose if temp_pose != nil
        end
      end
    end
    @rtab ? mnk_update_phase4_step4(battler) : mnk_update_phase4_step4
  end
  #-------------------------------------------------------------------------- 
  # * Victory Animation
  #--------------------------------------------------------------------------
  alias mnk_start_phase5 start_phase5
  def start_phase5
    for actor in $game_party.actors
      return if @spriteset.battler(actor).moving
    end
    # See if an actor remains alive
    for actor in $game_party.actors
      unless actor.dead?
        $victory = true
      end
    end
    # See if an enemy remains alive
    for enemy in $game_troop.enemies.reverse
      unless enemy.dead?
        $defeat = true
      end
    end    
    
    mnk_start_phase5
  end
  #--------------------------------------------------------------------------
  # * Change Arrow Viewport
  #--------------------------------------------------------------------------
  alias mnk_start_enemy_select start_enemy_select
  def start_enemy_select
    mnk_start_enemy_select
    @enemy_arrow.dispose
    @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport2)
    @enemy_arrow.help_window = @help_window
  end
  #--------------------------------------------------------------------------
  # * Obtain Pose (Scene Battle version)
  #     battler     : battler performing attack
  #     pose_base   : default pose to return
  #     pose_actor  : list of poses for actors
  #     pose_enemy  : list of poses for enemies
  #--------------------------------------------------------------------------
  def pose_obtain(battler, pose_base, pose_actor, pose_enemy)
    # create Arrays
    pos_a = {}
    pos_e = {}
    # fill created Arrays & Set pose
    pos_a = pose_actor
    pos_e = pose_enemy
    pose_now = pose_base
    # Obtain pose if not a standard pose
    if battler.is_a?(Game_Actor)
      pose_now = pos_a[battler.id] if pos_a[battler.id] != nil
    else
      pose_now = pos_e[battler.id] if pos_e[battler.id] != nil
    end
    return pose_now
  end

  #--------------------------------------------------------------------------
  # * Obtain Pose from hashes (Scene Battle version)
  #     battler     : battler performing attack
  #     hash_base   : hash with default poses
  #     hash_actor  : advanced list of poses for actors
  #     hash_enemy  : advanced list of poses for enemies
  #     condition   : value determining where to get the final pose
  #--------------------------------------------------------------------------
  def pose_array_obtain(battler, hash_base, hash_actor, hash_enemy, condition)
    # create Arrays
    # create Arrays
    hash_b    = {}
    hash_a    = {}
    hash_e    = {}
    pose_temp = {}
    # fill created Arrays & Set pose
    hash_b = hash_base
    hash_a = hash_actor
    hash_e = hash_enemy
    # Setup the temp Array
    if battler.is_a?(Game_Actor)
      pose_temp = hash_a[battler.id] if hash_a.include?(battler.id)
    else
      pose_temp = hash_e[battler.id] if hash_e.include?(battler.id)
    end
    # Obtain the base pose based on condition (or nil)
    pose_now = hash_b[condition] if hash_b.include?(condition)
    # Obtain the optional actor/enemy pose based on condition (unless nil)
    pose_now = pose_temp[condition] if pose_temp.include?(condition)
    # Return the final pose
    return pose_now
  end
end

http://img110.imageshack.us/img110/8840/battleformationpj1.png[/img]
and here is a picture of what i want the new formation to look like.. sorry, im not very good at explaining things with good details.. so i hope this picture works.. basically if you've played final fantasy IV(4) you can see what im talking about,
FF4's battle set up looks like this
      battler 1
                battler 2
      battler 3
                battler 4
      battler 5

and since i dont have 5 characters i want the formation to look like this..

      battler 1
                battler 2
      battler 3
                battler 4

i know there is sort of this kind of formation in this script already, but the battlers are just so close together that they all overlap and some get cut off, so if you could space them out a bit that would be great..

thanks.
 

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