MZ How to change this javascript ?

Hello I found this javascript for healing 20% HP for all my team but i wanted to use this script for healing only one member of my team but i don't know how.
Thanks for the future responses (sorry i'm not english so i speak bad english) !

$gameParty.members().forEach(function(m){
m.gainHp(0.2*(m.mhp));
} );

I've moved this thread to JavaScript/Plugin Support. Thank you.

You originally posted this in MZ Feedback, which is for bug reports or feature requests for the editor.

Change HP command​

If you want to heal a specific actor ID, you can just use the Change HP event command, e.g.

◆Control Variables:#0021 hp = Max HP of Reid ◆Control Variables:#0021 hp /= 5 ◆Change HP:Reid, + {hp}
I.e.
  • Get Reid's Max HP (Control Variables -> Game Data -> Actor);
  • Divide it by 5 (i.e. multiply by 20%);
  • Add that much HP to Reid.

Script call​

Alternatively, here are a couple of script call examples:
  1. Heal actor ID 1 by +20% of their max HP:

    const actor = $gameActors.actor(1); actor.gainHp(actor.mhp * 0.2);

  2. Heal the party member in position 0 (leader) by +20% of their max HP:

    const actor = $gameParty.members()[0]; actor.gainHp(actor.mhp * 0.2);
Thank you so much for helping me (sorry for MZ Feedback) !
Moved to: JavaScript/Plugin SupportYou originally posted this in MZ Feedback, which is for bug reports or feature requests for the editor.

Change HP command​

If you want to heal a specific actor ID, you can just use the Change HP event command, e.g.

◆Control Variables:#0021 hp = Max HP of Reid ◆Control Variables:#0021 hp /= 5 ◆Change HP:Reid, + {hp}

I.e.
  • Get Reid's Max HP (Control Variables -> Game Data -> Actor);
  • Divide it by 5 (i.e. multiply by 20%);
  • Add that much HP to Reid.

Script call​

Alternatively, here are a couple of script call examples:
  1. Heal actor ID 1 by +20% of their max HP:

    const actor = $gameActors.actor(1); actor.gainHp(actor.mhp * 0.2);


  2. Heal the party member in position 0 (leader) by +20% of their max HP:

    const actor = $gameParty.members()[0]; actor.gainHp(actor.mhp * 0.2);

Original thread: https://forums.rpgmakerweb.com/threads/how-to-change-this-javascript.147979/