MV Check if any actor has X item equipped

Hello,

I noticed that in conditional branch event menu, there is a option to check if specific actor has an item equipped. How would a scriptcall which checks if any party member has item X(weapon or armor) equipped look like?
If we suppose that you're looking to see if any party member is wearing an armor with ID 24, then the script call would look like this:
JavaScript:
$gameParty.members().some(member => member.hasArmor($dataArmors[24]));

That will return either true or false, so you can stick that script call directly into the script box of a conditional statement.

Obviously, you'd want to change the 24 to be whatever the actual ID you're interested in is. And if you want to check for a weapon instead, it would be like this:
JavaScript:
$gameParty.members().some(member => member.hasWeapon($dataWeapons[Id]));
If we suppose that you're looking to see if any party member is wearing an armor with ID 24, then the script call would look like this:
JavaScript:
$gameParty.members().some(member => member.hasArmor($dataArmors[24]));

That will return either true or false, so you can stick that script call directly into the script box of a conditional statement.

Obviously, you'd want to change the 24 to be whatever the actual ID you're interested in is. And if you want to check for a weapon instead, it would be like this:
JavaScript:
$gameParty.members().some(member => member.hasWeapon($dataWeapons[Id]));
Thank you, exactly what I needed.

Original thread: https://forums.rpgmakerweb.com/threads/check-if-any-actor-has-x-item-equipped.148597/