HP Bar script -
Spoiler:EDIT: I just realized I didn't document the code enough. But it's documented enough to get a general idea for what i did.Code: Select all
/*This script is a healthbar script for bosses and minibosses To use this script replace mtid with the TID of the monster you want the bar to monitor and replace the value of mmaxhp with the max health of the monster you're monitoring. !! Make sure to replace ENTER with (void) if you dont want the script to activate with the player entering the level. !! The lumps fillcrit, filldang, fillnorm, and fillcaut are all the filler pics for the bar. Please put these inside the wad outside of any tags. The bar itself, HPMONBAR, is the actual bar pic. also place that inside the wad, but outside of any tags. */ #include "zcommon.acs" 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 4 ENTER //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; }
EDIT2: HOLY SHIT THAT'S A MESSY MAP! *Fixes script and map so it's half-way descent*