How many Wepons and Armors?

Is there an eqivilent for:

$gameParty.numItems(n)

That will do the same for wepons and armors, I have already created the work around just checking I'm not missing something simple or that dyslexia has failed me somewhere.

Cheers
What I'd suggest, unless you really need it to be a script, is to use a variable to get this.
  • Control Variables > Set > Game Data > Item|Weapon|Armor.

Otherwise: the numItems function takes an item object for its argument, not an item ID. The object reference will be from one of three arrays, depending on its type: $dataItems[n], $dataWeapons[n], or $dataArmors[n]. So, for example, this will return the number of weapon #3 that the party possesses:
Code:
$gameParty.numItems($dataWeapons[3]);
For reference, here's a snippet of code from the Control Variables command (found in rpg_objects.js):
Code:
Game_Interpreter.prototype.gameDataOperand = function(type, param1, param2) {
    switch (type) {
    case 0:  // Item
        return $gameParty.numItems($dataItems[param1]);
    case 1:  // Weapon
        return $gameParty.numItems($dataWeapons[param1]);
    case 2:  // Armor
        return $gameParty.numItems($dataArmors[param1]);
As I thought was just missing some simple, cheers

(I do wish people in the Javascript section of the forum, especially the "Learning Javascript" section would quit trying to convince people not to learn by not applying the Javascript)
As I thought was just missing some simple, cheers
Happy to help! ^_^
(I do wish people in the Javascript section of the forum, especially the "Learning Javascript" section would quit trying to convince people not to learn by not applying the Javascript)
If I offended then I apologise; it was unintentional. 😅

However, in case you're unaware: the code for all event commands can be found in rpg_objects.js, under the Game_Interpreter object. Every command's code is headed by a comment stating the command name, making it easy to look up the code version for any event command. Not to dissuade you from asking questions here, but it may save you a little time in future. =)
@caethyril no offence taken, my appreciation was genuine!

I just think that there is a slight toxic air in these forums, that for some reason is geared towards not encouraging people to play/fail/learn when it comes to the scripting in RPG Maker.

What you said was really not that bad and was definitely solution based so I apologise also
Strangely, I was just about to go the scripting route myself, reasoning that there WAS a $dataWeapons based on there being a $dataItems that I had used elsewhere, but when I searched the forum for "count weapons" as my first try this post didn't show up for the ridiculous reason that the OP didn't spell it correctly. Found this post on a follow-up search for $dataWeapons.
I'm not sure if I should facepalm for not thinking to look in the Control Variables command when I couldn't find a way to count weapons or armor in the Conditional Branch command.

Original thread: https://forums.rpgmakerweb.com/threads/how-many-wepons-and-armors.92194/