Class extension Error

Status
Not open for further replies.

slickdeath97

Veteran
Veteran
Joined
Feb 26, 2019
Messages
441
Reaction score
9
First Language
english
Primarily Uses
RMVXA
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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 

slickdeath97

Veteran
Veteran
Joined
Feb 26, 2019
Messages
441
Reaction score
9
First Language
english
Primarily Uses
RMVXA
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.
 

Attachments

CaRa_CrAzY

Undefined Custom Title
Veteran
Joined
Jan 19, 2019
Messages
65
Reaction score
27
First Language
Portuguese
Primarily Uses
Other
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:
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.
 

slickdeath97

Veteran
Veteran
Joined
Feb 26, 2019
Messages
441
Reaction score
9
First Language
english
Primarily Uses
RMVXA
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:
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
 

CaRa_CrAzY

Undefined Custom Title
Veteran
Joined
Jan 19, 2019
Messages
65
Reaction score
27
First Language
Portuguese
Primarily Uses
Other
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?
 

slickdeath97

Veteran
Veteran
Joined
Feb 26, 2019
Messages
441
Reaction score
9
First Language
english
Primarily Uses
RMVXA
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:
 

Attachments

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
281
Reaction score
106
First Language
English
Primarily Uses
RMXP
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.
 
Last edited:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
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.
 

slickdeath97

Veteran
Veteran
Joined
Feb 26, 2019
Messages
441
Reaction score
9
First Language
english
Primarily Uses
RMVXA
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.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,842
Reaction score
5,225
First Language
Dutch
Primarily Uses
RMXP

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.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,090
Members
137,586
Latest member
Usagiis
Top