Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "zcommon.acs"
- //Apothem's Monster HP Bar - V1.1
- int monhp;
- int mtid = 1; //Replace the number here with your monster TID
- int mmaxhp; //This is the variable used for the current monster's MAX hp.
- function void ResetBar(int targettid)
- {
- mtid = 1; //set the current monster TID to the specified TID
- monhp = GetActorProperty (MTID, APROP_Health);
- mmaxhp = monhp;
- acs_executealways(1,0,0,0,0); //normally calling scripts from inside functions
- } //has caused more problems than it has ever solved for me, but in this case it works.
- Script 1 (void)
- {
- int hdisp;
- int oldmonhp;
- int acounter;
- int bcounter;
- while (monhp > 0)
- {
- SetFont ("NORMAL");
- monhp = GetActorProperty (MTID, APROP_Health);
- hdisp = (monhp * 100 / mmaxhp);
- if (hdisp <= 0)
- hdisp = 0;
- SetHudSize (800,600,0);
- HudMessage (i:hdisp; 1, 0, CR_WHITE, 120.1, 10.1, 1);
- SetFont ("MONHPBAR");
- HudMessage (s:"a"; 1, 101, CR_GREEN, 0.1, 1.1, 1);
- for (acounter = 0; acounter <= hdisp; acounter++) //This loop can be optimized with different
- { //graphics to make it to where you dont need to show as many bar fillers
- if (hdisp <= 0) //to display the whole bar.
- break;
- bcounter = bcounter + 2.0;
- SetFont ("FILLNORM");
- if (hdisp < 75)
- SetFont ("FILLCAUT");
- if (hdisp < 50)
- SetFont ("FILLDANG");
- if (hdisp < 25)
- SetFont ("FILLCRIT");
- HudMessage (s:"a"; 1, acounter, CR_GREEN, 23.1 + bcounter, 7.1, 1);
- }
- while(monhp == oldmonhp)
- {
- monhp = GetActorProperty (MTID, APROP_Health);
- delay(15);
- }
- oldmonhp = monhp;
- bcounter = 0;
- acounter = 0;
- delay(20);
- }
- HudMessage (s:" "; 1, 101, CR_GREEN, 0.1, 1.1, 1);
- HudMessage (s:" "; 1, 0, CR_WHITE, 120.1, 10.1, 1);
- }
- Script 5 OPEN
- {
- mmaxhp = getactorproperty(MTID, APROP_Health);
- }
- script 999 OPEN
- {
- Sector_SetColor(1, 0, 0, 255);
- Sector_SetFade(1, 0, 0 , 255);
- }
Add Comment
Please, Sign In to add comment