MP bar color and transparency

Toranks

Active member
I want a 100% transparent background on MP bar, but I can't prevent it from changing color, or creating an alpha mask that I don't know where it comes from.

This is level.txt set:
#-------Lifebars, icons, names, etc.

lbarsize 100 5 1 1 0 -999 -999 -999 -999
mpbarsize 90 5 1 1 0 -999 -999 -999 -999
timeloc 150 50 31 21 0

p1life 38 8
p1mp 48 15
p1namej -50 -50 -10 -10 20 20
p1icon 0 3
p1lifen 10 30
p1lifex -50 -50
p1score -50 -50 -10 -10 48 40
e1life 22 260
e1icon 5 250
e1name -150 -250

This is lifebar.txt content:
color25 255 0 0
color50 255 70 0
color100 255 100 0
color200 255 180 0
color300 100 255 0
color400 100 255 0
color500 100 255 0

colormagic 75 75 255

Whit this colormagic set, MP bar changes color two times when refilling

But with this set:

colormagic 75 75 255
colormagic2 75 75 255

MP bar creates an alpha mask with colormagic2 color behind the main bar, making it difficult to see.

What I am doing wrong?

Video showing both cases:

 
Last edited:
I try creating a black background on the mana bar icon, and neither, the mana bar is not visible, it is hidden
I can't understand how there is no transparency in the life bar but there is in the mana bar, and how to avoid it

icon.gif1637225613524.gif
 
I dunno if this was already fixed, but the MP bar color has a bug - sometimes, when the bar is half full, it takes the color of the full bar, then takes another color to rever to the full bar color later.

This is the reason I removed the color change of the MP bar on my game.

MP bar creates an alpha mask with colormagic2 color behind the main bar, making it difficult to see.

That is tied to another thing I can't remember now - I think its something on the lifebar setting.
If I am not wrong, its the same thing which controls the background color of selected items on the menu screen for example.
 
dunno if this was already fixed, but the MP bar color has a bug - sometimes, when the bar is half full, it takes the color of the full bar, then takes another color to rever to the full bar color later
I don't recall this. Maybe I never noticed because I just script my own HUD. Mind making a detailed bug report with an example?

It may be an easy fix.
 
I have resolved my question because it is an Openbpor bug, although now I would like to ask for a solution. How is your custom HUD like, @DCurrent ? I would like to emulate only the MP bar, since everything else works perfectly as is
 
I don't recall this. Maybe I never noticed because I just script my own HUD. Mind making a detailed bug report with an example?

It may be an easy fix.
Did you still have my old Avengers game? See it in action - it uses a common HUD.
My bug is exaclty what happens in @Toranks video.

If I am not wrong, those were my settings:
colormagic 11 62 126
colormagic2 16 157 218
 
@Toranks

I can't remember now, but if I'm not wrong this is why I replaced the mp bar with energy stars in SORX. But I will take a look at previous versions to see how I managed it.
Anyway, I will take a look in the source code to see if I can fix it. But please, I need to confirm, do you want to make life/mp bars transparent, or you want to disable transparency?

Currently I have a small script to draw a life bar on the screen used for partners. With some modifications, you can use it for players too.

I'm using it on the ondraw event because this way I can reduce CPU usage by enabling it only on the entity's ondraw event. But for players I suggest using the updated.c event, once it needs to work at full time.

You can change the drawbox colors to create a background for the bars, change layers, sizes, apply custom transparency values by changing channels, etc.

C:
void drawLife()
{//Draw life bar in the screen, entity binded like RPG games
    if(openborvariant("in_level")){ //IN ANY LEVEL??
        void self   = getlocalvar("self");
        int xLife1;
        int xLife2;
        int yLife1;
        int yLife2;
        int maxLife     = getentityproperty(self, "maxhealth");
        int life        = getentityproperty(self, "health");
        int x           = getentityproperty(self, "x");
        int y           = getentityproperty(self, "y");
        int z           = getentityproperty(self, "z");
        float xPos      = openborvariant("xpos");
        float yPos      = openborvariant("ypos");
        float xSize     = 30; //BAR WIDTH INCREASE FACTOR, MORE VALUE IS MORE SIZE
        float ySize     = 2; //BAR HEIGHT INCREASE FACTOR, MORE VALUE IS MORE SIZE
        float xDif      = 0; //BAR POSITION IN X AXIS, USE THIS TO MOVE ALL BARS TOGETHER
        float yDif      = 4; //BAR POSITION IN Y AXIS, USE THIS TO MOVE ALL BARS TOGETHER
        float screen    = openborvariant("gfx_y_offset");
        
        //ENTITY IS ALIVE??
        if(life > 0){ 
            life        = (life*xSize)/(maxLife); //CALCULATE REMAINING LIFE BAR SIZE
            maxLife     = (maxLife*xSize)/(maxLife); //CALCULATE MAX LIFE BAR SIZE
            x           = x-xPos-(maxLife/2)+xDif; //CALCULATE X POSITION TO BIND BAR IN THE ENTITY, OFFSET IS ALWAYS THE CENTER
            y           = z-yPos+screen-y+yDif; //CALCULATE Y POSITION TO BIND BAR IN THE ENTITY
            drawbox(x, y, life, ySize, z+3, rgbcolor(0xFF,0xFF,0x00), 0); //YELLOW BAR, LIFE REMAINING
            drawbox(x, y, maxLife, ySize, z+1, rgbcolor(0xFF,0x00,0x00), 0); //RED BAR, LIFE LOST
            drawbox(x, y-1, maxLife, ySize*2, z, rgbcolor(0xFF,0xFF,0xFF), 0); //WHITE BORDER (UP/DOWN)
            drawbox(x-1, y, maxLife+2, ySize, z, rgbcolor(0xFF,0xFF,0xFF), 0); //WHITE BORDER (LEFT/RIGHT)
        }
    }
}
 
@Toranks

I can't remember now, but if I'm not wrong this is why I replaced the mp bar with energy stars in SORX. But I will take a look at previous versions to see how I managed it.
Anyway, I will take a look in the source code to see if I can fix it. But please, I need to confirm, do you want to make life/mp bars transparent, or you want to disable transparency?
The current behavior* about transparencies seems fine to me, as long as it does not change color several times as it happens to Ilusionista and me

*
colormap2 black = no transparency
colormap2 white = 100% transparency
 
Hello everyone, I have run into the same problem as @Toranks. Perhaps the best solution is to use Custom HUD, but for beginners looking for something simpler it would be nice to be able to control the color of the transparency that goes below the MP bar. Currently it works automatically and sets a transparency color that generates very little contrast between the full bar and the empty bar.

Thanks =)
 
Back
Top Bottom