MZ Count the number of a specific armor

I'd like to do that but not only for the inventory, also for equipped armors.
When you use the regular function it only counts what's in the inventory.

1717145094657.png
To get the total number of Armor 216 equipped by party members:

$gameParty.allMembers().reduce((t, m) => t + m.armors().reduce((a, c) => a + (c.id === 216 ? 1 : 0), 0), 0)
You could add that to the inventory count: Control Variables -> Add -> Script. 👋

(For a weapon, replace armors with weapons.)

Original thread: https://forums.rpgmakerweb.com/threads/count-the-number-of-a-specific-armor.169140/