Everade Posted May 23, 2016 Group: Members Topic Count: 19 Topics Per Day: 0.00 Content Count: 192 Reputation: 43 Joined: 12/13/11 Last Seen: April 9, 2023 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 .@ 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 Link to comment Share on other sites More sharing options...
0 Stolao Posted May 24, 2016 Group: Developer Topic Count: 48 Topics Per Day: 0.01 Content Count: 1443 Reputation: 344 Joined: 10/17/12 Last Seen: Sunday at 01:58 PM 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 Emistry Posted May 25, 2016 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted May 25, 2016 if ( rand( 10000 ) < 100 ) { // below 1.00% } Quote Link to comment Share on other sites More sharing options...
0 REKT Posted June 1, 2016 Group: Members Topic Count: 24 Topics Per Day: 0.00 Content Count: 206 Reputation: 11 Joined: 12/06/11 Last Seen: September 13, 2024 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...
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% ?
Link to comment
Share on other sites
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.