Script Conflict? Crashing in Battle

Discussion in 'RGSSx Script Support' started by Nightblade50, Sep 26, 2019.

  1. Nightblade50

    Nightblade50 Developer of "Delta Origins" Veteran

    Messages:
    2,066
    Likes Received:
    4,190
    Location:
    USA
    First Language:
    English, French
    Primarily Uses:
    RMVXA
    Hey.
    I am using a few scripts for the battle in my RPG Maker game.
    1. Galv's Animated Battlers
    2. Moghunter's Battle HUD Ex
    3. Mogunter's ATB

    Now I have this one battle in which halfway through, another character joins the fight. I set this up with an event triggered to run in the battle, using the Troop window. It does the [Change Party Member] command. However, when this happens, the game crashes, with "Sprite disposed" error. I'm not sure why it happens, but I think its probably a script conflict with the animated battlers. Or maybe it's trying to add another character to the ATB UI image (Moghunter's ATB Schala HUD) and crashes the game.

    Can anyone help?
     
    #1
  2. Nightblade50

    Nightblade50 Developer of "Delta Origins" Veteran

    Messages:
    2,066
    Likes Received:
    4,190
    Location:
    USA
    First Language:
    English, French
    Primarily Uses:
    RMVXA
    Bump
     
    #2
  3. Shaz

    Shaz Veteran Veteran

    Messages:
    37,815
    Likes Received:
    11,523
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Please provide the full error message text. I'd expect it would normally show a script name and line number in addition to the issue description.

    Grab the backtrace script and add it (you'll need to search for it, but it shouldn't be hard to find), then trigger the error. Post the results of that, as shown in the console.
     
    #3
  4. Ossra

    Ossra Formerly Exhydra Veteran

    Messages:
    871
    Likes Received:
    633
    First Language:
    English
    Primarily Uses:
    RMMV
    @Nightblade50 More details of the error might help narrow down the issue. In the RPG Maker VX Ace editor, go to the 'Game' menu and make certain that the 'Show Console' option is selected. Next, place the following script below 'Main' and comment out the 'rgss_main { SceneManager.run }' line within 'Main' :

    Code:
    begin
      rgss_main do
        begin
          SceneManager.run
        rescue RGSSReset
          rgss_stop
        end
      end
    rescue SystemExit
      exit
    rescue Exception => error
      if $TEST || $BTEST
        scripts_name = load_data('Data/Scripts.rvdata2')
        scripts_name.collect! {|script|  script[1]  }
        backtrace = []
        error.backtrace.each_with_index {|line,i|
          if line =~ /{(.*)}(.*)/
            backtrace << (scripts_name[$1.to_i] + $2)
          elsif line.start_with?(':1:')
            break
          else
            backtrace << line
          end
        }
        error_line = backtrace.first
        backtrace[0] = ''
        print error_line, ": ", error.message, " (#{error.class})", backtrace.join("\n\tfrom "), "\n"
        raise  error.class, "An error ocurred. Please check the debug console for more information.", [error.backtrace.first]
      else
        File.open('error.txt', 'w') do |err_file|
          err_file.write(error.backtrace)
        end
      
        raise  error.class, "An error ocurred. Please check 'error.txt' in the game directory for more information.", [error.backtrace.first]
      end
    end
    Once that is done, run the game and attempt to recreate the error. Once the error occurs, left-click and drag your cursor over the text in the console to highlight the output. Afterward, right-click to copy the highlighted text.

    If you cannot highlight or right-click copy the text in the console window, click on the icon in the upper left hand corner of the window and select the 'Defaults' option. In the 'Console Windows Properties' window that pops up, check-mark the 'QuickEdit Mode' and press the 'Ok' button. You should now be able to highlight and right-click copy of the text.
     
    #4
  5. Nightblade50

    Nightblade50 Developer of "Delta Origins" Veteran

    Messages:
    2,066
    Likes Received:
    4,190
    Location:
    USA
    First Language:
    English, French
    Primarily Uses:
    RMVXA
    This is the error message.
    ErrorMessage1.png
    This is the console text:
    Code:
    MOG_Battle_Command_EX:1063:in `visible=': disposed sprite (RGSSError)
            from MOG_Battle_Command_EX:1063:in `update_battle_command'
            from MOG_Battle_Command_EX:1012:in `block in update_sprite_battle_command'
            from MOG_Battle_Command_EX:1012:in `each'
            from MOG_Battle_Command_EX:1012:in `each_with_index'
            from MOG_Battle_Command_EX:1012:in `update_sprite_battle_command'
            from MOG_Battle_Command_EX:994:in `update'
            from Scene_Base:95:in `block in update_all_windows'
            from Scene_Base:93:in `each'
            from Scene_Base:93:in `update_all_windows'
            from Scene_Base:49:in `update_basic'
            from Scene_Battle:56:in `update_basic'
            from Ace Battle Engine:2579:in `update_basic'
            from MOG_ATB:2270:in `update_basic'
            from MOG_Battle_Command_EX:340:in `update_basic'
            from Scene_Battle:67:in `update_for_wait'
            from Scene_Battle:98:in `wait_for_message'
            from Scene_Battle:517:in `process_event'
            from MOG_ATB:2332:in `process_event'
            from MOG_ATB:2397:in `execute_event_phase'
            from MOG_ATB:2025:in `show_animation'
            from Galv's Animated Battlers:549:in `show_animation'
            from Ace Battle Engine:3107:in `invoke_item'
            from CP Enemy Scan:515:in `invoke_item'
            from Ace Battle Engine:3096:in `block (2 levels) in use_item'
            from Ace Battle Engine:3096:in `times'
            from Ace Battle Engine:3096:in `block in use_item'
            from Ace Battle Engine:3092:in `each'
            from Ace Battle Engine:3092:in `use_item'
            from MOG_ATB:2017:in `use_item'
            from MOG_Battle_Hud_EX:5583:in `use_item'
            from Ace Battle Engine:2993:in `execute_action'
            from MOG_ATB:2008:in `execute_action'
            from MOG_ATB:2203:in `process_execute_action'
            from MOG_ATB:1682:in `block in process_action_atb'
            from MOG_ATB:1669:in `loop'
            from MOG_ATB:1669:in `process_action_atb'
            from MOG_ATB:1593:in `process_action'
            from MOG_ATB:2258:in `update'
            from MOG_Battle_Hud_EX:1569:in `update'
            from CP Enemy Scan:467:in `update'
            from Scene_Base:14:in `main'
            from SceneManager:23:in `run'
            from Map Screenshot:986:in `run'
            from Main:9:in `block in <main>'
     
    #5
  6. Ossra

    Ossra Formerly Exhydra Veteran

    Messages:
    871
    Likes Received:
    633
    First Language:
    English
    Primarily Uses:
    RMMV
    @Nightblade50 Would it be possible to paste the 'MOG_Battle_Command_EX' script here? I am having some difficulty in tracking that exact script down.
     
    #6
  7. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,741
    Likes Received:
    381
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    #7
    Ossra likes this.
  8. Ossra

    Ossra Formerly Exhydra Veteran

    Messages:
    871
    Likes Received:
    633
    First Language:
    English
    Primarily Uses:
    RMMV
    @Roninator2 Thank you.

    @Nightblade50 The error might not be due to a script incompatibility. The 'Battle Command Ex' script appears to not be entirely prepared for the addition of an actor into the party during a battle. To work around the error, insert the following code at line 1063 :

    Code:
    return if bc_sprite.disposed?
    The function should now appear like the following :

    Code:
      def update_battle_command(bc_sprite,index)
          return if bc_sprite.disposed?
          bc_sprite.visible = bc_visible?
          update_bc_zoom_effect(bc_sprite,index)
          update_bc_slide_effect(bc_sprite,index)
          update_ring_position(bc_sprite,index) if COMMAND_TYPE == 4
      end
    
     
    #8
  9. A-Moonless-Night

    A-Moonless-Night WINTER IS COMING Veteran

    Messages:
    509
    Likes Received:
    364
    Location:
    New Zealand
    First Language:
    English
    Primarily Uses:
    RMVXA
    I had the same issue in my project and I believe this fixed it:

    Code:
    class Window_ActorCommand < Window_Command
    
      def refresh
          return if @actor == nil
          if battle_hud_ex_position?
          self.viewport = nil
          @bex = [$game_temp.hud_pos[@actor.index][0] + MOG_BATTLE_HUD_EX::ACTOR_COMMAND_POSITION[0] - (self.window_width / 2),
          $game_temp.hud_pos[@actor.index][1] + MOG_BATTLE_HUD_EX::ACTOR_COMMAND_POSITION[1] - @stwh[1] ]
          end
          clear_command_list ; make_command_list ; create_contents
          contents.clear
          self.index = 0 if self.index > @list.size
          set_window_position
          dispose_sprite_command if @actor_old != @actor
          @actor_old = @actor ; refresh_layout_bt; create_sprite_icons ; draw_all_items
          set_slide_effect
          update_sprite_battle_command   
      end
     
      def update_command_name
        return if @sprite_command_name == nil || @sprite_command_name.disposed?
        refresh_command_name if @old_name_index != self.index   
        @sprite_command_name.visible = @sprite_commands[0].visible   
      end
        
      def update_battle_command(bc_sprite,index)
        return if bc_sprite.disposed?
        bc_sprite.visible = bc_visible?
        update_bc_zoom_effect(bc_sprite,index)
        update_bc_slide_effect(bc_sprite,index)
        update_ring_position(bc_sprite,index) if COMMAND_TYPE == 4
      end
    
    end
     
    #9
  10. Nightblade50

    Nightblade50 Developer of "Delta Origins" Veteran

    Messages:
    2,066
    Likes Received:
    4,190
    Location:
    USA
    First Language:
    English, French
    Primarily Uses:
    RMVXA
    thanks so much you two! <3 it works now!!
     
    #10
    A-Moonless-Night likes this.

Share This Page