How to Disable a Learned Skill/Passive State when Weapon Type Unequipped?

Hi, I am trying to use a few of Yanfly's plugins to create a system where equipping a weapon enables the player to learn new passive state skills based on that weapon.  That works.  


How do you disable those learned passive states once the player un-equips the weapon, and re-enable upon equip?


For instance, the player picks up a sword and the "Sword Master" passive skill appears in his Learn Skills menu.  The player learns the skill, and they are granted +10 attack.  I want this to only be applicable while the character has a sword equipped.


Thanks for any assistance you can provide!
Can't you just attach the skill to the weapon?  I don't know what the plugin does that might make that not work, but normally if you only want a skill to be available while a weapon is equipped, you'd add that skill to the weapon's features.
The key that seems to make this more difficult is that these are learned skills.  Holding the weapon merely makes it possible to learn them, and these skills are obviously only useful when holding that weapon type.  


It isn't that the weapon grants a skill.  It is that holding the weapon opens up a path for player progression that doesn't go away when the player changes weapons.  Changing weapons should only disables those learned skills temporarily.
You can use Yanfly's skill learn plugin for a custom learn eval


http://yanfly.moe/2015/11/14/yep-28-skill-learn-system/
Yeah I have been all over that page but I am not seeing how to temporarily disable an already learned passive skill.


Learn Show Eval makes the skill disappear from the menu, but it doesn't stop the effect of a passive that has been learned.


<Learn Show Eval>


if (user.isStateAffected(40)) {


value = true;


} else {


value = false;


}


</Learn Show Eval>


I also tried this from SkillCore, but it doesn't turn it off: 


<Custom Requirement>


if (user.isStateAffected(40)) {


value = true;


} else {


value = false;


}


</Custom Requirement>


State 40 being the state the player gets when they equip the weapon.  Unequipping it should turn it false...  Is there another line I need to insert into the custom requirement block?  <Passive State: 15> is what the skill grants.  I just need it to apply based on the custom requirement or some other block of code, but I don't know what to put and where/how to put it.
Ok, I figured it out.  I just put the conditional check inside the passive state.  Saves me from having to mess with the skill.


So this block goes in the skill and hides the skill when the weapon is unequipped:


<Learn Show Eval>


if (user.isStateAffected(40)) {


value = true;


} else {


value = false;


}


</Learn Show Eval>


And this block goes in the passive state and disables the passive when the weapon is unequipped:


<Custom Passive Condition>


if (user.isStateAffected(40)) {


condition = true;


} else {


condition = false;


}


</Custom Passive Condition>


Thanks guys!
Why don't you just set the condition to the weapon being equipped rather than the state being present?


You can also shorted that big block to something like this:


<Custom Requirement>


value = user.isStateAffected(40);


</Custom Requirement>


instead of all the "if condition then true, else false" stuff.
How do I have it check to see if they have a specific weapon type equipped?

Original thread: https://forums.rpgmakerweb.com/threads/how-to-disable-a-learned-skill-passive-state-when-weapon-type-unequipped.70843/