Script is Hanging Help

I'm in pretty dire need for an expert to overlook my scripts for lag prone areas. I've released a game but unfortunately some players are stopped by the hanging script error whereas others are not. Is there anyone I can PM my script base for help?

All the best and thank you,

:boo:
You can post code with the code tags [code=ruby]My script goes here[/code]

Do your users give any more information on the error? Like when in the game does it happens to them?

This error happens when the game runs so slowly that the Graphics::update times out after 10 seconds, more frequently when an infinite loop is hit
From what I understand it occurs exclusively during battles. I'm using Minkoff's animated battler's script(which is quite elaborate) so its difficult for me to discern exactly where I should add the 'graphics.update' fix I've heard about. I'm also using a single battle window script and a draw hp/sp script. These would be the one's I suspect.

  1. # Changes to the bitmap class to add a function which can draw gradient bars
  2. class Bitmap
  3.  
  4.   # Draw a rectangle with a gradient color shift from color1 to color2
  5.   # Goes from left to right, or top to bottom if vertical is set
  6.   def draw_gradient_rect(x, y, width, height, color1, color2, vertical=false)
  7.     # Determine what will limit the draw
  8.     limit = vertical ? height: width
  9.     for i in 0..limit
  10.       # Calculate the color1 multiplier for its color
  11.       mul = (limit - i).to_f / limit
  12.       # Calculate the new color for this part of the gradient
  13.       color = Color.new(
  14.         mul * (color1.red - color2.red) + color2.red,
  15.         mul * (color1.green - color2.green) + color2.green,
  16.         mul * (color1.blue - color2.blue) + color2.blue
  17.       )
  18.       # Draw the portion of the rectangle with the new color
  19.       if vertical
  20.         self.fill_rect(x, y+i, width,1, color)
  21.       else
  22.         self.fill_rect(x+i, y, 1, height, color)
  23.       end
  24.     end
  25.   end
  26.  
  27. end
  28.  
  29. #---------------------
  30. # Changes to the Window_Base class where Draw_Actor_HP/SP reside
  31.  
  32. class Window_Base < Window
  33.   # --------
  34.   # Change the Draw_Actor_HP function so a gradient bar appears to show how
  35.   # much HP the actor has left
  36.   alias draw_actor_hp_healthgauges draw_actor_hp unless $@
  37.   def draw_actor_hp(actor, x, y, width = 144)
  38.     # First create the health gauge!
  39.    
  40.     # Define colors for the gauges and the empty part of the gauge
  41.     # Color1 is the left of the gauge, Color2 is the right
  42.     health_gauge_color_1 = Color.new(228, 164, 32)
  43.     health_gauge_color_2 = Color.new(255, 128, 64)
  44.     black_color = Color.new(0, 0, 0)
  45.    
  46.     # Define the dimensions of the gauge in pixels
  47.     height = 12
  48.     x_offset = 0
  49.     y_offset = 20
  50.    
  51.     # If the actor has HP left...
  52.     if actor.hp > 0
  53.    
  54.       # Draw the full gauge first
  55.       self.contents.draw_gradient_rect(
  56.         x + x_offset,
  57.         y + y_offset,
  58.         width,
  59.         height,
  60.         health_gauge_color_1,
  61.         health_gauge_color_2
  62.       )
  63.       # If HP isn't maxed out, we'll have to draw the empty part of the gauge
  64.       if actor.hp < actor.maxhp
  65.         # Calculate how long the empty part of thegauge is (it will be at least one pixel wide and it won't be as long as the health gauge)
  66.         empty_width = [[(width * (1 - actor.hp.to_f / actor.maxhp)).to_i, 1].max, width - 1].min
  67.         # Now draw the empty part of the bar using this width
  68.         self.contents.fill_rect(
  69.           width - empty_width + x + x_offset + 1,
  70.           y+y_offset,
  71.           empty_width,
  72.           height,
  73.           black_color
  74.         )
  75.       end
  76.    
  77.     else
  78.       # The actor has no HP, just show a big black bar
  79.       self.contents.fill_rect(x+x_offset, y+y_offset, width, height, black_color)
  80.     end
  81.    
  82.     # Now draw the HP value by calling the original method
  83.     draw_actor_hp_healthgauges(actor, x, y, width)
  84.   end
  85.  
  86.   # ------------
  87.   # Change the Draw_Actor_SP function so it draws a gradient bar to show the
  88.   # amount of SP the actor has left
  89.   alias draw_actor_sp_healthgauges draw_actor_sp unless $@
  90.   def draw_actor_sp(actor, x, y, width = 144)
  91.     # First create the SP gauge!
  92.    
  93.     # Define colors for the gauges and the empty part of the gauge
  94.     # Color1 is the left of the gauge, Color2 is the right
  95.     sp_gauge_color_1 = Color.new(132, 32, 128)
  96.     sp_gauge_color_2 = Color.new(64, 64, 255)
  97.     black_color = Color.new(0, 0, 0)
  98.    
  99.     # Define the dimensions of the gauge in pixels
  100.     height = 12
  101.     x_offset = 0
  102.     y_offset = 20
  103.    
  104.     # If the actor has SP left...
  105.     if actor.sp > 0
  106.    
  107.       # Draw the full gauge first
  108.       self.contents.draw_gradient_rect(
  109.         x + x_offset,
  110.         y + y_offset,
  111.         width,
  112.         height,
  113.         sp_gauge_color_1,
  114.         sp_gauge_color_2
  115.       )
  116.       # If SP isn't maxed out, we'll have to draw the empty part of the gauge
  117.       if actor.sp < actor.maxsp
  118.         # Calculate how long the empty part of thegauge is (it will be at least one pixel wide and it won't be as long as the health gauge)
  119.         empty_width = [[(width * (1 - actor.sp.to_f / actor.maxsp)).to_i, 1].max, width - 1].min
  120.         # Now draw the empty part of the bar using this width
  121.         self.contents.fill_rect(
  122.           width - empty_width + x + x_offset + 1,
  123.           y+y_offset,
  124.           empty_width,
  125.           height,
  126.           black_color
  127.         )
  128.       end
  129.  
  130.     else
  131.       # Just draw a big black empty bar
  132.       self.contents.fill_rect(x+x_offset, y+y_offset, width, height, black_color)
  133.     end
  134.      
  135.     # Now draw the SP value by calling the original method
  136.     draw_actor_sp_healthgauges(actor, x, y, width)
  137.   end
  138. end
Expand to see the code.



and the other

  1. #==============================================================================
  2. # ** Animated Battlers - Enhanced   ver. 10.5                      (01-20-2007)
  3. #
  4. #------------------------------------------------------------------------------
  5. #  * (2) Sprite System:  The Sprite Battler Class
  6. #==============================================================================
  7.  
  8. #==============================================================================
  9. # ** Sprite_Battler
  10. #------------------------------------------------------------------------------
  11. #  This sprite is used to display the battler.It observes the Game_Character
  12. #  class and automatically changes sprite conditions.
  13. #==============================================================================
  14.  
  15. class Sprite_Battler < RPG::Sprite  
  16.   #--------------------------------------------------------------------------
  17.   # * Public Instance Variables
  18.   #--------------------------------------------------------------------------
  19.   attr_accessor :battler_offset         # Degree of action forcing  
  20.   attr_accessor :skill_used             # Degree of action forcing  
  21.   attr_accessor :item_used              # Degree of action forcing  
  22.   #--------------------------------------------------------------------------
  23.   # * Object Initialization
  24.   #--------------------------------------------------------------------------
  25.   alias mnk_init initialize
  26.   def initialize(viewport, battler = nil)
  27.     # --Initialize poses
  28.     @frame, @pose, @last_time, @last_move_time  = 0, 0, 0, 0
  29.     # --Initialize Battler placement and pose types
  30.     @battler_offset, @skill_used, @item_used    = 0, 0, 0
  31.     # --Initialize Boolean values
  32.     @statusd              = false
  33.     @dying                = true
  34.     @s_pose               = false
  35.     $game_system.victory  = false
  36.     $game_system.defeat   = false
  37.     @winning              = true
  38.     # ORIGINAL Initialize call
  39.     mnk_init(viewport, battler)
  40.     # EVENT VALUE CALLS
  41.     # --Obtain the Sideview switch
  42.     $game_system.sv_angle = $sideview_mirror
  43.     $game_system.sv_angle = 0 if $sideview_mirror == nil
  44.     # -- Obtain the max party size
  45.     $game_system.max_member = $formation_max_member
  46.     $game_system.max_member = 4 if $formation_max_member == nil
  47.     # --Obtain the highest position for the formation
  48.     $game_system.form_top = $formation_max_height
  49.     $game_system.form_top = 220 if $formation_max_height == nil
  50.     # --Obtain the formation's width
  51.     $game_system.form_wd = $formation_max_width
  52.     $game_system.form_wd = 128 if $formation_max_width == nil
  53.     # --Obtain the height of the Battlestatus Window
  54.     $game_system.bstat_ht = $battlestatus_height
  55.     $game_system.bstat_ht = 160 if $battlestatus_height == nil
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # * Update
  59.   #--------------------------------------------------------------------------
  60.   alias mnk_update update
  61.   def update
  62.  
  63.     # Only perform sprite edit for valid battlers
  64.     return unless @battler
  65.     if @battler.battler_name != @battler_name
  66.       @started = false
  67.     end    
  68.  
  69.     # Regular Update
  70.     mnk_update
  71.  
  72.     # Set Translucency  
  73.     if @battler.is_a?(Game_Enemy)
  74.       battler_translucency(@battler, MNK_TRANSLUCENT_ENEMY)
  75.     else
  76.       battler_translucency(@battler, MNK_TRANSLUCENT_ACTOR)
  77.     end
  78.     # Reset hash for Advanced Pose/Frames
  79.     pose_temp = {}
  80.    
  81.     # Start Routine (Performed at startup for each battler)
  82.     unless @started
  83.       # Set the pose based on battler's state
  84.       @pose = state
  85.       # Turn off Casting pose
  86.       @battler.casted  = false
  87.       @battler.casting = false
  88.       # Configure Enemy Spritesheet
  89.       if @battler.is_a?(Game_Enemy)
  90.         # Use spritesheet unless specified
  91.         unless DEFAULT_ENEMY or DEFAULT_ENEMY_ID.include?(@battler.id)
  92.           @width  = @width  / cell_divider(MNK_FRAMES_ENEMY,  MNK_FRAMES)
  93.           @height = @height / cell_divider(MNK_POSES_ENEMY,   MNK_POSES)
  94.         end
  95.       # Or Configure Actor Spritesheet
  96.       else  
  97.         # Use spritesheet unless specified
  98.         unless DEFAULT_ACTOR or DEFAULT_ACTOR_ID.include?(@battler.id)
  99.           @width  = @width  / cell_divider(MNK_FRAMES_ACTOR,  MNK_FRAMES)
  100.           @height = @height / cell_divider(MNK_POSES_ACTOR,   MNK_POSES)
  101.         end
  102.       end
  103.       # Distance the battlers
  104.       @battler_offset = @width * 0.75
  105.       # Obtain battler position (simulating 3-Dness)
  106.       @display_x = @battler.screen_x
  107.       @display_y = @battler.screen_y
  108.       @display_z = @battler.screen_z
  109.       @destination_x = @display_x
  110.       @destination_y = @display_y
  111.       @destination_z = @display_z
  112.       # Opacity fadein feature
  113.       self.opacity = 0 if MNK_FADE_IN
  114.       # Make invisible if dead at battle start
  115.       self.visible = false if @battler.dead?
  116.       # Set the started flag
  117.       @started = true
  118.     # End of Start Routine (for each battler)  
  119.     end
  120.    
  121.     # Again, ensure a pose is set
  122.     @pose = state if @pose == nil
  123.  
  124.     # Obtain animation cell/frame from Enemy
  125.     if @battler.is_a?(Game_Enemy)
  126.       # Use spritesheet cell unless specified
  127.       unless DEFAULT_ENEMY or DEFAULT_ENEMY_ID.include?(@battler.id)
  128.         cell_obtain
  129.       else
  130.         self.src_rect.set(0, 0, @width, @height)
  131.       end
  132.     # Or get it from an actor  
  133.     else
  134.       # Use spritesheet cell unless specified
  135.       unless DEFAULT_ACTOR or DEFAULT_ACTOR_ID.include?(@battler.id)
  136.         cell_obtain
  137.       else
  138.         self.src_rect.set(0, 0, @width, @height)
  139.       end
  140.     end
  141.    
  142.     # Position Sprite
  143.     self.x = @display_x
  144.     self.y = @display_y
  145.     self.z = @display_z
  146.     self.ox = @width / 2
  147.     self.oy = @height
  148.    
  149.     #  Party Turned Around
  150.     #  $game_temp.advantage_set == 6
  151.    
  152.     # Adjust sprite direction if facing the other way...
  153.     if $game_system.sv_angle == 1
  154.       if @battler.is_a?(Game_Actor)
  155.         mirror_pose_unless(6)
  156.       else
  157.         if MNK_MIRROR_ENEMIES
  158.           mirror_pose_if(5)
  159.         else
  160.           mirror_pose_unless(5)
  161.         end
  162.       end
  163.     else
  164.       if @battler.is_a?(Game_Actor)
  165.         mirror_pose_if(6)
  166.       else
  167.         if MNK_MIRROR_ENEMIES
  168.           mirror_pose_unless(5)
  169.         else
  170.           mirror_pose_if(5)
  171.         end
  172.       end
  173.     end
  174.    
  175.     # Setup Frames per Pose
  176.     poseframe = MNK_FRAMES_STANDARD
  177.     if @battler.is_a?(Game_Actor)
  178.       poseframe = cell_divider(MNK_FRAMES_ACTOR,  MNK_FRAMES_STANDARD) if cell_divider(MNK_FRAMES_ACTOR,  MNK_FRAMES_STANDARD) != nil
  179.     else
  180.       poseframe = cell_divider(MNK_FRAMES_ENEMY,  MNK_FRAMES_STANDARD) if cell_divider(MNK_FRAMES_ENEMY,  MNK_FRAMES_STANDARD) != nil
  181.     end
  182.     pose_chk = 0
  183.     pose_chk = @pose+1 if @pose != nil
  184.     poseframe = MNK_FRAMES_PER_POSE[pose_chk] if MNK_FRAMES_PER_POSE.include?(pose_chk)
  185.     # Set Advanced Poses for Actors
  186.     if @battler.is_a?(Game_Actor)
  187.       pose_temp = MNK_POSES_FR_ACTOR[@battler.id] if MNK_POSES_FR_ACTOR.include?(@battler.id)
  188.       poseframe = pose_temp[pose_chk] if pose_temp.include?(pose_chk)
  189.     end    
  190.     # Set Advanced Poses for Enemies
  191.     if @battler.is_a?(Game_Enemy)
  192.       pose_temp = MNK_POSES_FR_ENEMY[@battler.id] if MNK_POSES_FR_ENEMY.include?(@battler.id)
  193.       poseframe = pose_temp[pose_chk] if pose_temp.include?(pose_chk)
  194.     end
  195.    
  196.     # Make visible if returned to life
  197.     unless @battler.dead?
  198.       self.visible = true if @pose == pose_obtain(MNK_POSE1, MNK_APOSE1, MNK_EPOSE1)
  199.       @freeze = false unless $game_system.victory
  200.     end
  201.  
  202.     # Setup Animation
  203.     time = Graphics.frame_count / (Graphics.frame_rate / MNK_SPEED)
  204.     if @last_time < time
  205.       @frame = (@frame + 1) % poseframe
  206.       if @frame == 0
  207.         if @freeze
  208.           @frame = poseframe - 1
  209.           return
  210.         end
  211.         @pose = state
  212.       end
  213.     end
  214.     @last_time = time
  215.    
  216.     # Setup Dying Animation
  217.     if @battler.dead?
  218.       if @dying == true
  219.         @pose = state
  220.         @dying = false
  221.       end
  222.     # Otherwise, all non-dead actions...  
  223.     else
  224.       # Setup/Ready for Battle (Let's get ready to RUMBLE!)
  225.       if @s_pose == false
  226.         tmp_pose = pose_obtain(MNK_POSES_SETUP, MNK_POSES_SETUP_A, MNK_POSES_SETUP_E)
  227.         if tmp_pose != nil
  228.           @pose = tmp_pose
  229.           @s_pose = true            
  230.         end
  231.       end
  232.       # If Victory pose (Who's your daddy?)
  233.       if @battler.is_a?(Game_Actor)
  234.         if $game_system.victory == true
  235.           if @winning == true
  236.             @pose = state
  237.             @winning = false
  238.           end
  239.         end
  240.       end
  241.     end
  242.    
  243.     # Move It
  244.     move if moving
  245.   end
  246.  
  247.   #--------------------------------------------------------------------------
  248.   # * Current State
  249.   #--------------------------------------------------------------------------
  250.   def state
  251.     # Reset Statusd Flag    
  252.     @statusd = false
  253.    
  254.     # Set Translucency if not dead
  255.     unless @battler.dead?
  256.       if @battler.is_a?(Game_Actor)
  257.         battler_translucency(@battler, MNK_TRANSLUCENT_ACTOR)
  258.       else
  259.         battler_translucency(@battler, MNK_TRANSLUCENT_ENEMY)
  260.       end
  261.     end
  262.    
  263.     # Damage State
  264.     if [nil,{}].include?(@battler.damage)
  265.       # Battler Fine
  266.       state = pose_obtain(MNK_POSE1, MNK_APOSE1, MNK_EPOSE1)
  267.       # Battler Wounded
  268.       temp_woozy = MNK_LOW_HP_PERCENTAGE
  269.       if @battler.is_a?(Game_Actor)
  270.         temp_woozy = MNK_LOW_HP_ACTOR[@battler.id] if MNK_LOW_HP_ACTOR[@battler.id] != nil
  271.       end
  272.       if @battler.is_a?(Game_Enemy)
  273.         temp_woozy = MNK_LOW_HP_ENEMY[@battler.id] if MNK_LOW_HP_ENEMY[@battler.id] != nil
  274.       end
  275.       # If Set to Flat Rate
  276.       if MNK_LOW_HP_FLAT
  277.         if @battler.hp < temp_woozy
  278.           state = pose_obtain(MNK_POSE3, MNK_APOSE3, MNK_EPOSE3)
  279.           @statusd = true
  280.         end
  281.       # Otherwise, use percentage of battler's health
  282.       else
  283.         if @battler.hp < @battler.maxhp * temp_woozy
  284.           state = pose_obtain(MNK_POSE3, MNK_APOSE3, MNK_EPOSE3)
  285.           @statusd = true
  286.         end
  287.       end
  288.       # Battler Status-Effect
  289.       for i in @battler.states
  290.         tmp_pose2 = pose_array_obtain(MNK_POSES_STATUS, MNK_POSES_STAT_A, MNK_POSES_STAT_E, i)
  291.         state = tmp_pose2 if tmp_pose2 != nil
  292.         @statusd = true if tmp_pose2 != nil
  293.       end
  294.       # If Battler Dead
  295.       if @battler.dead?
  296.         # If using default battlers or default collapse
  297.         if (DEFAULT_COLLAPSE_ACTOR and @battler.is_a?(Game_Actor)) or
  298.           (DEFAULT_COLLAPSE_ENEMY and @battler.is_a?(Game_Enemy)) or
  299.           (DEFAULT_ACTOR and @battler.is_a?(Game_Actor)) or
  300.           (DEFAULT_ENEMY and @battler.is_a?(Game_Enemy)) or
  301.           (DEFAULT_ENEMY_ID.include?(@battler.id) and @battler.is_a?(Game_Enemy)) or
  302.           (DEFAULT_ACTOR_ID.include?(@battler.id) and @battler.is_a?(Game_Actor))
  303.           # Do absolutely nothing :)
  304.         else
  305.           # Dying Animation pose
  306.           if @dying == true
  307.             tmp_pose = pose_obtain(MNK_POSES_DYING, MNK_POSES_DYING_a, MNK_POSES_DYING_E)
  308.             if tmp_pose != nil
  309.               state = tmp_pose
  310.             else
  311.               state = dying_pose
  312.             end  
  313.           else
  314.             state = dying_pose
  315.           end
  316.          
  317.           # Fix Opacity
  318.           if @battler.is_a?(Game_Enemy)
  319.             if MNK_TRANSLUCENT_ENEMY.include?(@battler.id)
  320.               set_translucency(@battler, MNK_TRANSLUCENCY)
  321.             else
  322.               set_translucency(@battler, 255)
  323.             end
  324.           else
  325.             if MNK_TRANSLUCENT_ACTOR.include?(@battler.id)
  326.               set_translucency(@battler, MNK_TRANSLUCENCY)
  327.             else
  328.               set_translucency(@battler, 255)
  329.             end
  330.           end
  331.         end
  332.       end
  333.     end
  334.    
  335.     # Casting State
  336.     if @battler.casted
  337.       state = casting_pose if $game_system.mnk_det_para_spell and @battler.spelling?
  338.       state = casting_pose if $game_system.mnk_det_sd_casting and @battler.sd_casting
  339.       state = casting_pose if $game_system.mnk_det_rtab_systm and @battler.rtp != 0
  340.     end
  341.    
  342.     # Victory State
  343.     if @battler.is_a?(Game_Actor)
  344.       if $game_system.victory
  345.         if not @battler.dead?
  346.           if @winning == true
  347.             # A Pre-Winning Pose display
  348.             if MNK_POSES_WINNING != nil
  349.               tmp_pose = pose_obtain(MNK_POSES_WINNING, MNK_POSES_WINNING_A, MNK_POSES_WINNING_E)
  350.               state = tmp_pose if tmp_pose != nil
  351.             end
  352.           else
  353.             # Final Pose
  354.             state = victory_pose
  355.           end
  356.         else
  357.           # Final Pose
  358.           state = victory_pose
  359.         end        
  360.       end
  361.     # Perform check for Enemies  
  362.     else
  363.       if $game_system.defeat
  364.         if not @battler.dead?
  365.           if @winning == true
  366.             if MNK_POSES_WINNING != nil
  367.               tmp_pose = pose_obtain(MNK_POSES_WINNING, MNK_POSES_WINNING_A, MNK_POSES_WINNING_E)
  368.               state = tmp_pose if tmp_pose != nil
  369.             end
  370.           else
  371.             # Final Pose
  372.             state = victory_pose
  373.           end
  374.         else
  375.           # Final Pose
  376.           state = victory_pose
  377.         end        
  378.       end
  379.     end
  380.    
  381.     # Guarding State (not if dead OR in victory)
  382.     if not @battler.dead?
  383.       if not $game_system.victory
  384.         if @statusd == false
  385.           state = pose_obtain(MNK_POSE4, MNK_APOSE4, MNK_EPOSE4) if @battler.guarding?
  386.         end
  387.       end
  388.     end
  389.     # Moving State
  390.     if moving
  391.     # Adjust sprite direction if facing the other way...
  392.       if $game_system.sv_angle == 1
  393.         # If enemy battler moving
  394.         if @battler.is_a?(Game_Enemy)
  395.           # Battler Moving Left
  396.           state = pose_obtain(MNK_POSE5, MNK_APOSE5, MNK_EPOSE5) if moving.eql?(0)
  397.           # Battler Moving Right
  398.           state = pose_obtain(MNK_POSE6, MNK_APOSE6, MNK_EPOSE6) if moving.eql?(1)
  399.         # Else actor battler moving
  400.         else
  401.           # Battler Moving Left
  402.           state = pose_obtain(MNK_POSE6, MNK_APOSE6, MNK_EPOSE6) if moving.eql?(0)
  403.           # Battler Moving Right
  404.           state = pose_obtain(MNK_POSE5, MNK_APOSE5, MNK_EPOSE5) if moving.eql?(1)
  405.         end
  406.       else      
  407.         # If enemy battler moving
  408.         if @battler.is_a?(Game_Enemy)
  409.           # Battler Moving Left
  410.           state = pose_obtain(MNK_POSE6, MNK_APOSE6, MNK_EPOSE6) if moving.eql?(0)
  411.           # Battler Moving Right
  412.           state = pose_obtain(MNK_POSE5, MNK_APOSE5, MNK_EPOSE5) if moving.eql?(1)
  413.         # Else actor battler moving
  414.         else
  415.           # Battler Moving Left
  416.           state = pose_obtain(MNK_POSE5, MNK_APOSE5, MNK_EPOSE5) if moving.eql?(0)
  417.           # Battler Moving Right
  418.           state = pose_obtain(MNK_POSE6, MNK_APOSE6, MNK_EPOSE6) if moving.eql?(1)
  419.         end
  420.       end
  421.     end
  422.     # Return State
  423.     return state
  424.   end
  425.  
  426.   #--------------------------------------------------------------------------
  427.   # * Move
  428.   #--------------------------------------------------------------------------
  429.   def move
  430.     time = Graphics.frame_count / (Graphics.frame_rate.to_f / (MNK_SPEED * 5))
  431.    
  432.     if @last_move_time < time
  433.       # Pause for Animation
  434.       return if @pose != state
  435.         # The standard 'full' opacity
  436.         opa = 255
  437.         if @battler.is_a?(Game_Enemy) and MNK_TRANSLUCENT_ENEMY.include?(@battler.id)
  438.           opa = MNK_TRANSLUCENCY
  439.         end
  440.         if @battler.is_a?(Game_Actor) and MNK_TRANSLUCENT_ACTOR.include?(@battler.id)
  441.           opa = MNK_TRANSLUCENCY
  442.         end
  443.  
  444.       # Phasing
  445.       self.opacity = phasing(opa)   if MNK_PHASING
  446.       if @battler.is_a?(Game_Actor)
  447.         self.opacity = phasing(opa) if MNK_PHASING_ACTOR.include?(@battler.id)
  448.       else      
  449.         self.opacity = phasing(opa) if MNK_PHASING_ENEMY.include?(@battler.id)
  450.       end
  451.      
  452.       # Calculate Difference
  453.       difference_x = (@display_x - @destination_x).abs
  454.       difference_y = (@display_y - @destination_y).abs
  455.       difference_z = (@display_z - @destination_z).abs  
  456.       # Done? Reset, Stop
  457.       if [difference_x, difference_y].max.between?(0, 8)
  458.         @display_x = @destination_x
  459.         @display_y = @destination_y
  460.         @display_z = @destination_z
  461.         @pose = state
  462.         return
  463.       end
  464.      
  465.       # Calculate Movement Increments
  466.       increment_x = increment_y = 1
  467.       if difference_x < difference_y
  468.         increment_x = 1.0 / (difference_y.to_f / difference_x)
  469.       elsif difference_y < difference_x
  470.         increment_y = 1.0 / (difference_x.to_f / difference_y)
  471.       end
  472.       increment_z = increment_y
  473.  
  474.       # Calculate Movement Speed
  475.       if MNK_CALC_SPEED
  476.         total = 0; $game_party.actors.each{ |actor| total += actor.agi }
  477.         speed = @battler.agi.to_f / (total / $game_party.actors.size)
  478.         increment_x *= speed
  479.         increment_y *= speed
  480.         increment_z *= speed
  481.       end
  482.      
  483.       # Multiply and Move
  484.       multiplier_x = MNK_RUSH_SPEED * (@destination_x - @display_x > 0 ? 8 : -8)
  485.       multiplier_y = MNK_RUSH_SPEED * (@destination_y - @display_y > 0 ? 8 : -8)
  486.       multiplier_z = MNK_RUSH_SPEED * (@destination_z - @display_z > 0 ? 8 : -8)      
  487.       @display_x += (increment_x * multiplier_x).to_i
  488.       @display_y += (increment_y * multiplier_y).to_i
  489.       @display_z += (increment_z * multiplier_z).to_i
  490.      
  491.     end
  492.     @last_move_time = time
  493.   end
  494.  
  495.   #--------------------------------------------------------------------------
  496.   # * Set Movement
  497.   #--------------------------------------------------------------------------
  498.   def setmove(destination_x, destination_y, destination_z)
  499.     unless (@battler.is_a?(Game_Enemy) and MNK_STATIONARY_ENEMIES) or
  500.            (@battler.is_a?(Game_Actor) and MNK_STATIONARY_ACTORS)
  501.       unless MNK_STATIONARY_WEAPONS.include?(@battler.weapon_id) or
  502.              MNK_STATIONARY_SKILLS.include?(@skill_used) or
  503.              MNK_STATIONARY_ITEMS.include?(@item_used)
  504.         @original_x = @display_x
  505.         @original_y = @display_y
  506.         @original_z = @display_z          
  507.         @destination_x = destination_x
  508.         @destination_y = destination_y
  509.         @destination_z = destination_z
  510.       end
  511.     end
  512.   end
  513.  
  514.   #--------------------------------------------------------------------------
  515.   # * Movement Check
  516.   #--------------------------------------------------------------------------
  517.   def moving
  518.     if (@display_x != @destination_x and @display_y != @destination_y and [email protected]?)
  519.       return (@display_x > @destination_x ? 0 : 1)
  520.     end
  521.   end
  522.  
  523.   #--------------------------------------------------------------------------
  524.   # * Set Pose
  525.   #--------------------------------------------------------------------------
  526.   def pose=(pose)
  527.     @pose = pose
  528.     @frame = 0
  529.   end
  530.  
  531.   #--------------------------------------------------------------------------
  532.   # * Freeze
  533.   #--------------------------------------------------------------------------
  534.   def freeze
  535.     @freeze = true
  536.   end
  537.  
  538.   #--------------------------------------------------------------------------
  539.   # * Fallen Pose
  540.   #--------------------------------------------------------------------------
  541.   if @derv_anim_bat_stack.nil?
  542.     @derv_anim_bat_stack = true
  543.     alias mnk_collapse collapse
  544.     def collapse
  545.       if @battler.is_a?(Game_Actor)
  546.         mnk_collapse if DEFAULT_ACTOR
  547.         mnk_collapse if DEFAULT_COLLAPSE_ACTOR
  548.         if DEFAULT_ACTOR_ID != nil
  549.           mnk_collapse if DEFAULT_ACTOR_ID.include?(@battler.id)
  550.         end
  551.       else
  552.         mnk_collapse if DEFAULT_ENEMY
  553.         mnk_collapse if DEFAULT_COLLAPSE_ENEMY
  554.         if DEFAULT_ENEMY_ID != nil
  555.           mnk_collapse if DEFAULT_ENEMY_ID.include?(@battler.id)
  556.         end
  557.       end
  558.     end
  559.   end
  560.  
  561.   #--------------------------------------------------------------------------
  562.   # * Phasing / Vanishing
  563.   #--------------------------------------------------------------------------
  564.   def phasing(opa)
  565.     d1 = (@display_x - @original_x).abs
  566.     d2 = (@display_y - @original_y).abs
  567.     d3 = (@display_x - @destination_x).abs
  568.     d4 = (@display_y - @destination_y).abs
  569.     return [opa - ([d1 + d2, d3 + d4].min * 1.75).to_i, 0].max
  570.   end
  571.  
  572.   #--------------------------------------------------------------------------
  573.   # * Mirror Pose If...
  574.   #--------------------------------------------------------------------------
  575.   def mirror_pose_if(adv_value)
  576.     if $game_temp.advantage_set == adv_value
  577.       self.mirror = true
  578.     else
  579.       self.mirror = false
  580.     end
  581.   end
  582.  
  583.   #--------------------------------------------------------------------------
  584.   # * Mirror Pose Unless...
  585.   #--------------------------------------------------------------------------
  586.   def mirror_pose_unless(adv_value)
  587.     unless $game_temp.advantage_set == adv_value
  588.       self.mirror = true
  589.     else
  590.       self.mirror = false
  591.     end
  592.   end
  593.  
  594.   #--------------------------------------------------------------------------
  595.   # * Casting Pose
  596.   #--------------------------------------------------------------------------
  597.   def casting_pose
  598.     tmp_pose = pose_obtain(MNK_POSES_CASTPREP, MNK_POSES_CASTPREP_A, MNK_POSES_CASTPREP_E)
  599.     tmp_pose2 = pose_array_obtain(MNK_POSES_CASTED, MNK_POSES_CASTED_A, MNK_POSES_CASTED_E, @battler.skill_casted)
  600.     tmp_pose = tmp_pose2 if tmp_pose2 != nil
  601.     state = tmp_pose if tmp_pose != nil
  602.     return state
  603.   end
  604.  
  605.   #--------------------------------------------------------------------------
  606.   # * Final Victory Pose
  607.   #--------------------------------------------------------------------------
  608.   def victory_pose
  609.     tmp_pose = MNK_POSE10-1
  610.     tmp_pose = MNK_APOSE10[@battler.id]-1 if MNK_APOSE10[@battler.id] != nil
  611.     if not MNK_LOOPS_WINNING.include?(@battler.id)
  612.       @freeze = true
  613.     end
  614.     return tmp_pose
  615.   end
  616.   #--------------------------------------------------------------------------
  617.   # * Final Victory Pose
  618.   #--------------------------------------------------------------------------
  619.   def dying_pose
  620.     state = pose_obtain(MNK_POSE11, MNK_APOSE11, MNK_EPOSE11)
  621.     if @battler.is_a?(Game_Actor)
  622.       @freeze = true if not MNK_LOOPS_DEFEATED_ACTOR.include?(@battler.id)
  623.     else
  624.       @freeze = true if not MNK_LOOPS_DEFEATED_ENEMY.include?(@battler.id)
  625.     end
  626.     return state
  627.   end  
  628.  
  629.   #--------------------------------------------------------------------------
  630.   # * Battler Translucency
  631.   #     battler            : actor or enemy battler
  632.   #     battler_trans      : translucency array for battler
  633.   #--------------------------------------------------------------------------
  634.   def battler_translucency(battler, battler_trans)
  635.     tcheck = {}
  636.     tcheck = battler_trans
  637.     set_translucency(battler, MNK_TRANSLUCENCY) if tcheck.include?(battler.id)
  638.   end
  639.  
  640.   #--------------------------------------------------------------------------
  641.   # * Set Translucency
  642.   #     battler            : actor or enemy battler
  643.   #     trans_level        : translucency level
  644.   #--------------------------------------------------------------------------
  645.   def set_translucency(battler, trans_level)
  646.     if battler.hidden
  647.       self.opacity  = 0
  648.     else
  649.       self.opacity  = MNK_TRANSLUCENCY
  650.     end
  651.   end
  652.    
  653.   #--------------------------------------------------------------------------
  654.   # * Cell Divider
  655.   #     divider_check      : array to divide cells by custom actor or enemy
  656.   #     divider_standard   : standard number to divide by
  657.   #--------------------------------------------------------------------------
  658.   def cell_divider(divider_check, divider_standard)
  659.     dcheck = {}
  660.     divided_cell = divider_standard
  661.     dcheck = divider_check
  662.     if dcheck != nil
  663.       if dcheck.include?(@battler.id)
  664.         divided_cell = dcheck[@battler.id] if dcheck[@battler.id] != nil
  665.       end
  666.     end
  667.     return divided_cell        
  668.   end
  669.  
  670.   #--------------------------------------------------------------------------
  671.   # * Obtain Individual Cell
  672.   #--------------------------------------------------------------------------
  673.   def cell_obtain
  674.     # Only permit for valid poses & frames
  675.     if @pose != nil
  676.       if @frame != nil
  677.         self.src_rect.set(@width * @frame, @height * @pose, @width, @height)
  678.       end
  679.     end
  680.   end
  681.  
  682.   #--------------------------------------------------------------------------
  683.   # * Obtain Pose
  684.   #     pose_base   : default pose to return
  685.   #     pose_actor  : list of poses for actors
  686.   #     pose_enemy  : list of poses for enemies
  687.   #--------------------------------------------------------------------------
  688.   def pose_obtain(pose_base, pose_actor, pose_enemy)
  689.     # create Arrays
  690.     pos_a = {}
  691.     pos_e = {}
  692.     # fill created Arrays & Set pose
  693.     pos_a = pose_actor
  694.     pos_e = pose_enemy
  695.     pose_now = pose_base
  696.     # Obtain pose if not a standard pose
  697.     if @battler.is_a?(Game_Actor)
  698.       pose_now = pos_a[@battler.id] if pos_a[@battler.id] != nil
  699.     else
  700.       pose_now = pos_e[@battler.id] if pos_e[@battler.id] != nil
  701.     end
  702.     # Return the final pose (minus 1 for neceties)
  703.     pose_now -= 1 if pose_now != nil
  704.     return pose_now
  705.   end
  706.  
  707.   #--------------------------------------------------------------------------
  708.   # * Obtain Pose from hashes
  709.   #     hash_base   : hash with default poses
  710.   #     hash_actor  : advanced list of poses for actors
  711.   #     hash_enemy  : advanced list of poses for enemies
  712.   #     condition   : value determining where to get the final pose
  713.   #--------------------------------------------------------------------------
  714.   def pose_array_obtain(hash_base, hash_actor, hash_enemy, condition)
  715.     # create Arrays
  716.     hash_b    = {}
  717.     hash_a    = {}
  718.     hash_e    = {}
  719.     pose_temp = {}
  720.     # fill created Arrays & Set pose
  721.     hash_b = hash_base
  722.     hash_a = hash_actor
  723.     hash_e = hash_enemy
  724.     # Setup the temp Array
  725.     if @battler.is_a?(Game_Actor)
  726.       pose_temp = hash_a[@battler.id] if hash_a.include?(@battler.id)
  727.     else
  728.       pose_temp = hash_e[@battler.id] if hash_e.include?(@battler.id)
  729.     end
  730.     # Obtain the base pose based on condition (or nil)
  731.     pose_now = hash_b[condition] if hash_b.include?(condition)
  732.     # Obtain the optional actor/enemy pose based on condition (unless nil)
  733.     pose_now = pose_temp[condition] if pose_temp.include?(condition)
  734.     # Return the final pose (minus 1 for neceties)
  735.     pose_now -= 1 if pose_now != nil
  736.     return pose_now
  737.   end
  738. end
Expand to see the code.


  1. #==============================================================================
  2. # ** Animated Battlers - Enhanced   ver. 10.5                      (01-20-2007)
  3. #
  4. #------------------------------------------------------------------------------
  5. #  * (3) Battle System:  The Scene Battle class
  6. #==============================================================================    
  7.  
  8. #==============================================================================
  9. # ** Scene_Battle
  10. #------------------------------------------------------------------------------
  11. #  This class performs battle screen processing.
  12. #==============================================================================
  13.  
  14. class Scene_Battle
  15.   #--------------------------------------------------------------------------
  16.   # * Main Processing
  17.   #--------------------------------------------------------------------------
  18.   alias mnkmain main
  19.   def main
  20.     # Initialize wait count
  21.     @delay_count = 0
  22.     # Obtain the formation style
  23.     # Only once per battle start
  24.     $game_system.formation = $formation_style
  25.     $game_system.formation = 0 if $formation_style == nil
  26.     # if Formation is random
  27.     if $game_system.formation == 8 then
  28.       $game_system.formation = rand(8).to_i
  29.     end
  30.     # Perform the original call
  31.     mnkmain
  32.   end
  33.  
  34.   #--------------------------------------------------------------------------
  35.   # * Frame Update (main phase)
  36.   #--------------------------------------------------------------------------
  37.   alias mnk_anim_sp3 start_phase3
  38.   def start_phase3
  39.     # Remove flag after set number of turns
  40.     if $game_temp.battle_turn >= MNK_ADV_OFF_TURN
  41.       # Turn sideview advantage mirror flag off
  42.       $game_temp.advantage_set = 0
  43.     end
  44.     # Perform the original call
  45.     mnk_anim_sp3
  46.   end
  47.  
  48.   #--------------------------------------------------------------------------
  49.   # * Frame Update (main phase step 1 : action preparation)
  50.   #--------------------------------------------------------------------------
  51.   alias mkf_up4s1 update_phase4_step1
  52.   def update_phase4_step1(battler = @active_battler)
  53.     if $game_system.mnk_det_rtab_systm == true
  54.       mkf_up4s1(battler)
  55.     else
  56.       mkf_up4s1
  57.     end
  58.     if battler != nil
  59.       if $game_system.mnk_det_sd_casting == true
  60.         if battler.sd_casting
  61.           battler.casted = true
  62.         end
  63.       end
  64.     end
  65.   end
  66.  
  67.   #--------------------------------------------------------------------------
  68.   # *  End Skill Selection
  69.   #--------------------------------------------------------------------------  
  70.   alias mkf_endss end_skill_select
  71.   def end_skill_select
  72.     mkf_endss
  73.     if $game_system.mnk_det_rtab_systm
  74.       @active_actor.skill_casted = @skill.id
  75.     else
  76.       @active_battler.skill_casted = @skill.id
  77.     end
  78.   end
  79.  
  80.   #--------------------------------------------------------------------------
  81.   # * Make Skill Action Results (alias used to determine skill used)
  82.   #--------------------------------------------------------------------------
  83.   alias make_skill_action_result_anim make_skill_action_result
  84.   def make_skill_action_result(battler = @active_battler, plus_id = 0)
  85.     @rtab = !@target_battlers
  86.     if $game_system.mnk_det_rtab_attck
  87.       make_skill_action_result_anim(battler, plus_id)
  88.     else
  89.       @rtab ? make_skill_action_result_anim(battler) : make_skill_action_result_anim
  90.     end
  91.     @skill_used = @skill.id
  92.     battler.strike_skill   = @skill.id
  93.     if $game_system.mnk_det_para_spell == true
  94.       #if battler.spelling?
  95.         battler.casted = true
  96.       #end
  97.     end      
  98.     for target in (@rtab ? battler.target : @target_battlers)
  99.       target.struck_skill = @skill.id
  100.     end
  101.   end
  102.  
  103.   #--------------------------------------------------------------------------
  104.   # * Make Item Action Results (alias used to determine item used)
  105.   #--------------------------------------------------------------------------
  106.   alias make_item_action_result_anim make_item_action_result
  107.   def make_item_action_result(battler = @active_battler)
  108.     @rtab = !@target_battlers
  109.     @rtab ? make_item_action_result_anim(battler) : make_item_action_result_anim
  110.     @item_used = @item.id
  111.     @item_usage = @item.scope
  112.     battler.strike_item = @item.id
  113.     for target in (@rtab ? battler.target : @target_battlers)
  114.       target.struck_item = @item.id
  115.     end
  116.   end
  117.  
  118.   #--------------------------------------------------------------------------
  119.   # * Frame Update (main phase step 1 : action preparation) (Casting Routine)
  120.   #--------------------------------------------------------------------------
  121.   alias update_phase4_step1_anim update_phase4_step1
  122.   def update_phase4_step1(battler = @active_battler)
  123.     @rtab = !@target_battlers
  124.     if $game_system.mnk_det_rtab_systm == true
  125.       update_phase4_step1_anim(battler)
  126.       if battler.current_action.kind == 1 and
  127.         (not battler.current_action.forcing or @force != 2)
  128.         if battler.rtp != 0    
  129.           battler.casted = true
  130.         end
  131.       end
  132.     else
  133.       update_phase4_step1_anim
  134.     end
  135.   end
  136.  
  137.   #--------------------------------------------------------------------------
  138.   # * Action Animation, Movement
  139.   #--------------------------------------------------------------------------
  140.   alias mnk_update_phase4_step3 update_phase4_step3
  141.   def update_phase4_step3(battler = @active_battler)
  142.     @rtab = !@target_battlers
  143.     target = (@rtab ? battler.target : @target_battlers)[0]
  144.     # Battle Delay System
  145.     if MNK_AT_DELAY    
  146.       # Fomar's Action Cost Detection
  147.       if $game_system.mnk_det_acb_detect
  148.         for actor in $game_party.actors
  149.           actor.vitality= 0
  150.         end
  151.         for enemy in $game_troop.enemies
  152.           enemy.vitality= 0
  153.         end
  154.       end
  155.       # Trickster's AT Detection
  156.       if $game_system.mnk_det_abs_detect
  157.         for actor in $game_party.actors
  158.           actor.at_bonus= [0,0]
  159.         end
  160.         for enemy in $game_troop.enemies
  161.           enemy.at_bonus= [0,0]
  162.         end
  163.       end
  164.       # Cogwheel RTAB Detection
  165.       if $game_system.mnk_det_rtab_systm
  166.         @rtab_wait_flag = true
  167.       end
  168.     end
  169.  
  170.     # If enemy is a default battler
  171.     if battler.is_a?(Game_Enemy)
  172.       if DEFAULT_ENEMY
  173.         if @rtab then battler.white_flash = true end
  174.         if @rtab then battler.wait = 10 end
  175.       end
  176.       if DEFAULT_ENEMY_ID != nil
  177.         if DEFAULT_ENEMY_ID.include?(battler.id)
  178.           if @rtab then battler.white_flash = true end
  179.           if @rtab then battler.wait = 10 end
  180.         end
  181.       end        
  182.     end
  183.     # If actor is a default battler
  184.     if battler.is_a?(Game_Actor)
  185.       if DEFAULT_ACTOR
  186.         if @rtab then battler.white_flash = true end
  187.         if @rtab then battler.wait = 10 end
  188.       end
  189.       if DEFAULT_ACTOR_ID != nil
  190.         if DEFAULT_ACTOR_ID.include?(battler.id)
  191.           if @rtab then battler.white_flash = true end
  192.           if @rtab then battler.wait = 10 end
  193.         end
  194.       end                
  195.     end
  196.     # Reset the 'Do Nothing' flag
  197.     dn_flag = false
  198.     # Set values and poses based on Action
  199.     case battler.current_action.kind
  200.     when 0  # Attack
  201.       # if Do Nothing, just return
  202.       if battler.current_action.basic == 3
  203.         dn_flag = true
  204.       end
  205.       if dn_flag != true
  206.         rush_type = MNK_STEP_ATTACK
  207.         full_moving = true ; if rush_type; full_moving = false; end
  208.         if MNK_MOVE2CENTER_ATK.include?(battler.weapon_id); center_move=true ; end
  209.         if MNK_STATIONARY_ENEMY_IDS.include?(battler.id) and battler.is_a?(Game_Enemy)
  210.           full_moving = false
  211.           center_move = false
  212.           rush_type = false
  213.         end
  214.         base_pose = pose_obtain(battler, MNK_POSE7, MNK_APOSE7, MNK_EPOSE7)
  215.         base_pose2 = pose_array_obtain(battler, MNK_POSES_WEAPONS, MNK_POSES_WEAPS_A, MNK_POSES_WEAPS_E, battler.weapon_id)
  216.         base_pose = base_pose2 if base_pose2 != nil        
  217.         if battler.current_action.basic == 2
  218.           # If escaping, disable all movement
  219.           full_moving = false
  220.           center_move = false
  221.           rush_type = false    
  222.           # Set the graphics
  223.           temp_pose = pose_obtain(battler, MNK_POSES_ESCAPE, MNK_POSES_ESCAPE_A, MNK_POSES_ESCAPE_E)
  224.           base_pose = temp_pose if temp_pose != nil
  225.         end
  226.       end
  227.     when 1  # Skill
  228.       rush_type = MNK_STEP_SKILL
  229.       if MNK_MOVING_SKILL.include?(@skill_used) ; full_moving = true ; end
  230.       if MNK_MOVE2CENTER_SKILL.include?(@skill_used) ; center_move = true ; end        
  231.       base_pose = pose_obtain(battler, MNK_POSE9, MNK_APOSE9, MNK_EPOSE9)
  232.       base_pose2 = pose_array_obtain(battler, MNK_POSES_SKILLS, MNK_POSES_SKILLS_A, MNK_POSES_SKILLS_E, @skill_used)
  233.       base_pose = base_pose2 if base_pose2 != nil
  234.     when 2  # Item
  235.       rush_type = MNK_STEP_ITEM
  236.       if MNK_MOVING_ITEM.include?(@item_used) or @item_scope == 1..2 ; full_moving = true ; end
  237.       if MNK_MOVE2CENTER_ITEM.include?(@item_used); center_move = true; end
  238.       base_pose = pose_obtain(battler, MNK_POSE8, MNK_APOSE8, MNK_EPOSE8)
  239.       base_pose2 = pose_array_obtain(battler, MNK_POSES_ITEMS, MNK_POSES_ITEMS_A, MNK_POSES_ITEMS_E, @item_used)
  240.       base_pose = base_pose2 if base_pose2 != nil
  241.     end
  242.  
  243.     # Only perform action if 'Do Nothing' flag is off, ie... doing something...
  244.     if dn_flag != true
  245.       # Control Movement and use current pose
  246.       @moved = {} unless @moved
  247.       return if @spriteset.battler(battler).moving
  248.       if not (@moved[battler] or battler.guarding?)
  249.         offset = offset_value(target, battler)
  250.         if rush_type        # Steps forward
  251.           @spriteset.battler(battler).setmove(battler.screen_x - offset, battler.screen_y + 1, battler.screen_z)
  252.         end
  253.         if full_moving      # Runs to target
  254.           @spriteset.battler(battler).setmove(target.screen_x + offset, target.screen_y - 1, target.screen_z + 10)
  255.         end
  256.         if center_move      # Runs to center
  257.           @spriteset.battler(battler).setmove(320+(offset/4), battler.screen_y-1, battler.screen_z)
  258.         end
  259.         @moved[battler] = true
  260.         return
  261.         @spriteset.battler(battler).pose = base_pose
  262.       elsif not battler.guarding?
  263.         @spriteset.battler(battler).pose = base_pose
  264.         @spriteset.battler(battler).setmove(battler.screen_x, battler.screen_y, battler.screen_z)
  265.       end
  266.      
  267.       # Finish Up Skill and Item Use
  268.       case battler.current_action.kind
  269.       when 1
  270.         # Flag system that skill was used
  271.         battler.casted = false
  272.         battler.casting = false
  273.         @spriteset.battler(battler).skill_used = 0
  274.       when 2
  275.         # Flag system that item was used
  276.         @spriteset.battler(battler).item_used = 0
  277.       end
  278.      
  279.       # Battle_Charge value for BattleCry script
  280.       $battle_charge = true
  281.     end
  282.  
  283.     # Battle Delay System
  284.     if MNK_AT_DELAY    
  285.       # Fomar's Action Cost Detection
  286.       if $game_system.mnk_det_acb_detect
  287.         for actor in $game_party.actors
  288.           actor.vitality = 1
  289.         end
  290.         for enemy in $game_troop.enemies
  291.           enemy.vitality = 1
  292.         end
  293.       end
  294.       # Trickster's AT Detection
  295.       if $game_system.mnk_det_abs_detect
  296.         for actor in $game_party.actors
  297.           actor.at_bonus = [1,0]
  298.         end
  299.         for enemy in $game_troop.enemies
  300.           enemy.at_bonus = [1,0]
  301.         end
  302.       end
  303.       # Cogwheel RTAB Detection
  304.       if $game_system.mnk_det_rtab_systm
  305.         @rtab_wait_flag = false
  306.       end
  307.     end
  308.     # Prevent 'removed battler' moved state
  309.     unless @moved == nil
  310.       @moved[battler] = true
  311.     end
  312.     # Start attack, do not move from spot
  313.     battler.attacking = true
  314.     # Perform the original call
  315.     @rtab ? mnk_update_phase4_step3(battler) : mnk_update_phase4_step3
  316.   end
  317.   #--------------------------------------------------------------------------
  318.   # * Offset Calculation
  319.   #--------------------------------------------------------------------------
  320.   def offset_value(target, battler = @active_battler)
  321.     offst = @spriteset.battler(battler).battler_offset
  322.     offst += MNK_OFFSET
  323.     # Oversized or special Battler offsets
  324.     if target.is_a?(Game_Enemy) && battler.is_a?(Game_Actor)
  325.       unless MNK_OFFSET_ACTOR == nil
  326.         offst += MNK_OFFSET_ACTOR[battler.id] if MNK_OFFSET_ACTOR.include?(battler.id)
  327.       end
  328.       unless MNK_OFFSET_ENEMY == nil
  329.         offst += MNK_OFFSET_ENEMY[target.id] if MNK_OFFSET_ENEMY.include?(target.id)
  330.       end
  331.     end
  332.     if target.is_a?(Game_Actor) && battler.is_a?(Game_Enemy)
  333.       unless MNK_OFFSET_ENEMY == nil
  334.         offst += MNK_OFFSET_ENEMY[battler.id] if MNK_OFFSET_ENEMY.include?(battler.id)
  335.       end
  336.       unless MNK_OFFSET_ACTOR == nil
  337.         offst += MNK_OFFSET_ACTOR[target.id] if MNK_OFFSET_ACTOR.include?(target.id)
  338.       end
  339.     end
  340.     # Offset calc dependant on sideview
  341.     if $game_system.sv_angle == 1
  342.       offset = (battler.is_a?(Game_Actor) ? -(offst) : offst)
  343.     else
  344.       offset = (battler.is_a?(Game_Actor) ? offst : -(offst))
  345.     end
  346.     return offset
  347.   end
  348.   #--------------------------------------------------------------------------
  349.   # * Hit Animation
  350.   #--------------------------------------------------------------------------
  351.   alias mnk_update_phase4_step4 update_phase4_step4
  352.   def update_phase4_step4(battler = @active_battler)
  353.     # Cycle through the targets
  354.     for target in (@rtab ? battler.target : @target_battlers)
  355.       damage = (@rtab ? target.damage[battler] : target.damage)
  356.       critical = (@rtab ? target.critical[battler] : target.critical)
  357.       if damage.is_a?(Numeric) and damage > 0
  358.         base_pose = pose_obtain(target, MNK_POSE2, MNK_APOSE2, MNK_EPOSE2)
  359.         weapon_used = battler.weapon_id
  360.         weapon_used = 0 if weapon_used == nil
  361.         base_pose2 = pose_array_obtain(target, MNK_STRUCK_WEAPS, MNK_STRUCK_WEAPS_A, MNK_STRUCK_WEAPS_E, weapon_used)
  362.         base_pose = base_pose2 if base_pose2 != nil
  363.         if battler.strike_skill != 0
  364.           if battler.strike_skill == target.struck_skill
  365.             base_pose2 = pose_array_obtain(target, MNK_STRUCK_SKILLS, MNK_STRUCK_SKILLS_A, MNK_STRUCK_SKILLS_E, target.struck_skill)
  366.             base_pose = base_pose2 if base_pose2 != nil
  367.           end
  368.         end
  369.         if battler.strike_item != 0
  370.           if battler.strike_item == target.struck_item
  371.             base_pose2 = pose_array_obtain(target, MNK_STRUCK_ITEMS, MNK_STRUCK_ITEMS_A, MNK_STRUCK_ITEMS_E, target.struck_item)
  372.             base_pose = base_pose2 if base_pose2 != nil
  373.           end
  374.         end
  375.         @spriteset.battler(target).pose = base_pose
  376.         if critical == true
  377.           temp_pose = pose_obtain(target, MNK_POSES_CRITICAL, MNK_POSES_CRIT_A, MNK_POSES_CRIT_E)
  378.           weapon_used = battler.weapon_id
  379.           weapon_used = 0 if weapon_used == nil
  380.           base_pose2 = pose_array_obtain(target, MNK_CRIT_WEAPS, MNK_CRIT_WEAPS_A, MNK_CRIT_WEAPS_E, weapon_used)
  381.           base_pose = base_pose2 if base_pose2 != nil
  382.           if @skill_used != 0
  383.             if @skill_used == target.struck_skill
  384.               base_pose2 = pose_array_obtain(target, MNK_CRIT_SKILLS, MNK_CRIT_SKILLS_A, MNK_CRIT_SKILLS_E, target.struck_skill)
  385.               base_pose = base_pose2 if base_pose2 != nil
  386.             end
  387.           end
  388.           if @item_used != 0
  389.             if @item_used == target.struck_item
  390.               base_pose2 = pose_array_obtain(target, MNK_CRIT_ITEMS, MNK_CRIT_ITEMS_A, MNK_CRIT_ITEMS_E, target.struck_item)
  391.               base_pose = base_pose2 if base_pose2 != nil
  392.             end
  393.           end
  394.           @spriteset.battler(target).pose = temp_pose if temp_pose != nil
  395.         end
  396.       end
  397.     end
  398.     # Reset/zero out the battler's skill & item
  399.     battler.strike_skill  = 0
  400.     battler.strike_item   = 0
  401.     # Perform the original call
  402.     @rtab ? mnk_update_phase4_step4(battler) : mnk_update_phase4_step4
  403.     # Finish attack n battle animation, free to move
  404.     battler.attacking = false
  405.   end
  406.  
  407.   #--------------------------------------------------------------------------
  408.   # * Victory Animation
  409.   #--------------------------------------------------------------------------
  410.   alias mnk_start_phase5 start_phase5
  411.   def start_phase5
  412.     for actor in $game_party.actors
  413.       return if @spriteset.battler(actor).moving
  414.     end
  415.     # See if an actor remains alive
  416.     for actor in $game_party.actors
  417.       unless actor.dead?
  418.         $game_system.victory = true
  419.       end
  420.     end
  421.     # See if an enemy remains alive
  422.     for enemy in $game_troop.enemies.reverse
  423.       unless enemy.dead?
  424.         $game_system.defeat = true
  425.       end
  426.     end    
  427.     # Perform the original call    
  428.     mnk_start_phase5
  429.   end
  430.   #--------------------------------------------------------------------------
  431.   # * Change Arrow Viewport
  432.   #--------------------------------------------------------------------------
  433.   alias mnk_start_enemy_select start_enemy_select
  434.   def start_enemy_select
  435.     # Perform the original call
  436.     mnk_start_enemy_select
  437.     # Arrow manipulation
  438.     @enemy_arrow.dispose
  439.     @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport2)
  440.     @enemy_arrow.help_window = @help_window
  441.   end
  442.   #--------------------------------------------------------------------------
  443.   # * Obtain Pose (Scene Battle version)
  444.   #     battler     : battler performing attack
  445.   #     pose_base   : default pose to return
  446.   #     pose_actor  : list of poses for actors
  447.   #     pose_enemy  : list of poses for enemies
  448.   #--------------------------------------------------------------------------
  449.   def pose_obtain(battler, pose_base, pose_actor, pose_enemy)
  450.     # create Arrays
  451.     pos_a = {}
  452.     pos_e = {}
  453.     # fill created Arrays & Set pose
  454.     pos_a = pose_actor
  455.     pos_e = pose_enemy
  456.     pose_now = pose_base
  457.     # Obtain pose if not a standard pose
  458.     if battler.is_a?(Game_Actor)
  459.       pose_now = pos_a[battler.id] if pos_a[battler.id] != nil
  460.     else
  461.       pose_now = pos_e[battler.id] if pos_e[battler.id] != nil
  462.     end
  463.     # Return the final pose (minus 1 for niceties)
  464.     pose_now -= 1 if pose_now != nil
  465.     return pose_now
  466.   end
  467.  
  468.   #--------------------------------------------------------------------------
  469.   # * Obtain Pose from hashes (Scene Battle version)
  470.   #     battler     : battler performing attack
  471.   #     hash_base   : hash with default poses
  472.   #     hash_actor  : advanced list of poses for actors
  473.   #     hash_enemy  : advanced list of poses for enemies
  474.   #     condition   : value determining where to get the final pose
  475.   #--------------------------------------------------------------------------
  476.   def pose_array_obtain(battler, hash_base, hash_actor, hash_enemy, condition)
  477.     # create Arrays
  478.     # create Arrays
  479.     hash_b    = {}
  480.     hash_a    = {}
  481.     hash_e    = {}
  482.     pose_temp = {}
  483.     # fill created Arrays & Set pose
  484.     hash_b = hash_base
  485.     hash_a = hash_actor
  486.     hash_e = hash_enemy
  487.     # Setup the temp Array
  488.     if battler.is_a?(Game_Actor)
  489.       pose_temp = hash_a[battler.id] if hash_a.include?(battler.id)
  490.     else
  491.       pose_temp = hash_e[battler.id] if hash_e.include?(battler.id)
  492.     end
  493.     # Obtain the base pose based on condition (or nil)
  494.     pose_now = hash_b[condition] if hash_b.include?(condition)
  495.     # Obtain the optional actor/enemy pose based on condition (unless nil)
  496.     pose_now = pose_temp[condition] if pose_temp.include?(condition)
  497.     # Return the final pose (minus 1 for niceties)
  498.     pose_now -= 1 if pose_now != nil
  499.     return pose_now
  500.   end
  501. end
Expand to see the code.


  1. #==============================================================================
  2. # ** Animated Battlers - Enhanced   ver. 10.5                      (01-20-2007)
  3. #
  4. #------------------------------------------------------------------------------
  5. #  * (4) Miscellaneous:  Formations, Viewport and various Detection routines.
  6. #==============================================================================  
  7.  
  8. #============================================================================
  9. # ** Game_Temp
  10. #------------------------------------------------------------------------------
  11. #  This class handles temporary data that is not included with save data.
  12. #  Refer to "$game_temp" for the instance of this class.
  13. #==============================================================================
  14.  
  15. class Game_Temp
  16.   #--------------------------------------------------------------------------
  17.   # * Public Instance Variables
  18.   #--------------------------------------------------------------------------
  19.   attr_accessor :advantage_set            # holds value for sideview systems  
  20. end
  21.  
  22.  
  23. #==============================================================================
  24. # ** Game_System
  25. #------------------------------------------------------------------------------
  26. #  This class handles data surrounding the system. Backround music, etc.
  27. #  is managed here as well. Refer to "$game_system" for the instance of
  28. #  this class.
  29. #==============================================================================
  30.  
  31. class Game_System
  32.   #--------------------------------------------------------------------------
  33.   # * Public Instance Variables
  34.   #--------------------------------------------------------------------------
  35.   # Auto-Detection Values
  36.   attr_accessor :mnk_det_abs_detect       # Trickster's ATB System Detection
  37.   attr_accessor :mnk_det_acb_detect       # Action Cost Battlesystem Detection
  38.   attr_accessor :mnk_det_claihms_ts       # Claihm's Tactical Skills Detection
  39.   attr_accessor :mnk_det_para_spell       # ParaDog Detection
  40.   attr_accessor :mnk_det_rtab_attck       # Connected Attacking Detection
  41.   attr_accessor :mnk_det_rtab_systm       # RTAB Detection
  42.   attr_accessor :mnk_det_sd_casting       # DBS Skill Delay Detection
  43.   # Inter-Class variables
  44.   attr_accessor :max_member               # max members
  45.   attr_accessor :sv_angle                 # sideview system angle
  46.   attr_accessor :formation                # formation
  47.   attr_accessor :form_top                 # formation top
  48.   attr_accessor :form_wd                  # formation height
  49.   attr_accessor :bstat_ht                 # battlestatus height
  50.   attr_accessor :victory                  # victory boolean
  51.   attr_accessor :defeat                   # defeat boolean
  52.   # Additional values for the $global's save/load feature
  53.   attr_accessor :mnk_sm                   # sideview mirror
  54.   attr_accessor :mnk_fmm                  # formation max members
  55.   attr_accessor :mnk_fmh                  # formation max height
  56.   attr_accessor :mnk_fmw                  # formation max width
  57.   attr_accessor :mnk_bh                   # battlestatus height
  58.   attr_accessor :mnk_fs                   # formation style  
  59.   #--------------------------------------------------------------------------
  60.   # * Object Initialization
  61.   #--------------------------------------------------------------------------
  62.   alias mnk_init initialize
  63.   def initialize
  64.     # Perform the original call
  65.     mnk_init
  66.     # Create the savable values
  67.     @mnk_sm  = 0
  68.     @mnk_fmm = 4
  69.     @mnk_fmh = 220
  70.     @mnk_fmw = 128
  71.     @mnk_bh  = 160
  72.     @mnk_fs  = 0
  73.   end  
  74. end  
  75.  
  76.  
  77. #===================================================\==========================
  78. # ** Scene_Save
  79. #------------------------------------------------------------------------------
  80. #  This class performs save screen processing.
  81. #==============================================================================
  82.  
  83. class Scene_Save < Scene_File
  84.   #--------------------------------------------------------------------------
  85.   # * Write Save Data
  86.   #     file : write file object (opened)
  87.   #--------------------------------------------------------------------------
  88.   alias mnk_wsd write_save_data
  89.   def write_save_data(file)
  90.     # Store the globals
  91.     $game_system.mnk_sm  = $sideview_mirror
  92.     $game_system.mnk_fmm = $formation_max_member
  93.     $game_system.mnk_fmh = $formation_max_height
  94.     $game_system.mnk_fmw = $formation_max_width
  95.     $game_system.mnk_bh  = $battlestatus_height
  96.     $game_system.mnk_fs  = $formation_style
  97.     # Perform the original call
  98.     mnk_wsd(file)
  99.   end
  100. end
  101.  
  102.  
  103. #==============================================================================
  104. # ** Scene_Load
  105. #------------------------------------------------------------------------------
  106. #  This class performs load screen processing.
  107. #==============================================================================
  108.  
  109. class Scene_Load < Scene_File
  110.   #--------------------------------------------------------------------------
  111.   # * Read Save Data
  112.   #     file : file object for reading (opened)
  113.   #--------------------------------------------------------------------------
  114.   alias mnk_rsd read_save_data
  115.   def read_save_data(file)
  116.     #Perform the original call
  117.     mnk_rsd(file)
  118.     # ReStore the globals
  119.     $sideview_mirror      = $game_system.mnk_sm
  120.     $formation_max_member = $game_system.mnk_fmm
  121.     $formation_max_height = $game_system.mnk_fmh
  122.     $formation_max_width  = $game_system.mnk_fmw
  123.     $battlestatus_height  = $game_system.mnk_bh
  124.     $formation_style      = $game_system.mnk_fs
  125.   end
  126. end
  127.  
  128.  
  129. #==============================================================================
  130. # ** Game_Battler
  131. #------------------------------------------------------------------------------
  132. #  This class deals with battlers. It's used as a superclass for the Game_Actor
  133. #  and Game_Enemy classes.
  134. #==============================================================================
  135.  
  136. class Game_Battler
  137.   #--------------------------------------------------------------------------
  138.   # * Public Instance Variables
  139.   #--------------------------------------------------------------------------
  140.   attr_accessor :attacking                # if attacking
  141.   attr_accessor :casted                   # if spell is casted
  142.   attr_accessor :casting                  # if currently casting
  143.   attr_accessor :skill_casted             # ID of skill used
  144.   attr_accessor :strike_skill
  145.   attr_accessor :strike_item
  146.   attr_accessor :struck_weapon
  147.   attr_accessor :struck_skill
  148.   attr_accessor :struck_item
  149.   #--------------------------------------------------------------------------
  150.   # * Object Initialization
  151.   #--------------------------------------------------------------------------
  152.   alias mnk_init initialize
  153.   def initialize
  154.     @attacking      = false
  155.     @casted         = false
  156.     @casting        = false
  157.     @skill_casted   = 0
  158.     @strike_skill   = 0
  159.     @strike_item    = 0
  160.     @struck_weapon  = 0
  161.     @struck_skill   = 0
  162.     @struck_item    = 0
  163.     mnk_init
  164.     # ParaDog's Spell Delay Detection
  165.     if defined?(spelling?)
  166.       $game_system.mnk_det_para_spell = true
  167.     end
  168.     # DBS Spell Delay Detection
  169.     if @sd_casting != nil
  170.       $game_system.mnk_det_sd_casting = true
  171.     end
  172.     # Fomar's Action Cost Detection
  173.     if @vitality != nil
  174.       $game_system.mnk_det_acb_detect = true
  175.     end
  176.     # Trickster's AT Detection
  177.     if @at_bonus != nil
  178.       $game_system.mnk_det_abs_detect = true
  179.     end    
  180.   end
  181. end
  182.  
  183.  
  184.  
  185. #==============================================================================
  186. # ** Game_Actor
  187. #------------------------------------------------------------------------------
  188. #  This class handles the actor. It's used within the Game_Actors class
  189. #  ($game_actors) and refers to the Game_Party class ($game_party).
  190. #==============================================================================
  191.  
  192. class Game_Actor
  193.   alias mnk_ini initialize
  194.   def initialize(actor_id)
  195.     mnk_ini(actor_id)
  196.     if defined?(change_weapon)
  197.       $game_system.mnk_det_rtab_attck = true
  198.     end    
  199.   end    
  200.   #--------------------------------------------------------------------------
  201.   # * Actor X Coordinate
  202.   #--------------------------------------------------------------------------
  203.   def screen_x
  204.     # Determine minimum horizontal space between battlers
  205.     x_spacer = $game_system.form_wd / $game_system.max_member
  206.     if self.index != nil
  207.       case $game_system.formation
  208.       when 0                                    # DIAGONAL PATTERN 1
  209.         if $game_system.sv_angle == 1
  210.           return self.index * -x_spacer + (($game_system.max_member+1)*x_spacer) #202        
  211.         else
  212.           return self.index * x_spacer + (640-(($game_system.max_member+1)*x_spacer))#450
  213.         end          
  214.       when 1                                    # DIAGONAL PATTERN 2  
  215.         if $game_system.sv_angle == 1
  216.           return self.index * x_spacer + x_spacer #64        
  217.         else
  218.           return self.index * -x_spacer + (640-x_spacer*2) #576
  219.         end        
  220.       when 2                                    # 2-ROW SLANT
  221.         if $game_system.sv_angle == 1
  222.           if self.index < ($game_system.max_member/2)
  223.             return self.index + (($game_system.max_member+1)*x_spacer) + (x_spacer * self.index)
  224.           else
  225.             return self.index + (x_spacer * self.index) - x_spacer * 0.5
  226.           end
  227.         else
  228.           if self.index < ($game_system.max_member/2)
  229.             return self.index + (640-(($game_system.max_member+1)* x_spacer)) + (-x_spacer * self.index)
  230.           else
  231.             return self.index + (640-((x_spacer*0.5)-x_spacer)) + (-x_spacer * self.index)
  232.           end
  233.         end
  234.       when 3                                    # 2 ROW - SLANT
  235.         if $game_system.sv_angle == 1
  236.           if self.index < ($game_system.max_member/2)
  237.             return self.index + (x_spacer/2)+(($game_system.max_member+1)* x_spacer) + (-x_spacer * self.index)
  238.           else
  239.             return self.index + (($game_system.max_member+1)* x_spacer) + (-x_spacer * self.index)
  240.           end        
  241.         else
  242.           if self.index < ($game_system.max_member/2)
  243.             return self.index + 442 + (x_spacer * self.index)
  244.  
  245.           else
  246.             return self.index  + 430 + (x_spacer * self.index)
  247.           end        
  248.         end
  249.       when 4                                    # Column Pattern 1      
  250.         if $game_system.sv_angle == 1
  251.           if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 )
  252.             return self.index + ($game_system.max_member*(x_spacer*1.5)) + (-(x_spacer*1.5) * (self.index-1))
  253.           else
  254.             return self.index + ($game_system.max_member*(x_spacer*1.5)) + (-(x_spacer*1.5) * self.index)
  255.           end        
  256.         else
  257.           if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 )
  258.             return self.index + 640-($game_system.max_member*(x_spacer*1.5)) + ((x_spacer*1.5) * (self.index-1))
  259.           else
  260.             return self.index + 640-($game_system.max_member*(x_spacer*1.5)) + ((x_spacer*1.5) * self.index)
  261.           end        
  262.         end
  263.       when 5                                    # Column Pattern 2
  264.         if $game_system.sv_angle == 1
  265.           if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 )
  266.             return self.index + ($game_system.max_member*(x_spacer*1.5)) + (-(x_spacer*1.5) * (self.index-1))
  267.           else
  268.             return self.index + ($game_system.max_member*(x_spacer*1.5)) + (-(x_spacer*1.5) * self.index)
  269.           end        
  270.         else
  271.           if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 )
  272.             return self.index + 640-($game_system.max_member*(x_spacer*1.5)) + ((x_spacer*1.5) * (self.index-1))
  273.           else
  274.             return self.index + 640-($game_system.max_member*(x_spacer*1.5)) + ((x_spacer*1.5) * self.index)
  275.           end    
  276.         end
  277.       when 6                                    # Wave Formation 1
  278.         if $game_system.sv_angle == 1
  279.           if self.index < ($game_system.max_member/2)
  280.             return 170
  281.           else
  282.             return  90
  283.           end        
  284.         else
  285.           if self.index < ($game_system.max_member/2)
  286.             return 470
  287.           else
  288.             return 550
  289.           end        
  290.         end
  291.       else                                      # Wave Formation 2
  292.         if $game_system.sv_angle == 1
  293.           if self.index < ($game_system.max_member/2)
  294.             return 170
  295.           else
  296.             return  90
  297.           end        
  298.         else
  299.           if self.index < ($game_system.max_member/2)
  300.             return 470
  301.           else
  302.             return 550
  303.           end        
  304.         end
  305.       end
  306.     else
  307.       return 0
  308.     end
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   # * Actor Y Coordinate
  312.   #--------------------------------------------------------------------------
  313.   def screen_y
  314.     # Determine minimum vertical space between battlers
  315.     y_spacer = (480 - $game_system.bstat_ht - $game_system.form_top) / $game_system.max_member
  316.    
  317.     if self.index != nil
  318.       case $game_system.formation
  319.       # DIAGONAL PATTERNS ( 1 & 2 )
  320.       when 0, 1
  321.         return self.index * (y_spacer * 1.25) + $game_system.form_top
  322.       # TWO-ROW SLANTS ( 1 & 2 )
  323.       when 2, 3
  324.         if self.index < ($game_system.max_member / 2)
  325.           return $game_system.form_top + ((y_spacer * 2.5) * self.index)
  326.         else
  327.           return ($game_system.form_top - (y_spacer*($game_system.max_member + 1))) + ((y_spacer*2.5) * self.index) #was 60
  328.         end        
  329.       # COLUMN PATTERNS (1 & 2)        
  330.       when 4
  331.         if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 )          
  332.           return $game_system.form_top + ($game_system.bstat_ht / 2)
  333.         else
  334.           return $game_system.form_top + ($game_system.bstat_ht / 6)
  335.         end
  336.       when 5
  337.         if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 )          
  338.           return $game_system.form_top + ($game_system.bstat_ht / 6)
  339.         else
  340.           return $game_system.form_top + ($game_system.bstat_ht / 2)
  341.         end
  342.       # BOX PATTERN (1 & 2)  
  343.       when 6
  344.         if self.index < ($game_system.max_member / 2)
  345.           return $game_system.form_top + (y_spacer * 2.5 *  self.index)
  346.         else
  347.           return $game_system.form_top + (y_spacer * 2.5 * ((self.index) - ($game_system.max_member / 2)))
  348.         end  
  349.       else
  350.         if self.index < ($game_system.max_member / 2)
  351.           return $game_system.form_top + (y_spacer * 2.5 * (($game_system.max_member / 2) - 1))+ (y_spacer * 2.5 * -self.index)
  352.         else
  353.           return $game_system.form_top + (y_spacer * 2.5 * (($game_system.max_member / 2) - 1)) + (y_spacer * 2.5 * -((self.index) - ($game_system.max_member / 2)))
  354.         end  
  355.       end
  356.     end
  357.   end
  358.   #--------------------------------------------------------------------------
  359.   # * Actor Z Coordinate
  360.   #--------------------------------------------------------------------------
  361.   def screen_z
  362.     return screen_y
  363.   end
  364. end
  365.  
  366.  
  367. #==============================================================================
  368. # ** Game_Enemy
  369. #------------------------------------------------------------------------------
  370. #  This class handles enemies. It's used within the Game_Troop class
  371. #  ($game_troop).
  372. #==============================================================================
  373.  
  374. class Game_Enemy < Game_Battler
  375.   #--------------------------------------------------------------------------
  376.   # * Get Battle Screen X-Coordinate
  377.   #--------------------------------------------------------------------------
  378.   def screen_x
  379.     if self.index != nil
  380.       if $game_system.sv_angle == 1
  381.         return 640 - $data_troops[@troop_id].members[@member_index].x
  382.       else
  383.         return $data_troops[@troop_id].members[@member_index].x
  384.       end
  385.     end
  386.   end
  387.   #--------------------------------------------------------------------------
  388.   # * Actor Z Coordinate
  389.   #--------------------------------------------------------------------------
  390.   def screen_z
  391.     return screen_y
  392.   end  
  393. end
  394.  
  395.  
  396. #==============================================================================
  397. # ** Game_Party
  398. #------------------------------------------------------------------------------
  399. #  This class handles the party. It includes information on amount of gold
  400. #  and items. Refer to "$game_party" for the instance of this class.
  401. #==============================================================================
  402.  
  403. class Game_Party
  404.   #--------------------------------------------------------------------------
  405.   # * Public Instance Variables
  406.   #--------------------------------------------------------------------------
  407.   attr_reader   :party_size
  408. end
  409.  
  410.  
  411. #==============================================================================
  412. # ** Spriteset_Battle
  413. #------------------------------------------------------------------------------
  414. #  This class brings together battle screen sprites. It's used within
  415. #  the Scene_Battle class.
  416. #==============================================================================
  417.  
  418. class Spriteset_Battle
  419.   #--------------------------------------------------------------------------
  420.   # * Change Enemy Viewport
  421.   #--------------------------------------------------------------------------
  422.   alias mnk_initialize initialize
  423.   def initialize
  424.     mnk_initialize
  425.     # Determine if RTAB system in use
  426.     if @real_zoom != nil
  427.       $game_system.mnk_det_rtab_systm = true
  428.     end
  429.     @enemy_sprites = []
  430.     for enemy in $game_troop.enemies.reverse
  431.       @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  432.     end
  433.   end
  434.   #--------------------------------------------------------------------------
  435.   # * Frame Update
  436.   #--------------------------------------------------------------------------
  437.   alias mnk_update update
  438.   def update
  439.     # Set current number of battlers
  440.     mnkps = 4
  441.     mnkps = $game_party.party_size if $game_party.party_size != nil
  442.     # Added routine to load battlers during combat
  443.     unless @mnk_battlers_reloaded
  444.       @actor_sprites = []
  445.       for i in 0...mnkps
  446.         @actor_sprites.push(Sprite_Battler.new(@viewport1))
  447.       end
  448.       @mnk_battlers_reloaded = true
  449.     end      
  450.     # Perform the original call    
  451.     mnk_update
  452.     # 'Re-'Update actor sprite contents (corresponds with actor switching)
  453.     for i in 0...mnkps
  454.       @actor_sprites[i].battler = $game_party.actors[i]
  455.     end    
  456.   end
  457.   #--------------------------------------------------------------------------
  458.   # * Find Sprite From Battler Handle
  459.   #--------------------------------------------------------------------------
  460.   def battler(handle)
  461.     for sprite in @actor_sprites + @enemy_sprites
  462.       return sprite if sprite.battler == handle
  463.     end
  464.   end
  465. end
  466.  
  467.  
  468. #==============================================================================
  469. # ** Arrow_Base
  470. #------------------------------------------------------------------------------
  471. #  This sprite is used as an arrow cursor for the battle screen. This class
  472. #  is used as a superclass for the Arrow_Enemy and Arrow_Actor classes.
  473. #==============================================================================
  474.  
  475. class Arrow_Base < Sprite
  476.   #--------------------------------------------------------------------------
  477.   # * Reposition Arrows
  478.   #--------------------------------------------------------------------------
  479.   alias mnk_initialize initialize
  480.   def initialize(viewport)
  481.     mnk_initialize(viewport)
  482.     self.ox = MNK_ARROW_X
  483.     self.oy = MNK_ARROW_Y
  484.   end
  485. end
Expand to see the code.


and the esc menu removal script
  1.  
Expand to see the code.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=77661