MV Please help Mastery Skills(Passive Skills)

I made a weapons mastery using YEP_BuffsStatesCore

this is the original code
↓↓↓↓↓↓↓↓↓↓↓↓
<Custom Passive Condition>
// Get all currently equipped weapons for the user.
var weapons = user.weapons();
// Set the swords variable.
var swords = 2;
// Set the initial condition to be false.
condition = false;
// Loop through each of the weapons.
for (var i = 0; i < weapons.length; ++i) {
// Get the currently looped weapon.
var weapon = weapons;
// Check if the weapon exists and if the weapon type ID matches the sword ID.
if (weapon && weapon.wtypeId === swords) {
// Set the condition to be true.
condition = true;
// Break the loop.
break;
}
}
</Custom Passive Condition>
↑↑↑↑↑↑↑↑↑↑↑↑
this is the original code




I thought a simple change would make Armor mastery too.

But of course, the Armor Mastery that I made didn't work properly



this is my code
↓↓↓↓↓↓↓↓↓↓↓↓
<Custom Passive Condition>
// Get all currently equipped armors for the user.
var armors = user.armors();
// Set the shields variable.
var shields = 2;
// Set the initial condition to be false.
condition = false;
// Loop through each of the armors.
for (var i = 0; i < armors.length; ++i) {
// Get the currently looped armors.
var armors = armors;
// Check if the armors exists and if the armors type ID matches the shields ID.
if (armors && armors.wtypeId === shields) {
// Set the condition to be true.
condition = true;
// Break the loop.
break;
}
}
</Custom Passive Condition>
↑↑↑↑↑↑↑↑↑↑↑↑
this is my code


Why does this problem occur?

I changed swords to armors, and tried armors to armor, but it never worked!

I'd appreciate it if you could tell me what I'm doing wrong.

I've moved this thread to Plugin Support. Thank you.

Moved to: Plugin Support
In fact, I realized that I posted it wrong in a second, but I didn't know how to move it.
I'm very sorry.
the reason it doesn't work is in this line:

f (armors && armors.wtypeId === shields) {

Wtype = weapons, so you need atype (armors) or itype (items).
atype might fix your problem though, if not, then I miss something.
the reason it doesn't work is in this line:

f (armors && armors.wtypeId === shields) {

Wtype = weapons, so you need atype (armors) or itype (items).
atype might fix your problem though, if not, then I miss something.

Thank you for your answer.
I forgot about it.


And the link below was also helpful.


If someone has a similar problem, please refer to it.

Original thread: https://forums.rpgmakerweb.com/threads/please-help-mastery-skills-passive-skills.130699/