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

Divided by zero in script 603

Recommended Posts

I made a basic health bar for the player that worked fine when the script was run in a map's script. But when I put it inside a library of the wad that i tested the script in i got an error "Divided by zero in script 603" (everything else in the library works)

here is the script

script 603 enter
{
int monhp;
int mtid = 1000;
int hdisp;

monhp = getactorproperty(MTID, APROP_Health);
setfont("NORMAL");
hdisp = (monhp * 100 / health);
sethudsize(640,480,0);
if (hdisp <= 0)
hdisp = 0;
int acounter;
int bcounter;
setfont ("MONHPBAR");
hudmessagebold(s:"a"; 1, 101, CR_GREEN, 170.0, 25.0, 1);

for (acounter = 0; acounter <= hdisp; acounter++)
{
if (hdisp <= 0)
break;
setfont ("FILLCRIT");
bcounter = bcounter + 2.0;
hudmessagebold(s:"a"; 1, acounter, CR_GREEN, 73.0 + bcounter, 25.0, 1);
}
bcounter = 0;
acounter = 0;
delay(1);
restart;
}


Never mind fixed the error with if(health != 0) but i'm still confused why i only got the error from my library

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
×