Reply to Re: mathmod
If you don't have an account, just leave the password field blank.
No.
First, you don't need those 'int' keywords, so...
if (&life == 0)
return;
&life = math_mod(&lifemax, 2);
math_mod returns the remainder of a division operation. If &lifemax is 8, 8 divided by 2 is 4 with no remainder, so it would return 0. If &lifemax was 27, 27 divided by 2 is 13 with a remainder of 1, so it would return 1. In fact, this use of math_mod will only return 0 or 1, which isn't what you're looking for.
You'd probably want to do something like this:
if (&life == 0)
return;
int &halflifemax = &lifemax;
&lifemax / 2;
&life += &halflifemax;
if (&life > &lifemax)
{
&life = &lifemax;
}
First, you don't need those 'int' keywords, so...
if (&life == 0)
return;
&life = math_mod(&lifemax, 2);
math_mod returns the remainder of a division operation. If &lifemax is 8, 8 divided by 2 is 4 with no remainder, so it would return 0. If &lifemax was 27, 27 divided by 2 is 13 with a remainder of 1, so it would return 1. In fact, this use of math_mod will only return 0 or 1, which isn't what you're looking for.
You'd probably want to do something like this:
if (&life == 0)
return;
int &halflifemax = &lifemax;
&lifemax / 2;
&life += &halflifemax;
if (&life > &lifemax)
{
&life = &lifemax;
}