#Chance of xp drop from stone

1 messages · Page 1 of 1 (latest)

tall rune
#

Hello coders and gamers!
I want to create boosts form my "prison" gamemode.
The problem is that if boost is active, the percentage just doesn't work. it's always 100%

    if event-world is "kopania":
        if block is stone:
            chance of {chance::%player's uuid%}:
                add 1 xp to the player
        if block is oak log:
            chance of {chance2::%player's uuid%}:
                add 1 xp to the player

...

set {chance::%player's uuid%} to 10
...
set {chance2::%player's uuid%} to 10```
If someone need more code, just say.
fathom arrow
#

you forgot the %

#

chance of %number%(\%|)

#
chance of 50%:
    drop a diamond
chance of {chance}% # {chance} between 0 and 100
chance of {chance} # {chance} between 0 and 1
tall rune
#

so if I will replace "chance" with 20%, will be ok?

    if event-world is "kopania":
        if block is stone:
            chance of {10%::%player's uuid%}:
                add 1 xp to the player
        if block is oak log:
            chance of {20%::%player's uuid%}:
                add 1 xp to the player

set {10%::%player's uuid%} to 10
...
set {20%::%player's uuid%} to 10

#

Player can choose values between 10 / 100 via item gui.
So I need to move chance value from trigger to on break event

fathom arrow
#

no..

tall rune
#

chance of {chance::%player's uuid%}%:

#

?

fathom arrow
#
on break:
    if event-world is "kopania":
        if block is stone:
            chance of {chance::%player's uuid%}%:
                add 1 xp to the player
        if block is oak log:
            chance of {chance2::%player's uuid%}%:
                add 1 xp to the player