MV Dark Souls campfire health potions refill

I'm sorry if this isn't the correct place to ask. I would like making a system where you can rest at campfires to heal as well as have flasks (health potions) separate of other healing items that get used up in battle, but refill when resting at a campfire. I couldn't find any other posts on this specific thing, but if I missed anything I wouldn't mind getting redirected to it.

I think I know how to implement fast travel between them (lighting a campfire turns a switch on, use show choices with a conditional branch), but I'm stumped as to making the feature where resting at a campfire restores your HP and MP as well as your flasks. I was wondering if anyone could help me?
This is pretty simple.
At the campfire you'd just add a healing item to the player.
You'd need to limit it to whatever the maximum number possibly is.
There's a few ways you can go about doing that. Either add some to their inventory, then remove excess through a conditional, or check how many they currently have and then add however many they are missing.

Let's do the latter.

First, I would have a game variable to determine how many they can hold at one time - the limit.
Somewhere at the start of your game, I would set variable = x (for example 5)
Let's say this is variable 20 and call it "estusCapacity"

Do a change variable command -> game data -> item, # of [potions] (Estus or whatever the item is)
This will set the variable to the current number in the player's possession.
Let's make this variable 21 and call it "estusPossession"

You can use variable commands to math out how many you need, which might be easier if you are more comfortable with that. Or you can use a script to math out how much they need.

Code:
$gameVariables.setValue(21, ($gameVariables.value(20) - $gameVariables.value(21)));

This is basically setting estusPossession to the difference between the what they are currently holding and the total capacity.
(in other words, let's say the player currently has 2 estus on them. This equation is saying 5 - 2. So when we run the change item command using this variable, it will be 3, increasing their current count by 3)

So next you need to do an change item command, select the estus, set it to increase, and use variable 21.

Just for safe measure I would run the variable to get how many estus are in their possession again just to make sure nothing wonky happens later since it would be set to the difference and not the true possession value.

Hope that helps!

p.s.
The reason we are putting the capacity in a variable instead of using a flat number is so you can change it easily later on. Either for game play reasons - such as the player unlocking the ability to hold more (or less!) estus; or balancing reasons. It's as simple as changing this one number and any other reference to it in the game will be changed.
add some to their inventory, then remove excess through a conditional
The reverse should also be pretty easy to do and should cover what's needed with one variable. You have your capacity variable, remove all estus from the player, and then give them that variable's value in estus flasks. No need to track how many they have if you remove them all and then give them how many they need.
This is pretty simple.
At the campfire you'd just add a healing item to the player.
You'd need to limit it to whatever the maximum number possibly is.
There's a few ways you can go about doing that. Either add some to their inventory, then remove excess through a conditional, or check how many they currently have and then add however many they are missing.

Let's do the latter.

First, I would have a game variable to determine how many they can hold at one time - the limit.
Somewhere at the start of your game, I would set variable = x (for example 5)
Let's say this is variable 20 and call it "estusCapacity"

Do a change variable command -> game data -> item, # of [potions] (Estus or whatever the item is)
This will set the variable to the current number in the player's possession.
Let's make this variable 21 and call it "estusPossession"

You can use variable commands to math out how many you need, which might be easier if you are more comfortable with that. Or you can use a script to math out how much they need.

Code:
$gameVariables.setValue(21, ($gameVariables.value(20) - $gameVariables.value(21)));

This is basically setting estusPossession to the difference between the what they are currently holding and the total capacity.
(in other words, let's say the player currently has 2 estus on them. This equation is saying 5 - 2. So when we run the change item command using this variable, it will be 3, increasing their current count by 3)

So next you need to do an change item command, select the estus, set it to increase, and use variable 21.

Just for safe measure I would run the variable to get how many estus are in their possession again just to make sure nothing wonky happens later since it would be set to the difference and not the true possession value.

Hope that helps!

p.s.
The reason we are putting the capacity in a variable instead of using a flat number is so you can change it easily later on. Either for game play reasons - such as the player unlocking the ability to hold more (or less!) estus; or balancing reasons. It's as simple as changing this one number and any other reference to it in the game will be changed.
Thank you so much, @Robro33 as well. I'll have to try it when I get the time

Original thread: https://forums.rpgmakerweb.com/threads/dark-souls-campfire-health-potions-refill.181049/