Lord Ganja 5 Posted September 1, 2015 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. Thanks in advance! Quote Share this post Link to post Share on other sites
0 Garr 117 Posted September 1, 2015 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. Quote Share this post Link to post Share on other sites
0 Lord Ganja 5 Posted September 2, 2015 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? Quote Share this post Link to post Share on other sites
0 thor1009 9 Posted September 2, 2015 (edited) 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 September 2, 2015 by thor1009 Quote Share this post Link to post Share on other sites
0 Garr 117 Posted September 2, 2015 (edited) @@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 September 2, 2015 by Garr Quote Share this post Link to post Share on other sites
0 Lord Ganja 5 Posted September 2, 2015 @@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; Quote Share this post Link to post Share on other sites
0 Garr 117 Posted September 2, 2015 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. Quote Share this post Link to post Share on other sites
0 Lord Ganja 5 Posted September 2, 2015 Got it! thanks again @@Garr Quote Share this post Link to post Share on other sites
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.
Thanks in advance!
Share this post
Link to post
Share on other sites