MV Limiting the number of unique items in inventory

I'd like to place a limit on the number of unique items the player can have in their inventory. I figured out that you can change the max number of items in a stack from 99 to 999 by running:


Game_Party.prototype.maxItems = function(item) {
return 999;
};


and that works fine, but what about limiting the number of unique items? I saw this in rpg_objects.js:


Game_Party.prototype.numItems = function(item) {
var container = this.itemContainer(item);
return container ? container[item.id] || 0 : 0;
};


and thought it might have something to do with that, but I don't know what to do with it.

Thanks!

EDIT: And if that's not possible, is there a way to check to see how many unique items there are in the inventory? Something I could use in a conditional argument?
is there a way to check to see how many unique items there are in the inventory?
Code:
this.items().length
like this?
Code:
this.items().length
like this?

When I use "Control Variable : #0075 unique_item_count = this.items().length" I get error message "this.items is not a function".
When I use "Control Variable : #0075 unique_item_count = this.items().length" I get error message "this.items is not a function".
Of course, you need to replace "this" with $gameParty in that case
@TheoAllen
Oh, I see. Yes, that works great. Thanks so much!

EDIT: That said, if there is a way to just put a hard limit on the number of unique items one can have, that would be preferable to using a condition every time I add an item.
@TheoAllen
Oh, I see. Yes, that works great. Thanks so much!

EDIT: That said, if there is a way to just put a hard limit on the number of unique items one can have, that would be preferable to using a condition every time I add an item.
indeed. For example, making items that stack to 10, and cannot exist in more than 1 stack would be fabulous.

Original thread: https://forums.rpgmakerweb.com/threads/limiting-the-number-of-unique-items-in-inventory.132853/