Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Apothem

Not-Your-Average Stat bar that i need help with

Recommended Posts

I'm working on a actual bar for representing health and whatnot on a hudmessage with 2 gfx, one is an empty bar that is 102 pixels wide, and the other is a 1 pixel wide to fill the bar. The script i'm using to fill the bar isnt behaving correctly, and i know for a fact this could work if i just knew what was wrong with my for loop.... Any ideas?

for (acounter = 1; acounter < shieldhp[1]; acounter++) 
{ 
bcounter = acounter / 1000; //assume shieldhp[1] == 100 
setfont ("SHIELDFI"); 
hudmessage(s:"a"; 1, 0, CR_GREEN, bcounter, 0,3); 
} 
delay(2); 
Restart;

Share this post


Link to post

hudmessage requires "fixed" numbers, not "int". Try something like

bcounter = acounter / 1000.0;
acounter might be a fixed too, I'm not sure.

Also, hudmessage uses coordinates from -1.0 to 1.0, so you probably want to use sethudsize too, if you don't already.

[edit]
a small mistake fixed.

Share this post


Link to post

Okay got the fixed point numbers situation fixed, and the sethudsize is really helpful because i've just encountered this issue with the gfx bar and thought there was no hope for it... Guess there is! **
Thanks Boris.

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
Sign in to follow this  
×