Is there an example of a life bar with a script applied in a tilted shape?That is not possible using native life bar. You would need to remove the native life bar and use a scripted version, using drawbox()


drawbox(x,y,width,height,z,color,alpha)
- draw a filled box with specified position and size.
- x,y: position values on screen
- width,height: size values.
- 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
void actual_main(){ // Player Main Hud
health();
}
void health() // Player health
{//Update script with player lifebar
//Calling main player
void self = getlocalvar("self");
int P1 = getplayerproperty(0, "entity");
int P2 = getplayerproperty(1, "entity");
void P1Name = getentityproperty(P1, "name");
void P2Name = getentityproperty(P2, "name");
int P1HP = getentityproperty(P1, "health");
int P2HP = getentityproperty(P2, "health");
int P1MaxHP = getentityproperty(P1, "maxhealth");
int P2MaxHP = getentityproperty(P2, "maxhealth");
int P1Health = 114*P1HP/P1MaxHP;
int P2Health = 114*P2HP/P2MaxHP;
int P1Score = getplayerproperty(0, "score");
int P2Score = getplayerproperty(1, "score");
int hres = openborvariant("hresolution");
void Branch = openborvariant("current_branch");
void T1 = findtarget(P1);
void T2 = findtarget(P2);
int THP1 = getentityproperty(T1, "health");
int THP2 = getentityproperty(T2, "health");
if(getentityvar(self,0)==NULL()){setentityvar(self,0, P1Health);}
if(getentityvar(self,0)==NULL()){setentityvar(self,0, P2Health);}
if(P1 != NULL() && Branch != "Strength_Training"){ // Display lifebar in all stages except strength training stage
drawbox((150-P1Health),6,P1Health,2,1800,rgbcolor(255,234,41),0);
drawbox((150-P1Health),8,P1Health,1,1800,rgbcolor(255,226,0),0);
drawbox((150-P1Health),9,P1Health,1,1800,rgbcolor(255,206,24),0);
drawbox((150-P1Health),10,P1Health,1,1800,rgbcolor(246,194,0),0);
drawbox((150-P1Health),11,P1Health,1,1800,rgbcolor(230,141,0),0);
drawbox((150-P1Health),12,P1Health,1,1800,rgbcolor(222,92,0),0);
drawstring(33, 55, 1, P1Name);
drawstring(66, 43, 1, P1Score);
changeentityproperty(P1, "iconposition", -56, 21);
drawbox((150-getentityvar(self,0)),6,getentityvar(self,0),7,1700,rgbcolor(181,26,0),0); // drawbox(x,y,width,height,z,color);
//drawbox(34, 21, 30, 30, 600, rgbcolor(0,64,0)); // Background color for player icon
}if(P2 != NULL() && Branch != "Strength_Training"){
drawbox(176,6,P2Health,2,1800,rgbcolor(255,234,41),0);
drawbox(176,8,P2Health,1,1800,rgbcolor(255,226,0),0);
drawbox(176,9,P2Health,1,1800,rgbcolor(255,206,24),0);
drawbox(176,10,P2Health,1,1800,rgbcolor(246,194,0),0);
drawbox(176,11,P2Health,1,1800,rgbcolor(230,141,0),0);
drawbox(176,12,P2Health,1,1800,rgbcolor(222,92,0),0);
drawbox(176,6,getentityvar(self,0),6,1700,rgbcolor(181,26,0),-1);
//changeentityproperty(P2, "iconposition", 262, 21);
drawstring(hres-27-strwidth(P2Name, 0), 55, 0, P2Name); // drawstring(x,y,font,text,z);
drawstring(175, 43, 0, P2Score);
//drawbox(262, 21, 30, 30, 600, rgbcolor(0,64,0)); // Background color for player icon
}
if(Branch == "Strength_Training"){
if(P1 != NULL()){
drawstring(33, 55, 1, P1Name);
drawstring(66, 43, 1, P1Score);
changeentityproperty(P1, "iconposition", -56, -41);
drawbox((150-P1Health),-106,P1Health,2,1800,rgbcolor(255,234,41),0);
drawbox((150-P1Health),-108,P1Health,1,1800,rgbcolor(255,226,0),0);
drawbox((150-P1Health),-109,P1Health,1,1800,rgbcolor(255,206,24),0);
drawbox((150-P1Health),-110,P1Health,1,1800,rgbcolor(246,194,0),0);
drawbox((150-P1Health),-111,P1Health,1,1800,rgbcolor(230,141,0),0);
drawbox((150-P1Health),-112,P1Health,1,1800,rgbcolor(222,92,0),0);
drawbox((150-getentityvar(self,0)),-106,getentityvar(self,0),7,1700,rgbcolor(181,26,0),0);
}
if(P2 != NULL()){
drawbox(176,-106,P2Health,2,1800,rgbcolor(255,234,41),0);
drawbox(176,-108,P2Health,1,1800,rgbcolor(255,226,0),0);
drawbox(176,-109,P2Health,1,1800,rgbcolor(255,206,24),0);
drawbox(176,-110,P2Health,1,1800,rgbcolor(246,194,0),0);
drawbox(176,-111,P2Health,1,1800,rgbcolor(230,141,0),0);
drawbox(176,-112,P2Health,1,1800,rgbcolor(222,92,0),0);
drawbox(176,-106,getentityvar(self,0),6,1700,rgbcolor(181,26,0),-1);
changeentityproperty(P2, "iconposition", 262, -41);
drawstring(hres-27-strwidth(P2Name, 0), 55, 0, P2Name); // drawstring(x,y,font,text,z);
drawstring(175, 43, 0, P2Score);
//drawbox(262, 21, 30, 30, 600, rgbcolor(0,64,0)); // Background color for player icon
}
}
if(P1Health<getentityvar(self,0)){
if(getentityvar(self,1)==NULL()){
setentityvar(self,1,0);
}
setentityvar(self,1,getentityvar(self,1)+1);
if(getentityvar(self,1) > 7){
setentityvar(self,0,getentityvar(self,0)-1);
setentityvar(self,1,0);
}
}
if(P2Health<getentityvar(self,0)){
if(getentityvar(self,1)==NULL()){
setentityvar(self,1,0);
}
setentityvar(self,1,getentityvar(self,1)+1);
if(getentityvar(self,1) > 7){
setentityvar(self,0,getentityvar(self,0)-1);
setentityvar(self,1,0);
}
}
}
(sigh) Rocket Viper has the diagonal lifebar, but I don't know how the author made that since it's very complex for me to read. However, for mine, I do use drawbox for the character's lifebar. Each color line for health has a unit. It's a total of 6 lines, but one-color line's height size (bright yellow) at the very top is 2 pixels. The rest below the yellow one are 1 pixel high. For the player 1's side, it's depleted from left to right, while the player 2's side is depleted from right to left. Take a look at the script below regarding the health bars.
View attachment 7262
View attachment 7261
C:void actual_main(){ // Player Main Hud health(); } void health() // Player health {//Update script with player lifebar //Calling main player void self = getlocalvar("self"); int P1 = getplayerproperty(0, "entity"); int P2 = getplayerproperty(1, "entity"); void P1Name = getentityproperty(P1, "name"); void P2Name = getentityproperty(P2, "name"); int P1HP = getentityproperty(P1, "health"); int P2HP = getentityproperty(P2, "health"); int P1MaxHP = getentityproperty(P1, "maxhealth"); int P2MaxHP = getentityproperty(P2, "maxhealth"); int P1Health = 114*P1HP/P1MaxHP; int P2Health = 114*P2HP/P2MaxHP; int P1Score = getplayerproperty(0, "score"); int P2Score = getplayerproperty(1, "score"); int hres = openborvariant("hresolution"); void Branch = openborvariant("current_branch"); void T1 = findtarget(P1); void T2 = findtarget(P2); int THP1 = getentityproperty(T1, "health"); int THP2 = getentityproperty(T2, "health"); if(getentityvar(self,0)==NULL()){setentityvar(self,0, P1Health);} if(getentityvar(self,0)==NULL()){setentityvar(self,0, P2Health);} if(P1 != NULL() && Branch != "Strength_Training"){ // Display lifebar in all stages except strength training stage drawbox((150-P1Health),6,P1Health,2,1800,rgbcolor(255,234,41),0); drawbox((150-P1Health),8,P1Health,1,1800,rgbcolor(255,226,0),0); drawbox((150-P1Health),9,P1Health,1,1800,rgbcolor(255,206,24),0); drawbox((150-P1Health),10,P1Health,1,1800,rgbcolor(246,194,0),0); drawbox((150-P1Health),11,P1Health,1,1800,rgbcolor(230,141,0),0); drawbox((150-P1Health),12,P1Health,1,1800,rgbcolor(222,92,0),0); drawstring(33, 55, 1, P1Name); drawstring(66, 43, 1, P1Score); changeentityproperty(P1, "iconposition", -56, 21); drawbox((150-getentityvar(self,0)),6,getentityvar(self,0),7,1700,rgbcolor(181,26,0),0); // drawbox(x,y,width,height,z,color); //drawbox(34, 21, 30, 30, 600, rgbcolor(0,64,0)); // Background color for player icon }if(P2 != NULL() && Branch != "Strength_Training"){ drawbox(176,6,P2Health,2,1800,rgbcolor(255,234,41),0); drawbox(176,8,P2Health,1,1800,rgbcolor(255,226,0),0); drawbox(176,9,P2Health,1,1800,rgbcolor(255,206,24),0); drawbox(176,10,P2Health,1,1800,rgbcolor(246,194,0),0); drawbox(176,11,P2Health,1,1800,rgbcolor(230,141,0),0); drawbox(176,12,P2Health,1,1800,rgbcolor(222,92,0),0); drawbox(176,6,getentityvar(self,0),6,1700,rgbcolor(181,26,0),-1); //changeentityproperty(P2, "iconposition", 262, 21); drawstring(hres-27-strwidth(P2Name, 0), 55, 0, P2Name); // drawstring(x,y,font,text,z); drawstring(175, 43, 0, P2Score); //drawbox(262, 21, 30, 30, 600, rgbcolor(0,64,0)); // Background color for player icon } if(Branch == "Strength_Training"){ if(P1 != NULL()){ drawstring(33, 55, 1, P1Name); drawstring(66, 43, 1, P1Score); changeentityproperty(P1, "iconposition", -56, -41); drawbox((150-P1Health),-106,P1Health,2,1800,rgbcolor(255,234,41),0); drawbox((150-P1Health),-108,P1Health,1,1800,rgbcolor(255,226,0),0); drawbox((150-P1Health),-109,P1Health,1,1800,rgbcolor(255,206,24),0); drawbox((150-P1Health),-110,P1Health,1,1800,rgbcolor(246,194,0),0); drawbox((150-P1Health),-111,P1Health,1,1800,rgbcolor(230,141,0),0); drawbox((150-P1Health),-112,P1Health,1,1800,rgbcolor(222,92,0),0); drawbox((150-getentityvar(self,0)),-106,getentityvar(self,0),7,1700,rgbcolor(181,26,0),0); } if(P2 != NULL()){ drawbox(176,-106,P2Health,2,1800,rgbcolor(255,234,41),0); drawbox(176,-108,P2Health,1,1800,rgbcolor(255,226,0),0); drawbox(176,-109,P2Health,1,1800,rgbcolor(255,206,24),0); drawbox(176,-110,P2Health,1,1800,rgbcolor(246,194,0),0); drawbox(176,-111,P2Health,1,1800,rgbcolor(230,141,0),0); drawbox(176,-112,P2Health,1,1800,rgbcolor(222,92,0),0); drawbox(176,-106,getentityvar(self,0),6,1700,rgbcolor(181,26,0),-1); changeentityproperty(P2, "iconposition", 262, -41); drawstring(hres-27-strwidth(P2Name, 0), 55, 0, P2Name); // drawstring(x,y,font,text,z); drawstring(175, 43, 0, P2Score); //drawbox(262, 21, 30, 30, 600, rgbcolor(0,64,0)); // Background color for player icon } } if(P1Health<getentityvar(self,0)){ if(getentityvar(self,1)==NULL()){ setentityvar(self,1,0); } setentityvar(self,1,getentityvar(self,1)+1); if(getentityvar(self,1) > 7){ setentityvar(self,0,getentityvar(self,0)-1); setentityvar(self,1,0); } } if(P2Health<getentityvar(self,0)){ if(getentityvar(self,1)==NULL()){ setentityvar(self,1,0); } setentityvar(self,1,getentityvar(self,1)+1); if(getentityvar(self,1) > 7){ setentityvar(self,0,getentityvar(self,0)-1); setentityvar(self,1,0); } } }
Look at X-Men VS Street Fighter or Marvel Super Heroes VS Street Fighter for the curved lifebar examples. Do you want those kinds?

drawdot(). Here's one example using a sine wave.
Sorry, I don't understand what you're asking for. Your meters already work, and Rocket Viper doesn't do anything special other than a an occasional gleam effect on the bars.
DC

View attachment 7271
Usually, when physical strength decreases, it decreases in a straight line.
I want it to tilt diagonally like Rocket Viper 2 so that its stamina decreases.
drawline(). This is a function that draws a single pixel width line from point to point. Then you stack several of them together to look like an HP bar. You can find an example in UTunnels Golden Axe Remake. It's how he was able to give the bars a vertical color gradient.

oh yeah, drawline makes more sense, since with drawbox we just have one witdh.Ahh, OK. There's a couple of ways to achieve this, but the simplest is usingdrawline().
drawlineoh yeah, drawline makes more sense, since with drawbox we just have one witdh.
(it woudl be cool to have someting like top and bottom width separated)
I am ignorant of the script part and have caused some inconvenience.I don't know what else to explain. I'm not going to reprint things verbatim that are in the manual.
I will consider doing a live coding session tomorrow where I build a demo to show how it works.
DC
not a prob.I am ignorant of the script part and have caused some inconvenience.![]()
//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
}