How do I refill an item at event?

I'm looking to make something similar to a dark souls estus flask. the item has a max value and and when activating an event the item would go to the max amount.

example:

estus flask x10 max

estus flask x2 left

activate event: estux flask x10
@FleshToDust
Have that event run a scriptcall.
PHP:
var current = $gameParty.numItems($dataItems[1]);
var missing = 10 - current;
$gameMessage.addText("Gained " + missing + "x\\i[179]\\c[12]Estus");
$gameParty.gainItem($dataItems[1]);
Replace the 1 with your id for the estus flask.
It worked. Thanks for the help.
Yes.
Are you sure that the event did run?
Yes.
Are you sure that the event did run?
It worked. I just forgot to put an image on the event.
Alright. 🙂

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-refill-an-item-at-event.83386/