drawline(x1,y1,x2,y2,z,color,alpha)
drawdot(x, y, z,color,alpha)
- draw a line from (x1, y1) to (x2, y2)
- x1, y1: position values of the start point.
- x2, y2: position values of the end point.
- z: depth value, similar to setlayer command or entities, check it for details.
- color: color index in palette, check you palette.
- alpha: alpha blending effect from 1 to 6, this parameter is optional.
- return: none
- draw a dot at (x, y)
- x, y: position values of the dot.
- z: depth value, similar to setlayer command or entities, check it for details.
- color: color index in palette, check you palette.
- alpha: alpha blending effect from 1 to 6, this parameter is optional.
either you line it straight or curved
I'm currently using the default lifebar.@DD Tokki
Is your life bar in percentage mode or in the native mode (multi-color bar)? The code is not too complicated, like @DCurrent said there's a lot of ways to do it but before posting more details about my current life bar code I would like to know which mode you are using.
This is the code I used in the video, I prefer to use the drawbox in this case because just attaching the health amount to the width is enough to make it work properly.
C://YELLOW BAR, LIFE REMAINING if(pLife > 0){ drawbox(xPos+xAdd+4, yPos, pLife, ySize, layer2, healthColor); //LINE 1 drawbox(xPos+xAdd+3, yPos+1, pLife, ySize, layer2, healthColor); //LINE 2 drawbox(xPos+xAdd+2, yPos+2, pLife, ySize, layer2, healthColor); //LINE 3 drawbox(xPos+xAdd+1, yPos+3, pLife, ySize, layer2, healthColor); //LINE 4 drawbox(xPos+xAdd, yPos+4, pLife, ySize, layer2, healthColor); //LINE 5 }
What I mean is this. Look at the blue line here.Drawline is is never curved. Ever.
drawline(150, 30, 176, 40, 3100, rgbcolor(0,0,255), 0);

lifebarstatus is a command I have never written in my game. The type is number 1 according to the description.
This will be not applied in enemies, only for players, right?lifebarstatus is a command I have never written in my game. The type is number 1 according to the description.
void main()
{//Draw custom life bars based on percentage
void player1 = getplayerproperty(0, "entity");
void player2 = getplayerproperty(1, "entity");
void player3 = getplayerproperty(2, "entity");
void player4 = getplayerproperty(3, "entity");
if(openborvariant("in_level") && !openborvariant("pause")){
LifeBarFunction(player1, 0);
LifeBarFunction(player2, 1);
LifeBarFunction(player3, 2);
LifeBarFunction(player4, 3);
}
}
void LifeBarFunction(void player, int pIndex)
{//Script used to reduce code size
//USED FOR PLAYERS ALREADY IN-GAME
if(player != NULL()){
void type = getentityproperty(player, "type");
int exists = getentityproperty(player, "exists");
//DETECTS IF THE DEFINED PLAYER IS IN-GAME AND ALIVE
if(exists){
void target = getentityproperty(player, "opponent");
int maxPLife = getentityproperty(player, "maxhealth");
//int pLife = get_entity_property(player, openborconstant("ENTITY_PROPERTY_HP_OLD"));
int pLife = getentityproperty(player, "health");
int xPos = 50;
int xDif = 120;
int xAdd = xDif*pIndex;
int xSize = 100;
int xNum = 20;
int yPos = 200;
int yAdd = 26;
int yDif = 4;
int ySize = 1;
int yLine = 1;
int yNum = -20;
int layer1 = 40000;
int layer2 = 50000;
int white = rgbcolor(255,255,255);
int black = rgbcolor(0,0,0);
int red = rgbcolor(255,0,0);
int yellow = rgbcolor(255,255,0);
int mode = 1; //1 = PERCENTAGE 2 = NORMAL
int backFill;
int healthColor = yellow;
int alpha = 2;
//PLAYER LIFE BAR IN PERCENTAGE
if(mode == 1){
//CALCULATE REMAINING LIFE BAR SIZE
pLife = (pLife*xSize)/(maxPLife);
//CALCULATE MAX LIFE BAR SIZE
maxPLife = (maxPLife*xSize)/(maxPLife);
//YELLOW BAR, LIFE REMAINING
if(pLife > 0){
drawbox(xPos+xAdd+4, yPos, pLife, ySize, layer2, healthColor);
drawbox(xPos+xAdd+3, yPos+1, pLife, ySize, layer2, healthColor);
drawbox(xPos+xAdd+2, yPos+2, pLife, ySize, layer2, healthColor);
drawbox(xPos+xAdd+1, yPos+3, pLife, ySize, layer2, healthColor);
drawbox(xPos+xAdd, yPos+4, pLife, ySize, layer2, healthColor);
}
//BACK FILL
backFill = black;
drawbox(xPos+xAdd+4, yPos, xSize, ySize, layer1, backFill);
drawbox(xPos+xAdd+3, yPos+1, xSize, ySize, layer1, backFill);
drawbox(xPos+xAdd+2, yPos+2, xSize, ySize, layer1, backFill);
drawbox(xPos+xAdd+1, yPos+3, xSize, ySize, layer1, backFill);
drawbox(xPos+xAdd, yPos+4, xSize, ySize, layer1, backFill);
}
}
}
}
This will be not applied in enemies, only for players, right?

I suggest making it work for players first, and after everything is correct then we can proceed to bosses. I edited my previous post with the codes.For Enemy, it doesn't matter if it doesn't apply because a mini life bar appears on the main body, but for players and bosses, it would be nice if a life bar appears and applies to bosses as well, but for now, I hope it applies to players.
You can remove the native life bar by simply changing its position to a very high value, like this.You have to remove the existing life bar and adjust the position of the life bar created with the script
p1life 999 999 #0 19
p2life 999 999 #120 19
p3life 999 999 #240 19
p4life 999 999 #360 19


You can remove the native life bar by simply changing its position to a very high value, like this.
C:p1life 999 999 #0 19 p2life 999 999 #120 19 p3life 999 999 #240 19 p4life 999 999 #360 19
View attachment 7284
EDIT: I added some comments to guide you.
View attachment 7286

GreatThe 1P and 2P script settings have been adjusted, and stamina decreases diagonally. It has become the shape I wanted.
First proceed to mp, we can use the same health script but replaced by mp values instead. You can mix both in the same updated.c and you look like the code below.Now, all you have to do is set MP and boss life bar, and the life bar setting is complete.
void main()
{//Draw custom life bars based on percentage
void player1 = getplayerproperty(0, "entity");
void player2 = getplayerproperty(1, "entity");
void player3 = getplayerproperty(2, "entity");
void player4 = getplayerproperty(3, "entity");
if(openborvariant("in_level") && !openborvariant("pause")){
LifeBarFunction(player1, 0);
LifeBarFunction(player2, 1);
LifeBarFunction(player3, 2);
LifeBarFunction(player4, 3);
mpBarFunction(player1, 0);
mpBarFunction(player2, 0);
mpBarFunction(player3, 0);
mpBarFunction(player4, 0);
}
}
void mpBarFunction(void player, int pIndex)
{//Script used to reduce code size
//USED FOR PLAYERS ALREADY IN-GAME
if(player != NULL()){
void type = getentityproperty(player, "type");
int exists = getentityproperty(player, "exists");
//DETECTS IF THE DEFINED PLAYER IS IN-GAME AND ALIVE
if(exists){
int maxMp = getentityproperty(player, "maxmp");
//int pLife = get_entity_property(player, openborconstant("ENTITY_PROPERTY_HP_OLD"));
int pLife = getentityproperty(player, "health");
int mp = getentityproperty(player, "mp");
int xPos = 50;
int xDif = 120;
int xAdd = xDif*pIndex;
int xSize = 100;
int xNum = 20;
int yPos = 200;
int yAdd = 26;
int yDif = 4;
int ySize = 1;
int yLine = 1;
int yNum = -20;
int layer1 = 40000;
int layer2 = 50000;
int white = rgbcolor(255,255,255);
int black = rgbcolor(0,0,0);
int red = rgbcolor(255,0,0);
int yellow = rgbcolor(255,255,0);
int mode = 1; //1 = PERCENTAGE 2 = NORMAL
int backFill;
int mpColor = red;
int alpha = 2;
//PLAYER LIFE BAR IN PERCENTAGE
if(mode == 1){
//CALCULATE REMAINING LIFE BAR SIZE
mp = (mp*xSize)/(maxMp);
//CALCULATE MAX LIFE BAR SIZE
maxMp = (maxMp*xSize)/(maxMp);
//YELLOW BAR, LIFE REMAINING
if(pLife > 0 && mp > 0){
drawbox(xPos+xAdd+4, yPos, mp, ySize, layer2, mpColor);
drawbox(xPos+xAdd+3, yPos+1, mp, ySize, layer2, mpColor);
drawbox(xPos+xAdd+2, yPos+2, mp, ySize, layer2, mpColor);
drawbox(xPos+xAdd+1, yPos+3, mp, ySize, layer2, mpColor);
drawbox(xPos+xAdd, yPos+4, mp, ySize, layer2, mpColor);
}
//BACK FILL
backFill = black;
drawbox(xPos+xAdd+4, yPos, xSize, ySize, layer1, backFill);
drawbox(xPos+xAdd+3, yPos+1, xSize, ySize, layer1, backFill);
drawbox(xPos+xAdd+2, yPos+2, xSize, ySize, layer1, backFill);
drawbox(xPos+xAdd+1, yPos+3, xSize, ySize, layer1, backFill);
drawbox(xPos+xAdd, yPos+4, xSize, ySize, layer1, backFill);
}
}
}
}
ondrawscript data/scripts/ondraw.c
void main()
{//Script used to reduce code size
void self = getlocalvar("self");
int maxLife = getentityproperty(self, "maxhealth");
int life = getentityproperty(self, "health");
int xPos = 50;
int xSize = 100;
int yPos = 200;
int ySize = 1;
int yLine = 1;
int layer1 = 40000;
int layer2 = 50000;
int white = rgbcolor(255,255,255);
int black = rgbcolor(0,0,0);
int red = rgbcolor(255,0,0);
int yellow = rgbcolor(255,255,0);
int backFill;
int healthColor = yellow;
//CALCULATE REMAINING LIFE BAR SIZE
life = (life*xSize)/(maxLife);
//CALCULATE MAX LIFE BAR SIZE
maxLife = (maxLife*xSize)/(maxLife);
//YELLOW BAR, LIFE REMAINING
if(life > 0){
drawbox(xPos+4, yPos, life, ySize, layer2, healthColor);
drawbox(xPos+3, yPos+1, life, ySize, layer2, healthColor);
drawbox(xPos+2, yPos+2, life, ySize, layer2, healthColor);
drawbox(xPos+1, yPos+3, life, ySize, layer2, healthColor);
drawbox(xPos, yPos+4, life, ySize, layer2, healthColor);
}
//BACK FILL
backFill = black;
drawbox(xPos+4, yPos, xSize, ySize, layer1, backFill);
drawbox(xPos+3, yPos+1, xSize, ySize, layer1, backFill);
drawbox(xPos+2, yPos+2, xSize, ySize, layer1, backFill);
drawbox(xPos+1, yPos+3, xSize, ySize, layer1, backFill);
drawbox(xPos, yPos+4, xSize, ySize, layer1, backFill);
}
