YEP_ClassChangeCore sealing class change on a per actor basis

Status
Not open for further replies.

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
776
Reaction score
487
First Language
English
Primarily Uses
RMMV
Good evening folks.

I was messing around with my project a bit this morning, specifically with the YEP_ClassChangeCore plugin, and discovered an unfortunate bug.

Steps to reproduce:
  • Unlock several classes for one or more actors, either by plugin command, or by using the event command to change classes.
  • Use the plugin command DisablePrimaryClassChange n where 'n' is the actor ID of the above actor.
  • Note that this actor can still change classes in the class change menu, despite the help information indicating otherwise.
  • The actor._canChangeClass value is updated to 'false' from undefined, as expected, but the menu doesn't seem to check this value before allowing a class change in the scene.
I don't know about how menu scene work to quickly figure this out on my own, so I'm hoping someone else maybe already fixed this problem and is willing to share it, or knows how to fix it quickly.

Thanks in advance.
 

Luckysince97

Veteran
Veteran
Joined
Feb 6, 2018
Messages
102
Reaction score
27
First Language
French
Primarily Uses
RMMZ
First thing first, did you update , yanfly change some thing in it core for 1.6.1. update, so it migth be a good thing to check what version of classchangecore you have, here the link to the changelog dont forget to change the yep core itself...http://yanfly.moe/yep/changelog/
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
776
Reaction score
487
First Language
English
Primarily Uses
RMMV
I am using the latest version of all Yanfly plugins.

Your query actually made me remember that I'm also using a plugin I made myself for auto-optimizing equipment when class changing which does override the default onItemOk bind of the class change core. I looked into it further though, and this isn't the problem.

I did find what the problem was though, and I will share it, just in case anyone else has the same issue down the road and finds this in a google search or something.

The problem is that the function Game_Actor.prototype.canChangeClass() is designed to overwrite the _canChangeClass value on the party member with whatever the default value on $GameParty.members()[x].actor() is. The way the function was scripted, it was designed to check if the _canChangeClass value existed in an if statement, but that statement will return false if the value is undefined, or if it is false, causing it to return the default actor value of true instead. I modified the function to be more specific. It will now retain a false value if you have used the plugin command to disable class change for an actor, causing the class change scene to correctly grey-out the ability to change primary classes.

Code:
Game_Actor.prototype.canChangeClass = function() {
    if (this._canChangeClass != undefined) {
        return this._canChangeClass;
    } else {
        this._canChangeClass = this.actor().canChangeClass;
        return this._canChangeClass;
    }
};
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
15,354
Reaction score
8,533
First Language
English
Primarily Uses
RMMV

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 Profile Posts

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.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,072
Members
137,578
Latest member
JamesLightning
Top