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

Zeustiak

Veteran
Veteran
Joined
Oct 11, 2016
Messages
37
Reaction score
7
First Language
English
Primarily Uses
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!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
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.
 

Zeustiak

Veteran
Veteran
Joined
Oct 11, 2016
Messages
37
Reaction score
7
First Language
English
Primarily Uses
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.
 

Zeustiak

Veteran
Veteran
Joined
Oct 11, 2016
Messages
37
Reaction score
7
First Language
English
Primarily Uses
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.
 

Zeustiak

Veteran
Veteran
Joined
Oct 11, 2016
Messages
37
Reaction score
7
First Language
English
Primarily Uses
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!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
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.
 
Last edited by a moderator:

Zeustiak

Veteran
Veteran
Joined
Oct 11, 2016
Messages
37
Reaction score
7
First Language
English
Primarily Uses
How do I have it check to see if they have a specific weapon type equipped?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,049
Messages
1,018,546
Members
137,835
Latest member
yetisteven
Top