Class extension Error

I am having a problem with a script I am trying to use and when I start a new game it gives me this error.
1598739229793.png

Here is the script I am trying to use:
(Do note that when I start a new game I have it to where there are no actors in the party at the beginning of the game until the player chooses who they start as.)
Thanks for any help in advance.
I can't download it.
How do you have it "to where there are no actors in the party at the beginning of the game"?

Did you delete actors from the Actors tab? If you did that, add them back in there, then go to the System tab and delete them from the Starting Party instead.
I can't download it.
How do you have it "to where there are no actors in the party at the beginning of the game"?

Did you delete actors from the Actors tab? If you did that, add them back in there, then go to the System tab and delete them from the Starting Party instead.
I deleted them from the system tab not the actors tab.
1598740935779.png

There is no actor in the party for the start of the game until the player chooses their character.
If I understand well your problem, I can see two different solutions for it.

  • The first approach (simplest and safest):
Looks like this script relies on the existence of at least 1 party member in the party.
Instead of removing all party members you may create something like a "dummy" actor with no graphics and add it to party and them remove it right after the first "real" party member is added.

  • The second approach (complex and dangerous):
If you really, really, but really want or need to remove all party members from the initial party you can edit/patch the script where its returning the error.
By analyzing the error message, it seems at line 1683 the script is trying to call the method "character_name" from a nil actor (Probably because your starting party is empty).
To get around that you can check if the actor is nil before trying to retrieve the name from a non-existent actor, then return a default value if that is the case.
Something like this:
Spoiler: Game_Player
Ruby:
  #============================================================================
  # ** Game_Player
  #----------------------------------------------------------------------------
  #  This class handles the player. It includes event starting determinants and
  # map scrolling functions. The instance of this class is referenced by
  # $game_player.
  #============================================================================

  class Game_Player < Game_Character
    #------------------------------------------------------------------------
    # * New: Refresh
    #------------------------------------------------------------------------
    def refresh
      @character_name = actor ? actor.real_character_name : ""
      @character_index = actor ? actor.real_character_index : 0
      @followers.refresh
    end
    #------------------------------------------------------------------------
    # New: character_name
    #------------------------------------------------------------------------
    def character_name
      if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS
        return "" unless actor
        cname = actor.character_name
        cind = actor.character_index(@direction)
        return cname if cname != actor.real_character_name || cind != actor.real_character_index
      end
      @character_name
    end
    #------------------------------------------------------------------------
    # New: character_index
    #------------------------------------------------------------------------
    def character_index
      if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS
        return 0 unless actor
        cname = actor.character_name
        cind = actor.character_index(@direction)
        return cind if cname != actor.real_character_name || cind != actor.real_character_index
      end
      if $imported["CXJ-AnimEx"]
        super
      else
        @character_index
      end
    end
    #------------------------------------------------------------------------
    # New: face_name
    #------------------------------------------------------------------------
    def face_name
      if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS
        return "" unless actor
        fname = actor.face_name
        return fname if fname != actor.real_face_name || actor.face_index != actor.real_face_index
      end
      @face_name
    end
    #------------------------------------------------------------------------
    # New: face_index
    #------------------------------------------------------------------------
    def face_index
      if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS
        return 0 unless actor
        fname = actor.face_name
        return actor.face_index if fname != actor.real_face_name || actor.face_index != actor.real_face_index
      end
      @face_index
    end
  end

I altered just 4 lines of code: 23, 35, 51 and 62, but I posted the whole class anyway, just for completeness.
It's a null check for returning a default value if the actor is absent.
However, I can't guarantee this will work, and if it really works at game startup I can't guarantee it will work for rest of the game.

If the first approach works for you, I suggest you stick with it.
If I understand well your problem, I can see two different solutions for it.

  • The first approach (simplest and safest):
Looks like this script relies on the existence of at least 1 party member in the party.
Instead of removing all party members you may create something like a "dummy" actor with no graphics and add it to party and them remove it right after the first "real" party member is added.

  • The second approach (complex and dangerous):
If you really, really, but really want or need to remove all party members from the initial party you can edit/patch the script where its returning the error.
By analyzing the error message, it seems at line 1683 the script is trying to call the method "character_name" from a nil actor (Probably because your starting party is empty).
To get around that you can check if the actor is nil before trying to retrieve the name from a non-existent actor, then return a default value if that is the case.
Something like this:
Spoiler: Game_Player
Ruby:
  #============================================================================
  # ** Game_Player
  #----------------------------------------------------------------------------
  #  This class handles the player. It includes event starting determinants and
  # map scrolling functions. The instance of this class is referenced by
  # $game_player.
  #============================================================================

  class Game_Player < Game_Character
    #------------------------------------------------------------------------
    # * New: Refresh
    #------------------------------------------------------------------------
    def refresh
      @character_name = actor ? actor.real_character_name : ""
      @character_index = actor ? actor.real_character_index : 0
      @followers.refresh
    end
    #------------------------------------------------------------------------
    # New: character_name
    #------------------------------------------------------------------------
    def character_name
      if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS
        return "" unless actor
        cname = actor.character_name
        cind = actor.character_index(@direction)
        return cname if cname != actor.real_character_name || cind != actor.real_character_index
      end
      @character_name
    end
    #------------------------------------------------------------------------
    # New: character_index
    #------------------------------------------------------------------------
    def character_index
      if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS
        return 0 unless actor
        cname = actor.character_name
        cind = actor.character_index(@direction)
        return cind if cname != actor.real_character_name || cind != actor.real_character_index
      end
      if $imported["CXJ-AnimEx"]
        super
      else
        @character_index
      end
    end
    #------------------------------------------------------------------------
    # New: face_name
    #------------------------------------------------------------------------
    def face_name
      if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS
        return "" unless actor
        fname = actor.face_name
        return fname if fname != actor.real_face_name || actor.face_index != actor.real_face_index
      end
      @face_name
    end
    #------------------------------------------------------------------------
    # New: face_index
    #------------------------------------------------------------------------
    def face_index
      if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS
        return 0 unless actor
        fname = actor.face_name
        return actor.face_index if fname != actor.real_face_name || actor.face_index != actor.real_face_index
      end
      @face_index
    end
  end

I altered just 4 lines of code: 23, 35, 51 and 62, but I posted the whole class anyway, just for completeness.
It's a null check for returning a default value if the actor is absent.
However, I can't guarantee this will work, and if it really works at game startup I can't guarantee it will work for rest of the game.

If the first approach works for you, I suggest you stick with it.
Ok, so I tried the first one and when I started a new game it gave me this error:
1598744887013.png
For the looks of it, it's trying to access a method which is not defined yet in the the actor's class. This kind of thing generally occur due to script load ordering issues.

I know it looks clichê, but are you sure the loading order is correct? Can you post a screenshot of it?

By the way, can you verify if the same error occur with a normal starting party?
For the looks of it, it's trying to access a method which is not defined yet in the the actor's class. This kind of thing generally occur due to script load ordering issues.

I know it looks clichê, but are you sure the loading order is correct? Can you post a screenshot of it?

By the way, can you verify if the same error occur with a normal starting party?
Here is my script list and the order it is in:
For your original problem, you can do the following changes to Class Extension:
Code:
    #------------------------------------------------------------------------
    # New: character_name
    #------------------------------------------------------------------------
    def character_name
      return '' unless actor
      if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS
        cname = actor.character_name
        cind = actor.character_index(@direction)
        return cname if cname != actor.real_character_name || cind != actor.real_character_index
      end
      @character_name
    end
    #------------------------------------------------------------------------
    # New: character_index
    #------------------------------------------------------------------------
    def character_index
      return 0 unless actor
      if CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_SPECIFIC_GRAPHICS
        cname = actor.character_name
        cind = actor.character_index(@direction)
        return cind if cname != actor.real_character_name || cind != actor.real_character_index
      end
      if $imported["CXJ-AnimEx"]
        super
      else
        @character_index
      end
    end

For your other problem, it appears to be a script conflict between Class Extension and ESTRIOLE's subclass patch. They both use the method 'max_level'. Because Class Extension is lower in the script list, ESTRIOLE's <class_max_lv> tags are being ignored. Meanwhile, Class Extension defaults them to -1, which the subclass script tries to calculate the EXP amount for level -1, hence the error thrown.
I haven't read the other responses, but if you NEED one party member, you could just check the Transparent flag in the System tab so you can't see the actor.
Put the class extensions after yanfly class system script.
Then you may get an error. Comment out that line (1466) then it may work.
do the following changes to Class Extension
I tested that with his scripts. Gets an error for actor.character_index(@direction)
Then found more entries for it. Swapping Game_Actor gave the error but swapping Game_Player works.
Put the class extensions after yanfly class system script.
Then you may get an error. Comment out that line (1466) then it may work.

I tested that with his scripts. Gets an error for actor.character_index(@direction)
Then found more entries for it. Swapping Game_Actor gave the error but swapping Game_Player works.
It worked. I have to comment out two lines of code, but it worked.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/class-extension-error.126405/