MV Yanfly's ItemDurability; how do I increase the durability of a specific piece of equipment without going above the Durability Max?

So I actually have both Yanfly's ItemDurability plugin, as well as Maliki's Item Durability EX plugin. I have a very specific item that is repaired in a unique way. A "Purse Mimic" which can be tamed in battle by feeding it Gold, and become an offhand piece of equipment. It cannot be repaired at a blacksmith (the repair method I plan on using for this game) and instead, when the Purse Mimic is equipped it gives access to a few Special skills, one of which is "Feed". upon feeding the Purse Mimic some of your gold, its Durability should be restored to its Max of 100. I have all of this mostly working, with the only exception being that when you feed the Purse Mimic, its durability increases beyond the Max of 100.

Can anyone help me fix this issue?

Yanfly's ItemDurability plugin; http://www.yanfly.moe/wiki/Item_Durability_(YEP)

Maliki's Item Durability EX plugin; https://forums.rpgmakerweb.com/index.php?threads/malikis-item-durability-ex-ver-1-8b.64945/
It's hard to tell you what to fix without seeing the code/plugin commands that you're already using.

According to the documentation for Maliki's plugin, you'd use:
Code:
$gameParty.changeItemDurability(type, id, amount);
with the type being, presumably, "armor", the ID whatever it is, and the amount being 99 to guarantee to repair it from any non-broken value.

I see there isn't any check in the code to prevent that function from going over the max durability, which I would consider an oversight. @Maliki79 is active on the forums, so you should just post in that thread and point it out, and I'm sure it would get patched quickly.

You could also do it the hard way and subtract the current durability from 100, but I'd just report the error.

Code:
100-$gameParty.armors()[ID].durability
in the place of "amount" above. Replace ID with the ID of your purse, no leading zeros.
I'll look into it time permitting. Thanks for pointing this out.
For the time being, until @Maliki79 writes it the way he wants, here's a temporary fix for you.

Open the plugin in a text editor, go to line 602, and replace it with this:
Code:
this.weapons()[i].durability=Math.min(this.weapons()[i].durMax, this.weapons()[i].durability+amount);

Then, similarly, replace line 614 with:
Code:
this.armors()[i].durability=Math.min(this.armors()[i].durMax, this.armors()[i].durability+amount);

Save, refresh the plugin in your plugin manager, save your project.
Plugin Updated.
(OMG Do I need to remake these plugins.)
Open the plugin in a text editor, go to line 602, and replace it with this:
Code:
this.weapons()[i].durability=Math.min(this.weapons()[i].durMax, this.weapons()[i].durability+amount);
Then, similarly, replace line 614 with:
Code:
this.armors()[i].durability=Math.min(this.armors()[i].durMax, this.armors()[i].durability+amount);
Save, refresh the plugin in your plugin manager, save your project.
I just tried this out, and unfortunately it doesn't seem to work. somehow, nothing has changed; the command is still working exactly as before.

Edit: just realized I did this with the wrong version of the plugin. I re-downloaded the plugin from his page after he said he updated it. But even still, with his updated version, unedited, it doesn't seem to work.
Plugin Updated.
I re-downloaded the plugin from your page, and unedited, it doesn't seem to work any different.
When you make changes are you following all of these steps?

- Refresh the plugin in your plugin manager

- Save your project

- Start a new game, don't load a save
- Refresh the plugin in your plugin manager

- Save your project

- Start a new game, don't load a save
I removed it, then saved my project, then added it back in, then saved it again. I also don't ever save the game when playtesting, so no I didn't load a save.
Then please show the code you're using. The code I supplied (and presumably the change Maliki made) can't just not work 😛
Hmmm....

Let's back up just a bit.
Exactly how are you using that "Feed" skill exactly? Maybe a as of the database entry for that skill will help.

BTW if you are using code like item.durability += 100 it won't use the check.

You HAVE to use $gameParty.changeItemDurability(type, id, amount);
Hmmm....

Let's back up just a bit.
Exactly how are you using that "Feed" skill exactly? Maybe a as of the database entry for that skill will help.

BTW if you are using code like item.durability += 100 it won't use the check.

You HAVE to use $gameParty.changeItemDurability(type, id, amount);
okay, so; when the Purse Mimic is equipped, it gives access to a skill called "Feed". That skill applies the status effect "Purse Mimic Effect" and triggers a common event called "Feeding Purse Mimic". Inside the common event, the game goes through all of the party members checking to see which one is effected by the "Purse Mimic Effect". Then it runs the following script call;
Code:
$gameParty.changeItemDurability("armor", $gameParty.members()[0]._equips[0]._itemId, +999);

Edit: the "Feed" skill's ID is 57, the common event's ID is 16, and the Purse Mimic's equipment type ID is 2 (it takes the place of a shield)
Code:
$gameParty.changeItemDurability("armor", $gameParty.members()[0]._equips[0]._itemId, +999);
That looks like it's probably incorrect.
1 - Unless you moved things around, equips[0] is your weapon slot, not an armor.

2 - You shouldn't directly access _equips and _itemId, you should use the getter functions.

3 - The +999 might not hurt, but it's not strictly the correct format for a number. It should be just 999.
You shouldn't directly access _equips and _itemId, you should use the getter functions.
what are "getter functions"?
what are "getter functions"?
A function that provides the value of an object's property.

It's good practice to use them where they exist, rather than accessing the property directly, because there may be internal math (whether from the engine or plugins) that modifies it en route.

The best example of it would be parameters - you use the getter function actor.param(ID) rather than directly accessing any of the arrays because that returns the base parameter from the class plus modifiers, buffs, and minimum/maximum values capping it.

So you'd reference equips() and itemId().
You shouldn't directly access _equips and _itemId, you should use the getter functions.
So you'd reference equips() and itemId().
So, are you saying it should look more like this?
Code:
$gameParty.changeItemDurability("armor", $gameParty.members()[0].equips()[1].itemId()[8], 999);

Edit: never mind, that didn't work. It just gave me an error.
So, are you saying it should look more like this?
No - where did the [8] come from?
itemId() returns a number not an Array...
where did the [8] come from?
that's the ID of the Mimic Purse.
that's the ID of the Mimic Purse.
No, itemId() provides the ID. A number inside brackets is the index of an array, which is not applicable here.

Are you using the rest of the code correctly? For example, $gameParty.members()[0] refers specifically to the first member of the party, the leader on the map.

Are you changing the [0] when you're referring to the other party members? For that matter, it's probably better to be referring to them specifically by their ID:
Code:
$gameParty.changeItemDurability("armor", $gameActors.actor(5).equips()[1].itemId(), 999);
where 5 is whatever the ID of the actor is.

I think we really need screenshots of your entire event.

Original thread: https://forums.rpgmakerweb.com/threads/yanflys-itemdurability-how-do-i-increase-the-durability-of-a-specific-piece-of-equipment-without-going-above-the-durability-max.159182/