Everade Posted May 23, 2016 Share Posted May 23, 2016 (edited) I'm looking for a way to calculate chances below 1% which i'm able to vary upon an if check. If i'm not mistaken then [email protected] temporary variables are not able to store decimals?! So for example: if( [email protected] >= 1 ) { .[email protected] = 0.18; }else{[email protected] = 0.1} if ( rand(100) < [email protected] ) { getitem 512,1; } Or would it also workout if i simply set rand(1000) < [email protected]while chance is set to 1 for instance.I guess that would be 0.1% ? Edited May 23, 2016 by Everade Quote Link to comment Share on other sites More sharing options...
0 Emistry Posted May 25, 2016 Share Posted May 25, 2016 if ( rand( 10000 ) < 100 ) { // below 1.00% } Quote Link to comment Share on other sites More sharing options...
0 Stolao Posted May 24, 2016 Share Posted May 24, 2016 Only whole numbers can be stored so use 10000 for 100% so for example you have chance of 5.67% which will be a value 567 if you want to show values in a mes you convert to % by doing "+567/100+"."+567%100+" Quote Link to comment Share on other sites More sharing options...
0 Keysito Posted June 1, 2016 Share Posted June 1, 2016 (edited) if ( rand( 10000 ) < 100 ) { // below 1.00% } Thanks though. Edited June 2, 2016 by Keysito Quote Link to comment Share on other sites More sharing options...
I'm looking for a way to calculate chances below 1% which i'm able to vary upon an if check.
If i'm not mistaken then [email protected] temporary variables are not able to store decimals?!
So for example:
while chance is set to 1 for instance.
I guess that would be 0.1% ?
Link to comment
Share on other sites