Script call to get item quantity?

Hello.
I am looking for the script call to get the quantity of items in your inventory but could not find it yet.

I cannot use the "Control Variables -> Game Data -> Item Possession Count" because the Item which quantity I need changes dynamically and so I literally need to check for "Item X" quantity, where I can replace X with anything.
In my case something like "$gameVariables.value(86)"

EDIT for moderators: Whoops, I kind of fumbled there. Can you please put this into "RPG Maker MV"?

EDIT 2: After some digging in rpg_objects.js, I actually found the solution myself (again, ugh).

For anyone who is interested, it is:


$gameParty.numItems($dataItems[param1])

Where you replace "param1" with the item ID in question, in my case it would look like this:

$gameParty.numItems($dataItems[$gameVariables.value(86)])

The same can be done with weapons and armors:

$gameParty.numItems($dataWeapons[param1])
$gameParty.numItems($dataArmors[param1])
Thread closed

Original thread: https://forums.rpgmakerweb.com/threads/script-call-to-get-item-quantity.133619/