Learned Passives / Subclass

So I've been working on my game it is going well. I've over come some challenges but still face things that are beyond me, slowly improving.

With YEP Learn Skills and Sub class plus auto passive states I am currently having a bit of difficulty:

I want a class to learn a passive through a learned skill. This works. I then want this passive to only be applied if that actor is class X. This also works using this code in the state:

-------------------------------------
<Custom Passive Condition>

if (user.currentClass().id === 2) {

condition = true;

} else {

condition = false;

}

</Custom Passive Condition>
-------------------------------------

All of this works. If I want an actor to have +StateTestPassive while Class1 it will have that passive. If I change to Class2 the Class1 passive goes away.

The problem comes in with YEP Subclass. If I want the passive to also apply to people with Class1 as a subclass I have been unable to figure out how to do so. I can not call upon a subclass id. Is it not possible to call upon a subclass id to check that as well, or is it just beyond my ability?



I have tried:

-------------------------------------
<Custom Passive Condition>

if (user.currentClass().id === 2) {

condition = true;

} else if (user.subclass().id === 2) {
condition = true;

} else {

condition = false;

}

</Custom Passive Condition>
-------------------------------------

However, once I learn the passive and go to change class menu I return the following error:

-------------------------------------------------------------------------------------
TypeError: Cannot read property 'id' of null
/E:/RPG%20Maker/Project1/js/plugins/YEP_AutoPassiveStates.js:648 PASSIVE STATE CUSTOM CONDITION ERROR
/E:/RPG%20Maker/Project1/js/plugins/YEP_AutoPassiveStates.js:649 if (user.currentClass().id === 2) {
condition = true;
} else if (user.subclass().id === 2) {
condition = true;
} else {
condition = false;
----------------------------------------------------------------------------------------

Which to me and my rather rudimentary understanding of coding means that user.subclass.id does not exist. (If I remove that part of the code, it returns to functioning normally)

I have tried changing the case of the various parts of subclass as well (I.E: SubClass, subClass, Subclass) and none of that works.

If worse comes to worse I'll just mark YEP Subclass off my list of plugins I'll be using, but I'd rather that not be the case.
This notetag just checks subclass:
<Custom Passive Condition>

if (user.subclass() === $dataClasses[2]) {

condition = true;

} else {

condition = false;

}

</Custom Passive Condition>

This checks if the user's subclass and primary class to give the passive Ie a Mage/Thief or Thief/Knight would both get the Thief passive:

<Custom Passive Condition>

if (user.subclass() === $dataClasses[2] || user.currentClass() === $dataClasses[2]) {

condition = true;

} else {

condition = false;

}

</Custom Passive Condition>

Skeleton Code:
user.subclass() === $dataClasses[x]
basically the user's subclass is equal to class x; where x is the id of the class you want.
Change the "===" to "!==" to check not equal to.
Thankyou it worked perfectly. Big help.

Original thread: https://forums.rpgmakerweb.com/threads/learned-passives-subclass.87998/