I have an event that allows the party to restore all hp. I have rigged up the dialogue, a variable that holds the inn's price, all that, but there is one thing I am having trouble doing: setting the price. I would like the price to be the total missing hp of the party - however the formula to do so is giving me a lot of trouble. Using google I came up with the following formula: (spaced out for readability)
Code:
This is inserted into a Control Variables event command. However, when testing it out ingame, the price is consistently 0 no matter the health of my party. I can't figure out what I'm doing wrong.$gameParty.members().forEach(function(m){
$gameVariables.setValue(5, $gameVariables.value(5) + (m.mhp - m.hp))
})Here's a screenshot of the event in case the script isn't enough:
Spoiler
Thank you!
Elsa