(VX) Fix for Kylock's Dynamic Party Positions

Hi everyone! Hope you're all fine!
I'd like to bring back this topic I posted a long time ago.

So, I have this script (Made for Tankentai SBS) that allows you to change the actors' screen position during battle when there are less than 4 people in the party, like this:

PIC.png

(See how they're not in their original spots? I set it so they use evenly all the space they have in their row so the bottom part doesn't look empty. You can change these positions however you want. This is tested in a clean RPGMVX Project)


Initially, the script works perfecly, yet when you save, get out of the game (closing the game window), reenter it and load the game, after you enter any battle this error pops up:


91b0c53606daf7fa3a3a483b840e7acdo.jpg

Does anyone have an idea of what might be happening??
This script is just too cool to not use it, so I'd really appreciate the help!

Thanks for reading! 😀

Here's the script!
Spoiler: Script
Code:
#=============================================================================
# Kylock's Dynamic Party Positions for RPG Tankentai Sideview Battle System
# By Kylock
#=============================================================================
# This add-on by Kylock will dynamically change the positioning of
# party members in battle depending on the amount of party members that
# are fighting.  This script has no effect on anything else besides how
# actor sprites are positioned.
#
# To customize coordinates, read the comments in the middle of this script.
#
# The ACTOR_POSITION array and MAX_MEMBERS value in the SBS Configurations
# script are overwritten by this script.
#
# Positions will not be dynamic when used in Battle Test.
#
# *Installation:
#   This script add-on should be placed below the Sideview scripts in the
# script editor.  KGC_LargeParty should be placed BELOW this add-on if you are
# using that script.
#
# *Script comments added by Mr. Bubble.
#=============================================================================

module N01
  MAX_BATTLE_MEMBERS = 4    # Max battle members in a party.  This value is
                            # overwritten by KGC_LargeParty.
end

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # * Constants
  #--------------------------------------------------------------------------
  MAX_MEMBERS = N01::MAX_BATTLE_MEMBERS       # Maximum number of party members
  def add_actor(actor_id)
    if @actors.size < MAX_MEMBERS and not @actors.include?(actor_id)
      @actors.push(actor_id)
      $game_player.refresh
      update_formation
    end
  end
  def setup_starting_members
    @actors = []
    for i in $data_system.party_members
      @actors.push(i)
    end
    update_formation
  end
  def remove_actor(actor_id)
    @actors.delete(actor_id)
    $game_player.refresh
    update_formation
  end
  def update_formation
    case @actors.size
  # This section is where you define your member coordinates.
  # The coordinate set that is used depends on the amount of actors battling.
  # Settings for up to 5 members are already pre-defined, but more can be added.
  # These coordinates are not used in Battle Test. See bottom of script for info.
    when 1: $ACTOR_POSITION = [[415,185],[0,0],[0,0],[0,0]]
    when 2: $ACTOR_POSITION = [[395,155],[435,215],[0,0],[0,0]]
    when 3: $ACTOR_POSITION = [[385,140],[415,185],[445,230],[0,0]]
    when 4: $ACTOR_POSITION = [[385,140],[405,170],[425,200],[445,230]]
    end
  end
end

module N01
 #--------------------------------------------------------------------------
 # ● Settings
 #--------------------------------------------------------------------------
  # Actor starting posistions
  #                   X   Y     X   Y     X   Y     X   Y
  #$ACTOR_POSITION = [[440,200],[480,160],[455,200],[505,220],[480,260]]
  # Maximum party members that can fight at the same time.
  # Remember to add to the ACTOR_POSITION array to accomodate.
  MAX_MEMBER = N01::MAX_BATTLE_MEMBERS
end

class Game_Actor < Game_Battler
  def base_position    # Actor positions for Battle Test only.
    $ACTOR_POSITION = [[430,140],[480,160],[455,200],[505,220],[480,260]] if $BTEST
    base = $ACTOR_POSITION[self.index]
    @base_position_x = base[0]
    @base_position_y = base[1]
    # バックアタック時はX軸を逆に
    @base_position_x = Graphics.width - base[0] if $back_attack && N01::BACK_ATTACK
  end
end
Anyone? Bumpie bump 😮

Original thread: https://forums.rpgmakerweb.com/threads/vx-fix-for-kylocks-dynamic-party-positions.89715/