#Help with probabilities

1 messages · Page 1 of 1 (latest)

zealous reef
#

Hi I'm trying to make a good probability system but I realize that my code sucks and it doesn't do what I want. Knowing that I just want that when a player breaks a block it has a chance of dropping him a certain item but the problem is that with the code I wrote there is a chance that it will give several items to the person so that I want the person to have only one item.
so if anyone can help me on this please

on break of stone:
    chance of 50%:
        give 1 iron nugget to the player
    chance of 5%:
        give 1 slimeball to the player
    chance of 2%:
        give 1 lapis lazuli to the player
    chance of 1%:
        give 1 honeycomb to the player
woven kernel
#

Use rolling numbers

 set {randomInteger::%player%} to random integer between 0 and 10
                send {randominteger::%player%} to player # if you want to check if it is working properly

if {randominteger::%player%} is between 0 and 3:
                    drop X
zealous reef
#

Hmm ok i see

#

Thank you

woven kernel
#

I had same problem : )
good luck!

zealous reef
#

Thank you :)

ashen kraken
#

after the chance of%

#

like

    chance of 50%:
        give 1 iron nugget to the player
        stop
    chance of 5%:
        give 1 slimeball to the player 
        stop
    chance of 2%:
        give 1 lapis lazuli to the player
        stop
    chance of 1%:
        give 1 honeycomb to the player```
zealous reef
#

Ok thanks too

tepid temple
ashen kraken
#

He said he wanted them to only get 1 drop.

tepid temple
#

yea it makes items below the chance harder to get

ashen kraken
#
It goes chance of 50%
Then it checks for the chance of 5%
then it checks for the chance of 2%
then chance of 1%
#

Which is how he wanted it

#

Derq

tepid temple
ashen kraken
#

That's now how the probability works lol

tepid temple