How do you set HP and MP to a percentage?

I wasn't sure where to post this, but I was wondering how you set an individual character or even your whole party's HP and MP to a percentage instead of just doing a static amount, in a non combat, on map event.

Would using a few lines of java script be the way to go about it? If so, can you please show me how to do this, meow?

I have no idea what I'm doing in java script, but I get the feeling it would be something like setHp.player<herpderp> or something like that, but I have no idea, meow. Please help.
I would use a variable to calculate the amount, and then just use the event command with the variable.
I would use a variable to calculate the amount, and then just use the event command with the variable.
Hrm, can you elaborate on how to do this? I am really at a loss. Meow.
Give me a more concrete example of what you want to do. Set it to a percentage of what? And are you talking about the actual HP, or the maximum HP?

I can't tell you how to do it now as I'm at work & don't have MV with me. But I can take a look later, if nobody else has given what you need by then.
Yay @Shaz for being awesome.
Just setting an event to not just restore a percentage of maximum HP, but setting the hp and mp of the party to a % of their maximum hp's and mp's. Say, if they have 100 hp/mp and they were at full hp/mp (100 of each), they click something and it sets them to 80% of their max. It isn't doing a damage amount, it just sets them to a percentage.

I suppose it may help to add another example, if they were at 20 Hp and Mp of 100, and they click this event it sets them to 80% of their 100 HP and MP, or 80/80. It's not restoring a set amount like 60HP/MP it just resets the HP/MP to 80% from where ever they are on the hp/mp scale. Meow.

If a javascript line or two would work in it's place instead of doing a mish mash of variables, I'll take that snippet and just jiggle that around to my kitty needs if .. needed? Meow.
Damage formula: a.hp = a.mhp * 0.8
On map script: $gameParty.members()[0].hp = $gameParty.members()[0].mhp * 0.8;
or maybe: $gameParty.members()[0].hp = $gameParty.members()[0].params[0] * 0.8
In Isabella's example above, the "0" refers to the party leader (1 is the 2nd member, 2 is the 3rd member, and so on.), so you can just repeat for how many party members you have. If you want to control which actor this happens to, that's the way to go.

Alternatively, here is a snippet that will update the HP & MP for all party members.
Code:
$gameParty.members().forEach( function(actor) { actor.setHp(actor.mhp * 0.8) } );
$gameParty.members().forEach( function(actor) { actor.setMp(actor.mmp * 0.8) } );
Translated to English this means:
--For each of the Party members, set HP of the Actor to MHP * 0.8;
--For each of the Party members, set MP of the Actor to MMP * 0.8;
Wow, thanks @Isabella Ava and @Aloe Guvner for also BEING AWESOME. You get capital AWESOME(s), all of you. Meow. Thanks for helping this cat.

(also, if you're reading this, you're awesome too. <3 meow)

Code:
$threadPoster.members().forEach( function(poster) {poster.setAwesomeness.maw * 9000) } );

Original thread: https://forums.rpgmakerweb.com/threads/how-do-you-set-hp-and-mp-to-a-percentage.95128/