Guest User

Untitled

a guest
Jun 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. #include "zcommon.acs"
  2. //Apothem's Monster HP Bar - V1.1
  3. int monhp;
  4. int mtid = 1; //Replace the number here with your monster TID
  5. int mmaxhp; //This is the variable used for the current monster's MAX hp.
  6.  
  7. function void ResetBar(int targettid)
  8. {
  9. mtid = 1; //set the current monster TID to the specified TID
  10. monhp = GetActorProperty (MTID, APROP_Health);
  11. mmaxhp = monhp;
  12. acs_executealways(1,0,0,0,0); //normally calling scripts from inside functions
  13. } //has caused more problems than it has ever solved for me, but in this case it works.
  14.  
  15. Script 1 (void)
  16. {
  17. int hdisp;
  18. int oldmonhp;
  19. int acounter;
  20. int bcounter;
  21. while (monhp > 0)
  22. {
  23. SetFont ("NORMAL");
  24. monhp = GetActorProperty (MTID, APROP_Health);
  25.  
  26. hdisp = (monhp * 100 / mmaxhp);
  27. if (hdisp <= 0)
  28. hdisp = 0;
  29.  
  30. SetHudSize (800,600,0);
  31. HudMessage (i:hdisp; 1, 0, CR_WHITE, 120.1, 10.1, 1);
  32.  
  33.  
  34. SetFont ("MONHPBAR");
  35. HudMessage (s:"a"; 1, 101, CR_GREEN, 0.1, 1.1, 1);
  36.  
  37. for (acounter = 0; acounter <= hdisp; acounter++) //This loop can be optimized with different
  38. { //graphics to make it to where you dont need to show as many bar fillers
  39. if (hdisp <= 0) //to display the whole bar.
  40. break;
  41.  
  42. bcounter = bcounter + 2.0;
  43. SetFont ("FILLNORM");
  44.  
  45. if (hdisp < 75)
  46. SetFont ("FILLCAUT");
  47.  
  48. if (hdisp < 50)
  49. SetFont ("FILLDANG");
  50.  
  51. if (hdisp < 25)
  52. SetFont ("FILLCRIT");
  53.  
  54. HudMessage (s:"a"; 1, acounter, CR_GREEN, 23.1 + bcounter, 7.1, 1);
  55.  
  56. }
  57.  
  58. while(monhp == oldmonhp)
  59. {
  60. monhp = GetActorProperty (MTID, APROP_Health);
  61. delay(15);
  62. }
  63. oldmonhp = monhp;
  64. bcounter = 0;
  65. acounter = 0;
  66. delay(20);
  67. }
  68. HudMessage (s:" "; 1, 101, CR_GREEN, 0.1, 1.1, 1);
  69. HudMessage (s:" "; 1, 0, CR_WHITE, 120.1, 10.1, 1);
  70. }
  71.  
  72. Script 5 OPEN
  73. {
  74. mmaxhp = getactorproperty(MTID, APROP_Health);
  75.  
  76. }
  77.  
  78.  
  79. script 999 OPEN
  80. {
  81. Sector_SetColor(1, 0, 0, 255);
  82. Sector_SetFade(1, 0, 0 , 255);
  83. }
Add Comment
Please, Sign In to add comment