Jump to content
  • 0

Calculating chances below 1%


Question

Posted (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) < .@chance

while chance is set to 1 for instance.

I guess that would be 0.1% ?
Edited by Everade

3 answers to this question

Recommended Posts

  • 0
Posted

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+"

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...