set {_s} to line 2 of players's cursor slot's lore
replace all "%% success" with "" in {_s}
replace all "&2" with "" in {_s}
if the player's cursor slot's lore contains "&7Swiftness I":
if lore of event-item contains "Empty...":
if event-item's lore doesn't contain "&7Swiftness I":
broadcast {_s}
chance of {_s}:
set {_target} to event-item
cancel event
replace "Empty..." in {_target}'s lore with "&7Swiftness I"
wait 2 ticks
set cursor slot of player to air
set event-slot to {_target}
else:
cancel event
set player's cursor slot to air
else:
cancel event
send "&7You already have that enchantment!"```
the broadcast sends back the correct value, but the enchant never succeeds
#chance value not working
1 messages · Page 1 of 1 (latest)
don't think you can do "chance of (string):"
hm that is very likely
how do i get around this
grr
doesnt work
s is a number
then set {_rand} to random integer between 1 and 100
if rand <= 5, proc
or ig ==
idk too eepy
permission: custom.admin
trigger:
set {_r} to a random integer between 1 and 100
set line 2 of {CustomItem::SpeedBookI}'s lore to "&2%{_r}%%% success rate"
give player {CustomItem::SpeedBookI}
on inventory click:
set {_s} to line 2 of player's cursor slot's lore
replace all "%% success" with "" in {_s}
replace all "&2" with "" in {_s}
if the player's cursor slot's lore contains "&7Swiftness I":
if lore of event-item contains "Empty...":
if event-item's lore doesn't contain "&7Swiftness I":
broadcast {_s}
chance of ({_s} parsed as number):
set {_target} to event-item
cancel event
replace "Empty..." in {_target}'s lore with "&7Swiftness I"
wait 2 ticks
set cursor slot of player to air
set event-slot to {_target}
else:
cancel event
set player's cursor slot to air
else:
cancel event
send "&7You already have that enchantment!"```
a random number becomes the lore of the book
then that lore becomes S
when i broadcast s i get the right number
the chance just doesnt work
what does it do when you set the chance to 100%
also add a broadcast in each part of the chance
still fails
both when it replaces empty and when it cancels event and sets cursor slot to air
it always fails
unfortunate
best guess then