Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
The Doomlad

Boss health bar with 2 bosses

Recommended Posts

I found this script to make a health meter for an enemy a while ago and I've used it in my wad. The problem is I want to use it again in a fight with 2 cyberdemons but don't know how to. I tried making two seperate scripts with health bars that are seperate from each other. One glitched out and didn't display right. I want to make a value that combines both things health but I don't have enough scripting knowledge to do so. Here is the script I'm using. 

 

int mtid = 121;

 

Script 10 (void) 
{     
    

    int hdisp;
    int monhp = GetActorProperty (mtid, APROP_HEALTH);
    int mmaxhp = GetActorProperty (mtid, APROP_SPAWNHEALTH);
    SetFont ("NORMAL");
    hdisp = (monhp * 100 / mmaxhp);
    if (hdisp <= 0)
        hdisp = 0;

    SetHudSize (255,500, FALSE);

    int acounter;
    int bcounter;
    SetFont ("MONHPBAR");
    HudMessage (s:"a"; HUDMSG_FADEOUT, 102, CR_GREEN, 0.5, 1.1, 0.1, 1.0);

    for (acounter = 0; acounter <= hdisp; acounter++)
    {
        if (hdisp <= 0)
            break;

        bcounter = bcounter + 2.0;
        SetFont ("FILLNORM"); //By default, the bar shows as a blue bar.

        if (hdisp < 75) //If the hp is at a caution level (75%) Display a yellow bar.
            SetFont ("FILLCAUT");

        if (hdisp < 50) //If the hp is at a danger level (50%) Display an orange bar.
            SetFont ("FILLDANG");

        if (hdisp < 25) // If the hp is at a critical level (25%) Display a red bar.
            SetFont ("FILLCRIT");

        HudMessage (s:"a"; HUDMSG_FADEOUT, acounter, CR_GREEN, 23.1 + bcounter, 7.1, 0.1, 1.0);
    }
    bcounter = 0;
    acounter = 0;
    Delay (1);
    Restart;
}

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×