MV Yanfly Max Item Problem

I'm using the Yanfly Item Core with the Yanfly Core Engine to try and achieve max item limits, and display the max number of items you can carry for each.

The Yanfly Core Engine has an Item notetag function that allows you to set an individual limit for each item:
<Max Item: x>

However, it seems the Yanfly Item Core overwrites this function and sets every items max limit to whatever the base max item limit is in the Plugin Parameters. If I set this parameter to 0 the notetag function starts working again, but it also makes the menu visual that shows the max number of items you can carry disappear (The "/999" visual).

This seems like a really big oversight, are these plugins really not compatible in this aspect?


Screenshot 2024-02-20 013131.png

Screenshot 2024-02-20 013230.png
Try this.

Open the Item Core in a text editor, and go to line 1150. Replace that and the next two lines with this:
Code:
    if (DataManager.isItem(item)) return Yanfly.Param.ItemMaxItems ? Yanfly.Param.ItemMaxItems : this.maxItems(item);
    if (DataManager.isWeapon(item)) return Yanfly.Param.ItemMaxWeapons Yanfly.Param.ItemMaxWeapons : this.maxItems(item);
    if (DataManager.isArmor(item)) return Yanfly.Param.ItemMaxArmors ? Yanfly.Param.ItemMaxArmors : this.maxItems(item);

I haven't tested it, but at first glance that should cause non-independent items to show your note-defined maximum.

If there's some other layer that causes that to have a weird display, show us that and we'll go from there.
Try this.

Open the Item Core in a text editor, and go to line 1150. Replace that and the next two lines with this:
Code:
    if (DataManager.isItem(item)) return Yanfly.Param.ItemMaxItems ? Yanfly.Param.ItemMaxItems : this.maxItems(item);
    if (DataManager.isWeapon(item)) return Yanfly.Param.ItemMaxWeapons Yanfly.Param.ItemMaxWeapons : this.maxItems(item);
    if (DataManager.isArmor(item)) return Yanfly.Param.ItemMaxArmors ? Yanfly.Param.ItemMaxArmors : this.maxItems(item);

I haven't tested it, but at first glance that should cause non-independent items to show your note-defined maximum.

If there's some other layer that causes that to have a weird display, show us that and we'll go from there.
(Very minor, but you missed the "?" in that second line, I caught and fixed that when replacing though so no biggie.)

Unfortunately however it doesn't seem to have changed anything, I still get the base parameter max instead of the individual item max defined in the notes, like in the screenshots.
To clarify - the solution I gave you is for when the item type is not independent (has 0 in the parameter for Item Core).

You can't do what you're asking for if the item type is set to independent, because by definition every item of that kind is independent; e.g. a single-item stack. You'd never have a stack of, say, 15.

Does it still not work as expected under those circumstances?
To clarify - the solution I gave you is for when the item type is not independent (has 0 in the parameter for Item Core).

You can't do what you're asking for if the item type is set to independent, because by definition every item of that kind is independent; e.g. a single-item stack. You'd never have a stack of, say, 15.

Does it still not work as expected under those circumstances?
Ah gotcha. And no sadly, the max item limits still don't display even when the base parameter is set 0. Just displays the current items you have as it usually does.
Screenshot 2024-02-20 045237.png

Screenshot 2024-02-20 045105.png
Right, because the limit is only shown for categories that have one.

Well, as far as I can see, if you have the category set to not be independent, the notetag from Yanfly's Core Engine should apply just like it always does.

If you want it to be displayed in the item window like the independent items do, that's a little bit more of actually reworking Yanfly's code for the UI change.
Right, because the limit is only shown for categories that have one.

Well, as far as I can see, if you have the category set to not be independent, the notetag from Yanfly's Core Engine should apply just like it always does.

If you want it to be displayed in the item window like the independent items do, that's a little bit more of actually reworking Yanfly's code for the UI change.
Yeah, that was pretty much the problem from the start. I can make the notetag item limits work, but it will only display the limits with the parameter that overwrites it turned on. Just seems really odd to me that these two plugins aren't really compatible in that way when they both deal with item limits, oh well.

Thanks for the help either way. I don't have the best coding knowledge, but I'm looking through to see if I can tell what needs to be changed.
The problem is not an incompability but that neither the core engine nor the item core have a feature to show the maximum of an item stack. The /999 you can see in the OP is only implemented for independent items to signify that this is not an item stack but rather a single item.
1708454533133.png

In this example I have 5 potions and one Magic Water. The "/999" is added so the player doesn't think he has 1+2+3+4+5 = 15 potions, but rather a 1st, a 2nd, a 3rd potion and so on.

However I believe the following edit should get you the desired result.
1. Open YEP_CoreEngine.js in a text editor
2. Insert a new line after line 2558.
3. Insert the following code in the new line.

JavaScript:
if(DataManager.isItem(item))
    this.drawText('\u00d7' + numItems + '/' + item.maxItem, x, y, width, 'right');
else
The problem is not an incompability but that neither the core engine nor the item core have a feature to show the maximum of an item stack. The /999 you can see in the OP is only implemented for independent items to signify that this is not an item stack but rather a single item.
View attachment 295981
In this example I have 5 potions and one Magic Water. The "/999" is added so the player doesn't think he has 1+2+3+4+5 = 15 potions, but rather a 1st, a 2nd, a 3rd potion and so on.

However I believe the following edit should get you the desired result.
1. Open YEP_CoreEngine.js in a text editor
2. Insert a new line after line 2558.
3. Insert the following code in the new line.

JavaScript:
if(DataManager.isItem(item))
    this.drawText('\u00d7' + numItems + '/' + item.maxItem, x, y, width, 'right');
else
That seems to have worked beautifully, thanks a bunch! 👍 I'm surprised that wasn't already included as an option with how simple of an edit it seems to be.

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-max-item-problem.165960/