Jump to content
  • 0
Sign in to follow this  
Lord Ganja

The higher the points, the higher the chance

Question

How can I create a script the works like 'The higher the points, the higher the chance'

 

Let's say if you have higher '#CASHPOINTS' you will have a higher chance to get an item when you click an npc.

 

I'm confused on how will I put it using using 'rand' or whatever. :hmm:  :swt3:

 

Thanks in advance!

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

At max points yes. And it'll be a flat growth per point, so every point will get you extra 1/20 (0.05%) chance to win. So, let's say, at 300 points you'll have (300*1/20) = 15% chance to win, or at 465 point you'll have (465*1/20) = 23.25% chance to win.

Share this post


Link to post
Share on other sites
  • 0

I'd do

if( rand(x) < #CASHPOINTS) { // Yay! Winrar!!}

Where x is some amount you want #CASHPOINTS to have 100% chance at.

Here it takes random amount from 0 to (x-1), and closer $CASHPOINTS to x is higher is the chance scripts succeeds.

Share this post


Link to post
Share on other sites
  • 0

I'd do

if( rand(x) < #CASHPOINTS) { // Yay! Winrar!!}

Where x is some amount you want #CASHPOINTS to have 100% chance at.

Here it takes random amount from 0 to (x-1), and closer $CASHPOINTS to x is higher is the chance scripts succeeds.

Thanks @@Garr. Anyway can you give me and idea on what should I put on X? lol I'm really confused.

Or is there any other workaround with this?

Share this post


Link to post
Share on other sites
  • 0

My suggestion would be to use a more complicated formula, such as rand((1 - exp(-#CASHPOINTS))*50, 100) > 49

So with 0 points the probability to win is 50%. It will increase as the player gets more points, but only approach to 100%.

 

So it will be better to make a script command to do the calculation in float, use a number (POINTS) as input and return success or fail.

Edited by thor1009

Share this post


Link to post
Share on other sites
  • 0

@@thor1009

Hmm, idea is good, but after few points it'll always will be close to 100% chance, as e^(-5) is already damn close to 0. Hell, even at e^(-3) it's damn close to 50, making the chance real close to 100%.

 

@@Lord Ganja

Hmm, I don't know, it depends on how people earn the points, in what amount, what's the current max on server, are you limiting the points and so on. If you're limiting them I'd say make it ~125% of max, that way you'll have a nice 80% win chance at max amount.

Edited by Garr

Share this post


Link to post
Share on other sites
  • 0

@@thor1009

Hmm, idea is good, but after few points it'll always will be close to 100% chance, as e^(-5) is already damn close to 0. Hell, even at e^(-3) it's damn close to 50, making the chance real close to 100%.

 

@@Lord Ganja

Hmm, I don't know, it depends on how people earn the points, in what amount, what's the current max on server, are you limiting the points and so on. If you're limiting them I'd say make it ~125% of max, that way you'll have a nice 80% win chance at max amount.

i'll be limiting the points to 1500 points.. all points above 1500 will be converted to 1500.

 

 

So let's say i have max amount of #CASHPOINTS which is 1500.. if I set the rand to 2000, i'll have 75% chance to get the item right?

if( rand(2000) < #CASHPOINTS )     getitem 607,1;

Share this post


Link to post
Share on other sites

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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.