MV HP bar HUD (not only first actor but Party average health)

Hello I'm trying to mod an existing plugin to show health party HUD on a gauge bar.
This is nice and cool, but I'd like to change the following:
this.drawActorHp($gameParty.leader(), 0, 0, 200)
to an average value of the whole team party health or, alternatively, 4 different bars for each character. Can anyone help me?


This is the full code from mrcopra:
/*:
* @plugindesc HealthBar
* @Author mrcopra
*
* @Help
*
*/
(function() {


//////////////////////////////////////////////////////////////////////////////////////

var _Scene_Map_start = Scene_Map.prototype.start;
Scene_Map.prototype.start = function() {
_Scene_Map_start.call(this);
this._myWindow = new My_Window(100,100);
this.addWindow(this._myWindow);
};

var _Scene_Map_update = Scene_Map.prototype.update;

Scene_Map.prototype.update = function() {
_Scene_Map_update.call(this);
this._myWindow.refresh();
};



function My_Window() {
this.initialize.apply(this, arguments);
}

My_Window.prototype = Object.create(Window_Base.prototype);
My_Window.prototype.constructor = My_Window;


My_Window.prototype.initialize = function(x, y) {
Window_Base.prototype.initialize.call(this, 600, 0, this.windowWidth(), this.windowHeight());
this._value = -1;
this.refresh();
};

My_Window.prototype.refresh = function(){

this.contents.clear();
this.drawActorHp($gameParty.leader(), 0, 0, 200)
};

My_Window.prototype.windowWidth = function(){
return 140;
};
My_Window.prototype.windowHeight = function(){
return 40;
};

///////////////////////////////////////////////////////////////////////////////////////////////
})();
I make my HUD on map with SRD_HUDMaker, because you can show
it if the actor is present or not, also 1 bar for average of it.

but if you want to modify, you need the check leght of the part,
and their HP.

if your part has 4, than party maxhp is dived by 4, or something
that shares the HP, if 1 get dmg, so does the rest.

but while that is probably simple plugin, you need to add more functions
or alter to check for all players.
I'd prefer to stay with that code. The party can be 1, 2, 3 or 4 characters.
So I have to divide by the number of party lenght.
Can you help me?
Tried this but doesn't work:

My_Window.prototype.refresh = function(){

this.contents.clear();
this.drawActorHp($gameParty.member.all.hp(), 0, 0, 200)
};
the last line is probably incorrect and I didn't mess with party members
while I aim on 1 actor, but my JS beside that is also on the learning
curve and figure some things out I need for my ULS plugin.

but there are better codes that can help you of add what you need.
as well for a cleaner code than I useally have currently 🙂

Original thread: https://forums.rpgmakerweb.com/threads/hp-bar-hud-not-only-first-actor-but-party-average-health.141672/