YEP_ClassChangeCore sealing class change on a per actor basis

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.
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/
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;
    }
};

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/yep_classchangecore-sealing-class-change-on-a-per-actor-basis.94579/