I have a question for comparisons

Posted By: paracharlie

I have a question for comparisons - 07/01/10 02:03

I have a comparison for my game.
How would I add +1 for every 5 levels.
For instance:
if(SIZ_CON >= 36 && SIZ_CON <= 40){HIT_POINTS = 50;}
Now for every 5 levels above that add +1. I'm wracking my brain here. Can someone help?
Posted By: Walori

Re: I have a question for comparisons - 07/01/10 06:13

couldn't really tell what you wanted to add for one, but in case hit points try something like this:

Code:
var last_count = 0;
var next_count = 5;

while(1)
{
   if(last_count >= next_count)
   {
      HIT_POINTS +=1;
      next_count +=5;
   }
   else
   {
      last_count +=1;
   }
wait(1)
}


Posted By: Lukas

Re: I have a question for comparisons - 07/01/10 10:05

HIT_POINTS = 50 + integer(levels_above_that/5);
Posted By: paracharlie

Re: I have a question for comparisons - 07/01/10 13:59

Ok, sorry guys I wasnt clear, looking back at it now. I had to walk away from my ocde for the day lol...
SIZ (size)
CON (constitution)
SIZ_CON = SIZ + CON;
Total of SIZ_CON determines hit points.
50 hitpoints is alot in this game. SO basically, for every 5 points of SIZ_CON over total of 40 SIZ_CON is only +1 hit point.

Thanks Walori, I'm looking at a counter.
Posted By: Widi

Re: I have a question for comparisons - 07/01/10 14:06

if (SIZ_CON > 40 && !fraction(SIZ_CON / 5)
{
HIT_POINTS ++;
}
Posted By: paracharlie

Re: I have a question for comparisons - 07/01/10 14:11

Thanks, going to try it.
© 2024 lite-C Forums