[VX Ace][SOLVED] Game stuck in loop when state change happens while custom Jump attack is being used

Hello,
I am working on a modified version of Ellye's Combat Interface that includes animation for a custom Jump attack. The attack works, but if any battler's state changes (friend or foe, it doesn't matter) while a character is in the air, the game freezes.
Spoiler: Script
Code:
#-------------------------------------------------------------------
# Ellye's Combat Interface (Modified)
# A Combat UI script made by Ellye and modified by The_Fireplace.
# This is a free script for all use, provided "as is", no warranties.
#-------------------------------------------------------------------
 
#--------------------------------------------------------------------------
# * Custom Bugfix: Load actor sprite when an actor is added during battle.
#--------------------------------------------------------------------------
class Game_Party
  alias :old_add_actor :add_actor
  def add_actor(actor_id)
    old_add_actor(actor_id)
    if($game_party.in_battle)
      members[-1].on_battle_start
    end
  end
end

class Game_BaseItem
  #Custom: make action id readable.
  attr_reader   :item_id
end

class Game_BattlerBase
  #Custom variable: in_air for jump attacks
  attr_accessor   :in_air
end

class Sprite_Battler
  #Custom: Make sure the sprite doesn't show up when the actor is in the air
  def init_visibility
    @battler_visible = @battler.alive? && [email protected]_air
    self.opacity = 0 unless @battler_visible
  end
end
 
#--------------------------------------------------------------------------
# * Uses charset sprites as Actor battlers sprites
#--------------------------------------------------------------------------
class Game_Actor
  attr_accessor :screen_x
  attr_accessor :screen_y             
  attr_accessor :screen_z
 
  alias :old_initialize :initialize
  def initialize(actor_id)
    old_initialize(actor_id)
    @screen_x = 0
    @screen_y = 0
  end
 
  def screen_z
    return 100
  end
 
  def use_sprite?
    return true
  end
 
  alias :old_on_battle_start :on_battle_start
  def on_battle_start
    old_on_battle_start
    #Custom: modified to display them all on one row
    @screen_x = 180 + (109 * self.index)
    @screen_y = 340
  end
 
end
 
class Sprite_Battler
  def update_bitmap
    char_w = 32
    char_h = 32
  
    if @battler.battler_name == "" && @battler.character_name != ""
      @battler.character_index < 4 ? rect_y = char_h*3 : rect_y = char_h*7 #Selecting correct row for the sprite (Standard size)
      rect_x =  char_w + (char_w*3*(@battler.character_index % 4)) #Selecting correct column  for the sprite (Standard size)
      new_bitmap_cs = Cache.character(@battler.character_name) #Load charset
      new_bitmap = Bitmap.new(char_w, char_h) #Make empty, standard character sized, bitmap
      new_bitmap.blt(0, 0, new_bitmap_cs, Rect.new(rect_x, rect_y, char_w, char_h))  #Copies the sprite from the charset to the new bitmap
    else
      new_bitmap = Cache.battler(@battler.battler_name, @battler.battler_hue)
    end
 
    if bitmap != new_bitmap
      self.bitmap = new_bitmap
      init_visibility
    end
 
  end
 
  #--------------------------------------------------------------------------
  # * Changing the duration of some effects, and adding a new :pounce effect for physical attacks
  #--------------------------------------------------------------------------
  def start_effect(effect_type)
    @effect_type = effect_type
    case @effect_type
    when :appear
      @effect_duration = 32
      @battler_visible = true
    when :disappear
      @effect_duration = 64
      @battler_visible = false
    when :pounce
      @effect_duration = 32
      @battler_visible = true
    when :leap#Custom: For jump attacks
      @effect_duration = 64
      @battler.in_air = true
    when :fall#Custom: For jump attacks, part 2
      @effect_duration = 64
      @battler.in_air = false
    when :whiten
      @effect_duration = 32
      @battler_visible = true
    when :blink
      @effect_duration = 40
      @battler_visible = true
    when :collapse
      @effect_duration = 48
      @battler_visible = false
    when :boss_collapse
      @effect_duration = bitmap.height
      @battler_visible = false
    when :instant_collapse
      @effect_duration = 16
      @battler_visible = false
    end
    revert_to_normal
  end
#--------------------------------------------------------------------------
# * Updating the Pounce Effect
#--------------------------------------------------------------------------
    def update_effect
      if @effect_duration > 0
        @effect_duration -= 1
        case @effect_type
        when :pounce
          update_pounce
        when :leap#Custom: For jump attacks
          update_leap
        when :fall#Custom: For fall attacks (Part 2 of Jump)
          update_fall
        when :whiten
          update_whiten
        when :blink
          update_blink
        when :appear
          update_appear
        when :disappear
          update_disappear
        when :collapse
          update_collapse
        when :boss_collapse
          update_boss_collapse
        when :instant_collapse
          update_instant_collapse
        end
        @effect_type = nil if @effect_duration == 0
      end
    end
 
  def update_pounce
    @effect_duration > 16 ? self.oy += 32 - @effect_duration : self.oy += @effect_duration
  end
 
  #Custom: Leap into the air
  def update_leap
    self.oy += 64*5 - @effect_duration*5
  end
 
  #Custom: Fall on the enemy
  def update_fall
    self.oy += @effect_duration*5
  end
 
  alias :old_revert_to_normal :revert_to_normal
  def revert_to_normal
    old_revert_to_normal
    self.oy = bitmap.height
  end
 
end
 
#--------------------------------------------------------------------------
# *  Battle Scene layout
#--------------------------------------------------------------------------
class Scene_Battle
  #Custom: Make sure Jump is cancelled
  alias :old_start :start
  def start
    old_start
    $game_temp.reserve_common_event(1)
  end
 
  alias :old_create_status_window :create_status_window
  def create_status_window
    old_create_status_window
    @status_window.x = 137
    @status_window.set_handler(:ok,     method(:on_actor_ok)) #We will use the status window for party-targeting
    @status_window.set_handler(:cancel, method(:on_actor_cancel)) #We will use the status window for party-targeting
  end
 
  alias :old_create_info_viewport :create_info_viewport
  def create_info_viewport
    old_create_info_viewport
    @info_viewport.ox = 0
  end
 
  def move_info_viewport(ox)
    current_ox = @info_viewport.ox #don't move anymore
  end
 
  alias :old_create_actor_command_window :create_actor_command_window
  def create_actor_command_window
    old_create_actor_command_window
    @actor_command_window.x = Graphics.width - @actor_command_window.width
  end
 
  def select_actor_selection
    @status_window.refresh
    @status_window.activate #We will use the status window for party-targeting
  end
 
  def on_actor_ok
    BattleManager.actor.input.target_index = @status_window.index #We will use the status window for party-targeting
    @actor_window.hide
    @skill_window.hide
    @item_window.hide
    next_command
  end
 
  def abs_wait_short
    abs_wait(20)
  end
 
  def execute_action
    #Custom: Check for jump/fall attacks before using pounce/whiten
    if @subject.current_action.item.note.include? "<leap>"
      @subject.sprite_effect_type = :leap
    elsif @subject.current_action.item.note.include? "<fall>"
      @subject.sprite_effect_type = :fall
    elsif @subject.actor?
      @subject.sprite_effect_type = :pounce #changed to the custom pounce effect
    else
      @subject.sprite_effect_type = :whiten #enemies still look better with whiten
    end
    use_item
    abs_wait_short #Slowing things down a bit
    @log_window.wait_and_clear
  end
end
 
 #--------------------------------------------------------------------------
 # *  Battle Status Window layout
 # *  Modified by The_Fireplace to display 4 in one row. (Original Script: 3)
 #--------------------------------------------------------------------------
class Window_BattleStatus
  def initialize
      super(0, 0, window_width, window_height)
      refresh
      self.openness = 0
      self.opacity = 0
  end
  def window_width
    436
  end
  def window_height
    120
  end
  def col_max
    return 4
  end
  def spacing
    return 6
  end
  def standard_padding
    return 0
  end
  def item_height
    return 48
  end
  def item_rect(index)
      rect = Rect.new
      rect.width = item_width
      rect.height = item_height
      rect.x = index % col_max * (item_width + spacing)
      rect.y = 8 + (index / col_max * (item_height + 16))
      rect
  end
 
  def draw_vertical_actor_icons(actor, x, y, height = 24)
    icons = (actor.state_icons + actor.buff_icons)[0, height / 24]
    icons.each_with_index {|n, i| draw_icon(n, x, y + 24*i) }
  end
 
  def draw_item(index)
    actor = $game_party.battle_members[index]
    rect = item_rect(index)
    draw_actor_hp(actor, rect.x, rect.y+40, rect.width)
    draw_vertical_actor_icons(actor, rect.x, rect.y)
    if $data_system.opt_display_tp
      draw_actor_mp(actor, rect.x, rect.y+60, (rect.width/2)-1)
      draw_actor_tp(actor, rect.x+(rect.width/2)+2, rect.y+60, (rect.width/2)-1)
    else
      draw_actor_mp(actor, rect.x, rect.y+60, rect.width)
    end
  end
end
 
#--------------------------------------------------------------------------
# *  Battle Log - slowing it down a bit
#--------------------------------------------------------------------------
class Window_BattleLog
 
  def display_action_results(target, item)
    if target.result.used
      last_line_number = line_number
      display_critical(target, item)
      display_damage(target, item)
      display_affected_status(target, item)
      display_failure(target, item)
      wait if line_number > last_line_number
    end
  end
 
  def wait_and_clear
    wait while @num_wait < 4 if line_number > 0
    clear
  end
 
end

Here's a sample project. Just run it, and it will put you in a battle with Eric as the dragoon, and Ryoma so someone can be hit by attacks. Have Eric Jump, and the enemies will blind Ryoma when they attack him. At that point, the game will freeze.

If someone could help me figure out why it freezes, that would be very much appreciated.

One other thing I've noticed is that even though it's frozen, it doesn't say "Game has stopped responding" or anything like that, which leads me to think it could be an infinite loop that it gets stuck on (I don't know how it would handle one).
Update: Using print statements I found that Scene_Battle's update_basic method is still getting continuously called when the game is stuck. The only question now is why it stops updating the battle. I think it's stuck in a loop, possibly related to my modification of Sprite_Battler's init_visibility
Is Ryoma getting blinded what specifically triggers the crash? In the demo, his defense is so high, the enemy's attack never lands, so he never gets blinded, and the jump skill works fine. I'd make the blinding a 100% chance and check myself, but I don't have VXA.

If so, then my guess would be that it's probably either the blind animation interfering with the script, in which case making it specific to the one actor that can jump might help, or it might be that having another character inflicted with any status is somehow conflicting.

As stated earlier, I don't have VXA, so I can't edit the demo. Try and see if removing the blind animation changes anything, as that should help identify the problem. I'm not the greatest at scripting, so I probably couldn't fix the script for you once you figure out the problem, but I'd at least like to help you get started with fixing it.
It's not just blind, any state change causes it. Whether it is Ryoma being blinded, Ryoma killing an enemy, or something else, if the state of anything changes while Eric is in the air, the game will freeze. Also, in the demo, blind is set to a 100% chance on hit. If that for some reason doesn't work, have Ryoma kill an enemy while Eric is in the air, it will also produce the crash.
Ok, I successfully re-produced the crash by killing an enemy while Eric was in the air, causing an enemy state change. I don't have access to the VXA rtp script library, so I can't be certain, but I think it may have something to do with the

Code:
  def update_effect
      if @effect_duration > 0
        @effect_duration -= 1
        case @effect_type

section. You said that the Scene_Battle's update_basic_method was being called repeatedly, so there might be something in the script's update_effect method that is conflicting with update_basic_method.
Ok, I successfully re-produced the crash by killing an enemy while Eric was in the air, causing an enemy state change. I don't have access to the VXA rtp script library, so I can't be certain, but I think it may have something to do with the

Code:
  def update_effect
      if @effect_duration > 0
        @effect_duration -= 1
        case @effect_type

section. You said that the Scene_Battle's update_basic_method was being called repeatedly, so there might be something in the script's update_effect method that is conflicting with update_basic_method.
Thanks! That got me to follow the trail of code to find that I needed to override setup_new_effect in Sprite_Battler to make the actor in the air not try to appear if it is in the air.

Original thread: https://forums.rpgmakerweb.com/threads/vx-ace-solved-game-stuck-in-loop-when-state-change-happens-while-custom-jump-attack-is-being-used.87115/