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]);