Everade Posted May 23, 2016 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 .@ temporary variables are not able to store decimals?! So for example: if( .@legend >= 1 ) { .@chance = 0.18; }else{.@chance = 0.1} if ( rand(100) < .@chance ) { getitem 512,1; } Or would it also workout if i simply set rand(1000) < .@chancewhile chance is set to 1 for instance.I guess that would be 0.1% ? Edited May 23, 2016 by Everade Quote
0 Emistry Posted May 25, 2016 Posted May 25, 2016 if ( rand( 10000 ) < 100 ) { // below 1.00% } Quote
0 Stolao Posted May 24, 2016 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
0 REKT Posted June 1, 2016 Posted June 1, 2016 (edited) if ( rand( 10000 ) < 100 ) { // below 1.00% } Thanks though. Edited June 2, 2016 by Keysito Quote
Question
Everade
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 .@ 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% ?
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.