Boss health bar.

Advanced OpenGL source port fork from ZDoom, picking up where ZDoomGL left off.
[Home] [Download] [Git builds (Win)] [Git builds (Mac)] [Wiki] [Repo] [Bugs&Suggestions]

Moderator: Graf Zahl

Locked
ExtremeMachine
Posts: 58
Joined: Sun Aug 26, 2007 18:16

Boss health bar.

Post by ExtremeMachine »

Okey, here is a code for a boss health bar i found at zdoom wiki. The problem is when the boss is dead i can't get the bar go away, and i have no idea how to do it, searched on zdoom wiki but dont find the script for it.

If anyone know i would appreciate it alot if u tell me.

Code: Select all

int monhp;
int mtid = 666; //Replace the number here with your monster TID
int mmaxhp = 4000; //Replace number here with your monster's Max HP


Script 12 (VOID) //Replace ENTER with (void) if you want to activate the script
{              //with a line instead of on level entry.
int hdisp;
monhp = getactorproperty(MTID, APROP_Health);
setfont("NORMAL");
hdisp = (monhp * 100 / mmaxhp);
sethudsize(800,600,0);
if (hdisp <= 0)
hdisp = 0;
hudmessage(i:hdisp; 1, 0, CR_WHITE, 120.1, 10.1, 1);
int acounter;
int bcounter;
setfont ("MONHPBAR");
hudmessagebold(s:"a"; 1, 101, CR_GREEN, 0.1, 1.1, 1);
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");
hudmessagebold(s:"a"; 1, acounter, CR_GREEN, 23.1 + bcounter, 7.1, 1);
}
bcounter = 0;
acounter = 0;
delay(1);
restart;
}
User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Post by Enjay »

Once the boss is dead, put a blank hudmessage on screen with the same ID as the one that was drawing the bar.
Locked

Return to “GZDoom”