MV adding a state upon class/subclass change (yanfly classchangecore) SOLVED

I wasn't able to find anything about this while searching, but I was wondering what would be the best way to add a state to an actor when this actor changes their class or subclass to a specific job.

I already have these tags which I am using to customize equipment options,

(user.currentClass().id == x)
&
user.subclass() !== null && user.subclass().id == x)

and I know how to run the script I need once I get to that point, but I can't think of anyway to check if a class/subclass is changed or to perform an action in response to a class/subclass change. Preferably this could be done without a parallel process but I will take what I can get, as long as it can be applied to all my generic actors equally.

I do know I can use a passive state applied to all my actors, and have this passive state only be active when said actor is x class/subclass, however I only want the action to be performed in response to the class change itself, rather than something that is always applied while the actor is said class.


Maybe something like this that runs at game start or game load,

Code:
var currentClass = user.currentClass().id;
if (user.subclass() !== null) {
var currentSubclass = user.subclass().id
};

then a passive state applied to all actors with a condition like so:

Code:
<Custom Passive Condition>
if (user.currentClass().id == var currentClass) {
condition = false;  
} else if (user.currentClass().id == 1) {      
condition = true;
} else if (user.currentClass().id == 2) {      
condition = true;
etc
} else {
condition = false;                        
}
</Custom Passive Condition>

<Custom Apply Effect>
if (user.currentClass().id == 1) {
-equip slot changing code goes here-
}
else if (user.currentClass().id == 2) {
-equip slot changing code goes here-
}
etc
;
</Custom Apply Effect>

and duplicate the state for subclasses as well.

I think this will work, if I am remembering correctly I can use custom apply effect combined with a custom passive condition, to only run the code when the passive condition applies the state, yea?

Might there be a better way though?
I do know I can use a passive state applied to all my actors, and have this passive state only be active when said actor is x class/subclass, however I only want the action to be performed in response to the class change itself, rather than something that is always applied while the actor is said class.
im failing to understand this. perhaps give an example? why is a sub/class passive insufficient for what youre trying to accomplish?

if I am remembering correctly I can use custom apply effect combined with a custom passive condition, to only run the code when the passive condition applies the state, yea?
custom apply effects arent triggered by passives activating. you'd have to make edits to the plugin to make that work. try following the steps here.
I need to change the eType slots the actor uses, and have the new eType slots displayed in the same order as the previous configuation. So I need to remove the lower 5 slots and replace them upon class change.

Using Hime_EquipSlot core for this and this bit isnt difficult really. It would take a few paragraphs to explain in full, but in short I have a unique equipment system that changes based on the class and/or subclass. For example, Knight can use a 1h sword in the sidearm slot (slot 3), but other classes cannot. But if you change your class or subclass to knight, you can now equip a 1h sword in this slot. To do so I need to adjust the eType the actor uses from 4 (standard generic sidearm slot) to eType 5 (knight specific sidearm slot).

What I need to run would be something like this:
Code:
a.removeEquipSlot(3)
a.removeEquipSlot(4)
a.addEquipSlot(3)
a.addEquipSlot(4)

and store the previous equips in a variable and re-equip them after this code. None of that is difficult

Looking over my pseudocode, I don't think what I wrote in the first code snippet will work anyways, as I would need a unique variable per actor rather than one shared for all. This becomes problematic since my game is filled with hireable generics. Now, if the code could be executed upon a class change, I could share a single variable for every actor, which is what I am aiming for.

I wonder if I should just try and find the section in the Yanfly ClassChange plugin that executes the class change function, and piggyback my code off of that. Seems like the best way if there are no default class change triggers to take advantage of. But still, I don't think I can create a local variable there that will be passed on to the state responsible for the eType swaps. Not sure if I can perform the eType swaps from within the Yanfly script either. Which leads me back to the original problem of needing a unique variable per actor, of which there are (x) number of actors due to hireable generics.

And thank you, my plugin is updated to allow custom apply effects to properly interact with passives. Some nice edits there, good work Turan, I will be bookmarking that thread for future use.
I wonder if I should just try and find the section in the Yanfly ClassChange plugin that executes the class change function, and piggyback my code off of that.
thats the route i would have gone with as well. you could either edit the Game_Actor.changeClass and Game_Actor.changeSubclass methods, or edit the handler methods for the class scene to do your additions.

But still, I don't think I can create a local variable there that will be passed on to the state responsible for the eType swaps
from either set of methods above, you have access to the actor. from the class change methods you can just use "this", and from the handlers you can "this.actor()" to get your reference. from there, you could add a your variables as actor properties to record their last class and then at the very end, add logic to handle all the slot changes needed.
you wouldnt need the state if you were to add the logic to the class changing itself, but if you need the state, all the logic could go there and do things based on the "user._lastClass" and "user._lastSubclass" or whatever you name them
I think I understand what you are suggesting, but I am missing a few core bits and want to make sure I understand this right.

Here is the changeClass section in the YanflyClassChangeCore script:

Code:
Yanfly.CCC.Game_Actor_changeClass = Game_Actor.prototype.changeClass;
Game_Actor.prototype.changeClass = function(classId, keepExp) {
    keepExp = Yanfly.Param.CCCMaintainLv;
    if (keepExp) {
      this._exp[classId] = this._exp[this._classId];
      keepExp = false;
    }
    Yanfly.CCC.Game_Actor_changeClass.call(this, classId, keepExp);
    //this.updateLearnedSkills(classId);
    if (!$gameParty.unlockedClasses().contains(classId)) {
      this.unlockClass(classId);
    }
    $gamePlayer.refresh();
};

So to do this correctly, I would add this right before the .refresh?

var currentClass = this.currentClass().id;

I figure I will go ahead and use the state just so I have an easier time editing it later and adding things already present via the standard engine. But my addition surely isn't correct, is it? I mean I suppose this would only run upon class change, so the same variable could be reused for all actors... I could only pray it would be this simple of a solution.

I must be using the wrong syntax or something because it says unexpected token var
(that was actually my passive state just found out. going to mess with this and see if I can get it)

:update:
okay I have the passive state written out correctly like so:
<Custom Passive Condition>
if (user.currentClass().id == v[currentClass]) {
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>

However I am receiving this error:
currentClass is not defined
I need to save var currentClass as a function I think, right? As in this:

var currentClass = this.currentClass().id;
this._lastClass = currentClass

and then change the passive condition to this:

<Custom Passive Condition>
if (user.currentClass().id == user._lastClass) {
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>

Testing it right now

::update::

holy moley I think it works
So to do this correctly, I would add this right before the .refresh?
earlier. by that refresh, the actual class change would have already happened, so youd just be saving your current post change class id in a second place instead of saving your last one.

var currentClass = this.currentClass().id;
not quite. that currentClass variable only exists within the scope of that method. what youd have to do is "this.currentClass = this.currentClass().id;" instead. that adds a .currentClass property to the actor that you can access anywhere as long as you can access the actor.

if you do something like this:

Code:
Yanfly.CCC.Game_Actor_changeClass = Game_Actor.prototype.changeClass;
Game_Actor.prototype.changeClass = function(classId, keepExp) {
    this.lastClass = this.currentClass().id; //added line
    keepExp = Yanfly.Param.CCCMaintainLv;
    if (keepExp) {
      this._exp[classId] = this._exp[this._classId];
      keepExp = false;
    }
    Yanfly.CCC.Game_Actor_changeClass.call(this, classId, keepExp);
    //this.updateLearnedSkills(classId);
    if (!$gameParty.unlockedClasses().contains(classId)) {
      this.unlockClass(classId);
    }
    this.addState(x); // added line
    $gamePlayer.refresh();
};
then you get a property on the actor themself that you can use to identify what their last class was. from there, your state can look at user.lastClass in its apply effect to remove the slots the last class added and then add the slots the current class adds by looking at currentClass().id.

A consideration i didnt make before though was that the classChange method is called every time you go up and down in the class selection window. its used to calculate the stats for the stat change. If you put this new logic in the handler, you avoid the code being repeated for every movement in that window
You are freaking amazing, thank you so much!

Update, I wasn't able to get custom apply effect to work in concert with the plugin call to add the state, even with the Turan edits (it wouldn't play nice with passives either for some reason), so I ended up just putting all the code under Yanfly.CCC.Game_Actor_changeClass = Game_Actor.prototype.changeClass;
...and....
it works perfectly! I think I filled in some missing gaps figuring this out with your help. I didn't understand that this. was equivalent to user. or a.

Now that I do, mwahahaha, the world is mine for the taking. Super happy about all this. Thank you again Robro33!

Probably for the best I ended up adding it to the .js file, final code ended up at around 800 lines. Lotta repetition. Probably a better way to do this than I did, but hey it works and doesn't cause any lag so I have nothing to complain about lol.

Spoiler: do NOT click me
Code:
if (
    this.currentClass().id == 34)
{ 
this.removeEquipSlot(1);
this.removeEquipSlot(2);
this.removeEquipSlot(3);
this.removeEquipSlot(4);
this.removeEquipSlot(5);
this.removeEquipSlot(6);
this.removeEquipSlot(7);
this.removeEquipSlot(8);
this.removeEquipSlot(9);
this.removeEquipSlot(10);
this.removeEquipSlot(11);
this.removeEquipSlot(12);
this.removeEquipSlot(13);
this.removeEquipSlot(14);
this.removeEquipSlot(15);
this.removeEquipSlot(16);
this.removeEquipSlot(17);
this.removeEquipSlot(18);
this.removeEquipSlot(19);
this.removeEquipSlot(20);
this.removeEquipSlot(21);
this.removeEquipSlot(22);
this.removeEquipSlot(23);
this.removeEquipSlot(24);
this.removeEquipSlot(25);
this.removeEquipSlot(26);
this.removeEquipSlot(27);
this.removeEquipSlot(28);
this.removeEquipSlot(29);
this.removeEquipSlot(30);
this.removeEquipSlot(31);
this.removeEquipSlot(32);
this.removeEquipSlot(33);
this.removeEquipSlot(34);
this.removeEquipSlot(35);
this.removeEquipSlot(36);
this.removeEquipSlot(37);
this.removeEquipSlot(38);
this.removeEquipSlot(39);
this.removeEquipSlot(40);
this.removeEquipSlot(41);
this.removeEquipSlot(42);
this.removeEquipSlot(43);
this.removeEquipSlot(44);
this.removeEquipSlot(45);
this.removeEquipSlot(46);
this.removeEquipSlot(47);
this.removeEquipSlot(48);
this.removeEquipSlot(49);
this.removeEquipSlot(50);
this.addEquipSlot(1);
this.addEquipSlot(3);
if (
    this.subclass() !== null && this.subclass().id == 14)
{ 
this.addEquipSlot(13);
}
else if (
    this.subclass() !== null && this.subclass().id == 13)
{ 
this.addEquipSlot(15);
}
else if (
    this.subclass() !== null && this.subclass().id == 20)
{ 
this.addEquipSlot(16);
}
else if (
    this.subclass() !== null && this.subclass().id == 26)
{ 
this.addEquipSlot(18);
}
else if (
    this.subclass() !== null && this.subclass().id == 24)
{ 
this.addEquipSlot(17);
}
else if (
    this.subclass() !== null && this.subclass().id == 19)
{ 
this.addEquipSlot(19);
}
else if (
    this.subclass() !== null && this.subclass().id == 5)
{ 
this.addEquipSlot(14);
}
else 
{ 
this.addEquipSlot(5);
}
this.addEquipSlot(41);
this.addEquipSlot(42);
this.addEquipSlot(43);
this.addEquipSlot(44);
this.addEquipSlot(45);
this.addEquipSlot(46);
}
else if (
    this.currentClass().id == 14)
{ 
this.removeEquipSlot(1);
this.removeEquipSlot(2);
this.removeEquipSlot(3);
this.removeEquipSlot(4);
this.removeEquipSlot(5);
this.removeEquipSlot(6);
this.removeEquipSlot(7);
this.removeEquipSlot(8);
this.removeEquipSlot(9);
this.removeEquipSlot(10);
this.removeEquipSlot(11);
this.removeEquipSlot(12);
this.removeEquipSlot(13);
this.removeEquipSlot(14);
this.removeEquipSlot(15);
this.removeEquipSlot(16);
this.removeEquipSlot(17);
this.removeEquipSlot(18);
this.removeEquipSlot(19);
this.removeEquipSlot(20);
this.removeEquipSlot(21);
this.removeEquipSlot(22);
this.removeEquipSlot(23);
this.removeEquipSlot(24);
this.removeEquipSlot(25);
this.removeEquipSlot(26);
this.removeEquipSlot(27);
this.removeEquipSlot(28);
this.removeEquipSlot(29);
this.removeEquipSlot(30);
this.removeEquipSlot(31);
this.removeEquipSlot(32);
this.removeEquipSlot(33);
this.removeEquipSlot(34);
this.removeEquipSlot(35);
this.removeEquipSlot(36);
this.removeEquipSlot(37);
this.removeEquipSlot(38);
this.removeEquipSlot(39);
this.removeEquipSlot(40);
this.removeEquipSlot(41);
this.removeEquipSlot(42);
this.removeEquipSlot(43);
this.removeEquipSlot(44);
this.removeEquipSlot(45);
this.removeEquipSlot(46);
this.removeEquipSlot(47);
this.removeEquipSlot(48);
this.removeEquipSlot(49);
this.removeEquipSlot(50);
this.addEquipSlot(1);
this.addEquipSlot(3);
if (
    this.subclass() !== null && this.subclass().id == 34)
{ 
this.addEquipSlot(13);
}
else if (
    this.subclass() !== null && this.subclass().id == 13)
{ 
this.addEquipSlot(21);
}
else if (
    this.subclass() !== null && this.subclass().id == 20)
{ 
this.addEquipSlot(22);
}
else if (
    this.subclass() !== null && this.subclass().id == 26)
{ 
this.addEquipSlot(24);
}
else if (
    this.subclass() !== null && this.subclass().id == 24)
{ 
this.addEquipSlot(23);
}
else if (
    this.subclass() !== null && this.subclass().id == 19)
{ 
this.addEquipSlot(25);
}
else if (
    this.subclass() !== null && this.subclass().id == 5)
{ 
this.addEquipSlot(20);
}
else 
{ 
this.addEquipSlot(6);
}
this.addEquipSlot(41);
this.addEquipSlot(42);
this.addEquipSlot(43);
this.addEquipSlot(44);
this.addEquipSlot(45);
this.addEquipSlot(46);
}
else if (
    this.currentClass().id == 13)
{ 
this.removeEquipSlot(1);
this.removeEquipSlot(2);
this.removeEquipSlot(3);
this.removeEquipSlot(4);
this.removeEquipSlot(5);
this.removeEquipSlot(6);
this.removeEquipSlot(7);
this.removeEquipSlot(8);
this.removeEquipSlot(9);
this.removeEquipSlot(10);
this.removeEquipSlot(11);
this.removeEquipSlot(12);
this.removeEquipSlot(13);
this.removeEquipSlot(14);
this.removeEquipSlot(15);
this.removeEquipSlot(16);
this.removeEquipSlot(17);
this.removeEquipSlot(18);
this.removeEquipSlot(19);
this.removeEquipSlot(20);
this.removeEquipSlot(21);
this.removeEquipSlot(22);
this.removeEquipSlot(23);
this.removeEquipSlot(24);
this.removeEquipSlot(25);
this.removeEquipSlot(26);
this.removeEquipSlot(27);
this.removeEquipSlot(28);
this.removeEquipSlot(29);
this.removeEquipSlot(30);
this.removeEquipSlot(31);
this.removeEquipSlot(32);
this.removeEquipSlot(33);
this.removeEquipSlot(34);
this.removeEquipSlot(35);
this.removeEquipSlot(36);
this.removeEquipSlot(37);
this.removeEquipSlot(38);
this.removeEquipSlot(39);
this.removeEquipSlot(40);
this.removeEquipSlot(41);
this.removeEquipSlot(42);
this.removeEquipSlot(43);
this.removeEquipSlot(44);
this.removeEquipSlot(45);
this.removeEquipSlot(46);
this.removeEquipSlot(47);
this.removeEquipSlot(48);
this.removeEquipSlot(49);
this.removeEquipSlot(50);
this.addEquipSlot(1);
this.addEquipSlot(3);
if (
    this.subclass() !== null && this.subclass().id == 34)
{ 
this.addEquipSlot(15);
}
else if (
    this.subclass() !== null && this.subclass().id == 14)
{ 
this.addEquipSlot(21);
}
else if (
    this.subclass() !== null && this.subclass().id == 20)
{ 
this.addEquipSlot(31);
}
else if (
    this.subclass() !== null && this.subclass().id == 26)
{ 
this.addEquipSlot(33);
}
else if (
    this.subclass() !== null && this.subclass().id == 24)
{ 
this.addEquipSlot(32);
}
else if (
    this.subclass() !== null && this.subclass().id == 19)
{ 
this.addEquipSlot(34);
}
else if (
    this.subclass() !== null && this.subclass().id == 5)
{ 
this.addEquipSlot(26);
}
else 
{ 
this.addEquipSlot(8);
}
this.addEquipSlot(41);
this.addEquipSlot(42);
this.addEquipSlot(43);
this.addEquipSlot(44);
this.addEquipSlot(45);
this.addEquipSlot(46);
}
else if (
    this.currentClass().id == 20)
{ 
this.removeEquipSlot(1);
this.removeEquipSlot(2);
this.removeEquipSlot(3);
this.removeEquipSlot(4);
this.removeEquipSlot(5);
this.removeEquipSlot(6);
this.removeEquipSlot(7);
this.removeEquipSlot(8);
this.removeEquipSlot(9);
this.removeEquipSlot(10);
this.removeEquipSlot(11);
this.removeEquipSlot(12);
this.removeEquipSlot(13);
this.removeEquipSlot(14);
this.removeEquipSlot(15);
this.removeEquipSlot(16);
this.removeEquipSlot(17);
this.removeEquipSlot(18);
this.removeEquipSlot(19);
this.removeEquipSlot(20);
this.removeEquipSlot(21);
this.removeEquipSlot(22);
this.removeEquipSlot(23);
this.removeEquipSlot(24);
this.removeEquipSlot(25);
this.removeEquipSlot(26);
this.removeEquipSlot(27);
this.removeEquipSlot(28);
this.removeEquipSlot(29);
this.removeEquipSlot(30);
this.removeEquipSlot(31);
this.removeEquipSlot(32);
this.removeEquipSlot(33);
this.removeEquipSlot(34);
this.removeEquipSlot(35);
this.removeEquipSlot(36);
this.removeEquipSlot(37);
this.removeEquipSlot(38);
this.removeEquipSlot(39);
this.removeEquipSlot(40);
this.removeEquipSlot(41);
this.removeEquipSlot(42);
this.removeEquipSlot(43);
this.removeEquipSlot(44);
this.removeEquipSlot(45);
this.removeEquipSlot(46);
this.removeEquipSlot(47);
this.removeEquipSlot(48);
this.removeEquipSlot(49);
this.removeEquipSlot(50);
this.addEquipSlot(1);
this.addEquipSlot(3);
if (
    this.subclass() !== null && this.subclass().id == 34)
{ 
this.addEquipSlot(16);
}
else if (
    this.subclass() !== null && this.subclass().id == 14)
{ 
this.addEquipSlot(22);
}
else if (
    this.subclass() !== null && this.subclass().id == 13)
{ 
this.addEquipSlot(31);
}
else if (
    this.subclass() !== null && this.subclass().id == 26)
{ 
this.addEquipSlot(36);
}
else if (
    this.subclass() !== null && this.subclass().id == 24)
{ 
this.addEquipSlot(35);
}
else if (
    this.subclass() !== null && this.subclass().id == 19)
{ 
this.addEquipSlot(37);
}
else if (
    this.subclass() !== null && this.subclass().id == 5)
{ 
this.addEquipSlot(27);
}
else 
{ 
this.addEquipSlot(9);
}
this.addEquipSlot(41);
this.addEquipSlot(42);
this.addEquipSlot(43);
this.addEquipSlot(44);
this.addEquipSlot(45);
this.addEquipSlot(46);
}
else if (
    this.currentClass().id == 24)
{ 
this.removeEquipSlot(1);
this.removeEquipSlot(2);
this.removeEquipSlot(3);
this.removeEquipSlot(4);
this.removeEquipSlot(5);
this.removeEquipSlot(6);
this.removeEquipSlot(7);
this.removeEquipSlot(8);
this.removeEquipSlot(9);
this.removeEquipSlot(10);
this.removeEquipSlot(11);
this.removeEquipSlot(12);
this.removeEquipSlot(13);
this.removeEquipSlot(14);
this.removeEquipSlot(15);
this.removeEquipSlot(16);
this.removeEquipSlot(17);
this.removeEquipSlot(18);
this.removeEquipSlot(19);
this.removeEquipSlot(20);
this.removeEquipSlot(21);
this.removeEquipSlot(22);
this.removeEquipSlot(23);
this.removeEquipSlot(24);
this.removeEquipSlot(25);
this.removeEquipSlot(26);
this.removeEquipSlot(27);
this.removeEquipSlot(28);
this.removeEquipSlot(29);
this.removeEquipSlot(30);
this.removeEquipSlot(31);
this.removeEquipSlot(32);
this.removeEquipSlot(33);
this.removeEquipSlot(34);
this.removeEquipSlot(35);
this.removeEquipSlot(36);
this.removeEquipSlot(37);
this.removeEquipSlot(38);
this.removeEquipSlot(39);
this.removeEquipSlot(40);
this.removeEquipSlot(41);
this.removeEquipSlot(42);
this.removeEquipSlot(43);
this.removeEquipSlot(44);
this.removeEquipSlot(45);
this.removeEquipSlot(46);
this.removeEquipSlot(47);
this.removeEquipSlot(48);
this.removeEquipSlot(49);
this.removeEquipSlot(50);
this.addEquipSlot(1);
this.addEquipSlot(3);
if (
    this.subclass() !== null && this.subclass().id == 34)
{ 
this.addEquipSlot(17);
}
else if (
    this.subclass() !== null && this.subclass().id == 14)
{ 
this.addEquipSlot(23);
}
else if (
    this.subclass() !== null && this.subclass().id == 13)
{ 
this.addEquipSlot(32);
}
else if (
    this.subclass() !== null && this.subclass().id == 20)
{ 
this.addEquipSlot(35);
}
else if (
    this.subclass() !== null && this.subclass().id == 26)
{ 
this.addEquipSlot(38);
}
else if (
    this.subclass() !== null && this.subclass().id == 19)
{ 
this.addEquipSlot(39);
}
else if (
    this.subclass() !== null && this.subclass().id == 5)
{ 
this.addEquipSlot(28);
}
else 
{ 
this.addEquipSlot(10);
}
this.addEquipSlot(41);
this.addEquipSlot(42);
this.addEquipSlot(43);
this.addEquipSlot(44);
this.addEquipSlot(45);
this.addEquipSlot(46);
}
else if (
    this.currentClass().id == 26)
{ 
this.removeEquipSlot(1);
this.removeEquipSlot(2);
this.removeEquipSlot(3);
this.removeEquipSlot(4);
this.removeEquipSlot(5);
this.removeEquipSlot(6);
this.removeEquipSlot(7);
this.removeEquipSlot(8);
this.removeEquipSlot(9);
this.removeEquipSlot(10);
this.removeEquipSlot(11);
this.removeEquipSlot(12);
this.removeEquipSlot(13);
this.removeEquipSlot(14);
this.removeEquipSlot(15);
this.removeEquipSlot(16);
this.removeEquipSlot(17);
this.removeEquipSlot(18);
this.removeEquipSlot(19);
this.removeEquipSlot(20);
this.removeEquipSlot(21);
this.removeEquipSlot(22);
this.removeEquipSlot(23);
this.removeEquipSlot(24);
this.removeEquipSlot(25);
this.removeEquipSlot(26);
this.removeEquipSlot(27);
this.removeEquipSlot(28);
this.removeEquipSlot(29);
this.removeEquipSlot(30);
this.removeEquipSlot(31);
this.removeEquipSlot(32);
this.removeEquipSlot(33);
this.removeEquipSlot(34);
this.removeEquipSlot(35);
this.removeEquipSlot(36);
this.removeEquipSlot(37);
this.removeEquipSlot(38);
this.removeEquipSlot(39);
this.removeEquipSlot(40);
this.removeEquipSlot(41);
this.removeEquipSlot(42);
this.removeEquipSlot(43);
this.removeEquipSlot(44);
this.removeEquipSlot(45);
this.removeEquipSlot(46);
this.removeEquipSlot(47);
this.removeEquipSlot(48);
this.removeEquipSlot(49);
this.removeEquipSlot(50);
this.addEquipSlot(1);
this.addEquipSlot(3);
if (
    this.subclass() !== null && this.subclass().id == 34)
{ 
this.addEquipSlot(18);
}
else if (
    this.subclass() !== null && this.subclass().id == 14)
{ 
this.addEquipSlot(24);
}
else if (
    this.subclass() !== null && this.subclass().id == 13)
{ 
this.addEquipSlot(33);
}
else if (
    this.subclass() !== null && this.subclass().id == 20)
{ 
this.addEquipSlot(36);
}
else if (
    this.subclass() !== null && this.subclass().id == 24)
{ 
this.addEquipSlot(38);
}
else if (
    this.subclass() !== null && this.subclass().id == 19)
{ 
this.addEquipSlot(40);
}
else if (
    this.subclass() !== null && this.subclass().id == 5)
{ 
this.addEquipSlot(29);
}
else 
{ 
this.addEquipSlot(11);
}
this.addEquipSlot(41);
this.addEquipSlot(42);
this.addEquipSlot(43);
this.addEquipSlot(44);
this.addEquipSlot(45);
this.addEquipSlot(46);
}
else if (
    this.currentClass().id == 19)
{
this.removeEquipSlot(1);
this.removeEquipSlot(2);
this.removeEquipSlot(3);
this.removeEquipSlot(4);
this.removeEquipSlot(5);
this.removeEquipSlot(6);
this.removeEquipSlot(7);
this.removeEquipSlot(8);
this.removeEquipSlot(9);
this.removeEquipSlot(10);
this.removeEquipSlot(11);
this.removeEquipSlot(12);
this.removeEquipSlot(13);
this.removeEquipSlot(14);
this.removeEquipSlot(15);
this.removeEquipSlot(16);
this.removeEquipSlot(17);
this.removeEquipSlot(18);
this.removeEquipSlot(19);
this.removeEquipSlot(20);
this.removeEquipSlot(21);
this.removeEquipSlot(22);
this.removeEquipSlot(23);
this.removeEquipSlot(24);
this.removeEquipSlot(25);
this.removeEquipSlot(26);
this.removeEquipSlot(27);
this.removeEquipSlot(28);
this.removeEquipSlot(29);
this.removeEquipSlot(30);
this.removeEquipSlot(31);
this.removeEquipSlot(32);
this.removeEquipSlot(33);
this.removeEquipSlot(34);
this.removeEquipSlot(35);
this.removeEquipSlot(36);
this.removeEquipSlot(37);
this.removeEquipSlot(38);
this.removeEquipSlot(39);
this.removeEquipSlot(40);
this.removeEquipSlot(41);
this.removeEquipSlot(42);
this.removeEquipSlot(43);
this.removeEquipSlot(44);
this.removeEquipSlot(45);
this.removeEquipSlot(46);
this.removeEquipSlot(47);
this.removeEquipSlot(48);
this.removeEquipSlot(49);
this.removeEquipSlot(50);
this.addEquipSlot(1);
this.addEquipSlot(3);
if (
    this.subclass() !== null && this.subclass().id == 34)
{ 
this.addEquipSlot(19);
}
else if (
    this.subclass() !== null && this.subclass().id == 14)
{ 
this.addEquipSlot(25);
}
else if (
    this.subclass() !== null && this.subclass().id == 13)
{ 
this.addEquipSlot(34);
}
else if (
    this.subclass() !== null && this.subclass().id == 20)
{ 
this.addEquipSlot(37);
}
else if (
    this.subclass() !== null && this.subclass().id == 24)
{ 
this.addEquipSlot(39);
}
else if (
    this.subclass() !== null && this.subclass().id == 26)
{ 
this.addEquipSlot(40);
}
else if (
    this.subclass() !== null && this.subclass().id == 5)
{ 
this.addEquipSlot(30);
}
else 
{ 
this.addEquipSlot(12);
}
this.addEquipSlot(41);
this.addEquipSlot(42);
this.addEquipSlot(43);
this.addEquipSlot(44);
this.addEquipSlot(45);
this.addEquipSlot(46);
}
else if (
    this.currentClass().id == 5)
{ 
this.removeEquipSlot(1);
this.removeEquipSlot(2);
this.removeEquipSlot(3);
this.removeEquipSlot(4);
this.removeEquipSlot(5);
this.removeEquipSlot(6);
this.removeEquipSlot(7);
this.removeEquipSlot(8);
this.removeEquipSlot(9);
this.removeEquipSlot(10);
this.removeEquipSlot(11);
this.removeEquipSlot(12);
this.removeEquipSlot(13);
this.removeEquipSlot(14);
this.removeEquipSlot(15);
this.removeEquipSlot(16);
this.removeEquipSlot(17);
this.removeEquipSlot(18);
this.removeEquipSlot(19);
this.removeEquipSlot(20);
this.removeEquipSlot(21);
this.removeEquipSlot(22);
this.removeEquipSlot(23);
this.removeEquipSlot(24);
this.removeEquipSlot(25);
this.removeEquipSlot(26);
this.removeEquipSlot(27);
this.removeEquipSlot(28);
this.removeEquipSlot(29);
this.removeEquipSlot(30);
this.removeEquipSlot(31);
this.removeEquipSlot(32);
this.removeEquipSlot(33);
this.removeEquipSlot(34);
this.removeEquipSlot(35);
this.removeEquipSlot(36);
this.removeEquipSlot(37);
this.removeEquipSlot(38);
this.removeEquipSlot(39);
this.removeEquipSlot(40);
this.removeEquipSlot(41);
this.removeEquipSlot(42);
this.removeEquipSlot(43);
this.removeEquipSlot(44);
this.removeEquipSlot(45);
this.removeEquipSlot(46);
this.removeEquipSlot(47);
this.removeEquipSlot(48);
this.removeEquipSlot(49);
this.removeEquipSlot(50);
this.addEquipSlot(1);
this.addEquipSlot(3);
if (
    this.subclass() !== null && this.subclass().id == 34)
{ 
this.addEquipSlot(14);
}
else if (
    this.subclass() !== null && this.subclass().id == 14)
{ 
this.addEquipSlot(20);
}
else if (
    this.subclass() !== null && this.subclass().id == 13)
{ 
this.addEquipSlot(26);
}
else if (
    this.subclass() !== null && this.subclass().id == 20)
{ 
this.addEquipSlot(27);
}
else if (
    this.subclass() !== null && this.subclass().id == 24)
{ 
this.addEquipSlot(28);
}
else if (
    this.subclass() !== null && this.subclass().id == 26)
{ 
this.addEquipSlot(29);
}
else if (
    this.subclass() !== null && this.subclass().id == 19)
{ 
this.addEquipSlot(30);
}
else 
{ 
this.addEquipSlot(7);
}
this.addEquipSlot(41);
this.addEquipSlot(42);
this.addEquipSlot(43);
this.addEquipSlot(44);
this.addEquipSlot(45);
this.addEquipSlot(46);
}
else 
{ 
this.removeEquipSlot(1);
this.removeEquipSlot(2);
this.removeEquipSlot(3);
this.removeEquipSlot(4);
this.removeEquipSlot(5);
this.removeEquipSlot(6);
this.removeEquipSlot(7);
this.removeEquipSlot(8);
this.removeEquipSlot(9);
this.removeEquipSlot(10);
this.removeEquipSlot(11);
this.removeEquipSlot(12);
this.removeEquipSlot(13);
this.removeEquipSlot(14);
this.removeEquipSlot(15);
this.removeEquipSlot(16);
this.removeEquipSlot(17);
this.removeEquipSlot(18);
this.removeEquipSlot(19);
this.removeEquipSlot(20);
this.removeEquipSlot(21);
this.removeEquipSlot(22);
this.removeEquipSlot(23);
this.removeEquipSlot(24);
this.removeEquipSlot(25);
this.removeEquipSlot(26);
this.removeEquipSlot(27);
this.removeEquipSlot(28);
this.removeEquipSlot(29);
this.removeEquipSlot(30);
this.removeEquipSlot(31);
this.removeEquipSlot(32);
this.removeEquipSlot(33);
this.removeEquipSlot(34);
this.removeEquipSlot(35);
this.removeEquipSlot(36);
this.removeEquipSlot(37);
this.removeEquipSlot(38);
this.removeEquipSlot(39);
this.removeEquipSlot(40);
this.removeEquipSlot(41);
this.removeEquipSlot(42);
this.removeEquipSlot(43);
this.removeEquipSlot(44);
this.removeEquipSlot(45);
this.removeEquipSlot(46);
this.removeEquipSlot(47);
this.removeEquipSlot(48);
this.removeEquipSlot(49);
this.removeEquipSlot(50);
this.addEquipSlot(1);
this.addEquipSlot(3);
if (
    this.subclass() !== null && this.subclass().id == 34)
{ 
this.addEquipSlot(5);
}
else if (
    this.subclass() !== null && this.subclass().id == 14)
{ 
this.addEquipSlot(6);
}
else if (
    this.subclass() !== null && this.subclass().id == 13)
{ 
this.addEquipSlot(8);
}
else if (
    this.subclass() !== null && this.subclass().id == 20)
{ 
this.addEquipSlot(9);
}
else if (
    this.subclass() !== null && this.subclass().id == 24)
{ 
this.addEquipSlot(10);
}
else if (
    this.subclass() !== null && this.subclass().id == 26)
{ 
this.addEquipSlot(11);
}
else if (
    this.subclass() !== null && this.subclass().id == 19)
{ 
this.addEquipSlot(12);
}
else 
{ 
this.addEquipSlot(4);
}
this.addEquipSlot(41);
this.addEquipSlot(42);
this.addEquipSlot(43);
this.addEquipSlot(44);
this.addEquipSlot(45);
this.addEquipSlot(46);
};

Original thread: https://forums.rpgmakerweb.com/threads/adding-a-state-upon-class-subclass-change-yanfly-classchangecore-solved.166577/