| 02-06-2003, 03:40 AM | #1 |
In my DW3 map i have it so that the leaderboard shows players stats along with other things..i have it so it converts a units life into a percent out of 100...it works fine until the units life becomes a number that has an infinate decimal... how i did this was: set LIFE=LIFE --convert real to interger--of X unit set LIFE=LIFE / --convert real to interger--Max Hp of X unit set LIFE=LIFE * 100 show LIFE for player (1) on leaderboard.. example of crash: my unit has a max Hp of 100. he is hit unitil his hp is 33. that 33 converted into percent is 33.333333333333333333 continued... the game freezes up... what do i do to limit this? also, what am i doing wrong? if i am? |
| 02-06-2003, 04:47 AM | #2 |
anybody know a way to truncate a value and remove the floating point and just take the whole number..... i know how to do it in c++ but what about jass.... |
| 02-06-2003, 11:52 AM | #3 |
To round a real number in Jass2, it would look something like this: set number = I2R(R2I(number)) or if you just want an integer anyway, you could settle with: set integer_variable = R2I(number) If you prefer to do it GUI-wise, it'd look something like this: Set number = Convert Integer to Real ( Convert Real to Integer ( number ) ) I hope this helps. |
| 02-06-2003, 02:57 PM | #4 |
k, i tried that...it seems to multiply the base number by like 4000??? whats going on?? |
| 03-06-2003, 12:57 AM | #5 |
Uhhh take the ABS() and u get nothing after the decimal point! |
