Howdy guys, I'm new to RPG Maker. I already tried searching through old posts, but I've not been able to find a solution that works. I'm trying to figure out how to restore my party's HP and MP through meals in a restaurant. I've tried using the Change HP and Change MP commands. I've misunderstood how variables work and this is part of the issue. For example when I go to Change HP and set the actor to the entire party and for the operand variable I tried using "b.mhp * 0.20" to try and restore 20% of the parties HP. That didn't work. The only other thing I can think to try at this point are custom scripts, but I have no knowledge on coding. Does anyone have any recommendations or advice? At this point I'll take an introductory course for Java.
How Can I Recove Party HP and MP Through an Event?
RPG Maker MZ SupportThe script call versions are
JavaScript:
$gameParty.members().forEach(function(m){
m.recoverAll();
});
JavaScript:
$gameParty.members().forEach(function(m){
m.gainHp(Math.round(1*(m.mhp)));
m.gainMp(Math.round(1*(m.mmp)));
});
Can you explain how I need to change that code to make it work for each occasion?
Hey, @Mikeits, I've got a non-script solution for you. You will have to recover each party member's HP one at a time instead of using Recover All, but it accomplishes the same purpose as you wanted.
To recover 20% of each party member's HP, I get their Max HP, divide it by 5, then use Change HP, repeating for each actor in the party.
To recover 20% of each party member's HP, I get their Max HP, divide it by 5, then use Change HP, repeating for each actor in the party.
You put in a script call
$gameParty.members().forEach(function(m){ m.gainHp(Math.round(1*(m.mhp))); m.gainMp(Math.round(1*(m.mmp))); });
And change the 1 to the decimal of the percentage you want to recover (.25 for 25 percent). Delete the m.gainHP or m.gainMP line if you only want to recover one or the other.
You're an angel. That worked. Do you know of any good tutorials for Java Script so I can start writing my own code?
I'll also add this to me repertoire. Thank you.
I just got the code version of the event command from
RPG Maker MV / MZ Script Call List
This Script Call list applies to both RPG Maker MV and RPG Maker MZ. Link here to see the entire list. Supplementary Material for RPG Maker MZ: https://forums.rpgmakerweb.com/index.php?threads/rpg-maker-mz-script-call-reference.122501/ Have fun eventing~
forums.rpgmakerweb.com
As far as Javascript tutorials go, I used FreeCodeCamp and W3 Schools
Thank you for the script call list, Echo (and Mikeits for the good question). I thought doing the reverse (for a BOMB trap popping-up from a chest) would be "m.loseHp" (which doesnt work). ... I didnt think it was simply the same line except with a minus sign added instead... clever!
EDIT: Where would I need to add "false" to prevent a GameOver? Tried various placements and none seemed to have worked. Ill try some more for a leader-only version too.
I think you can use the ready made function that has the check to change the damage value if you've set allow death to false (change -100 to your damage value):
const actor = $gameParty.leader();Game_Interpreter.prototype.changeHp.call(actor, actor, -100, false);Original thread: https://forums.rpgmakerweb.com/threads/how-can-i-recove-party-hp-and-mp-through-an-event.163528/