Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.
If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!
Now, what are you waiting for? Join the community now!
You can always check out skUnity Downloads for downloads and any other information about Skript!
local function itemreset():
delete {items::*}
set {_names::*} to "ENDER", "HASTE", "HOVER", "INVISBILITY", "SPEED", "STRENGTH", "FIREBALL", "BOOMERANG", "SATURATION", "GLOW", "GOD APPLE", "WOLF", "SPECTATOR" and "JUGGERNAUT"
loop size of {_names::*} times:
{_names::%loop-number%} is not "GOD APPLE":
set {_d} to nbt compound from "{%{_names::%loop-number%}%:1b}"
else:
set {_d} to nbt compound from "{GAPPLE:1b}"
add command block named "&6%{_names::%loop-number%}% &6GEM" with nbt {_d} with lore "&6hold in offhand to get effect" to {items::*}
local function randogem(p: player):
if any:
{items::*} is not set
size of {items::*} is 0
then:
kick {_p} due to "No available gems"
else:
set {_i} to random item out of {items::*}
remove {_i} from {items::*}
give {_p} 1 of {_i}
local function reroll(p: player):
{reroll::%{_p}'s uuid%} < 3:
randogem({_p})
add {_p}'s held item to {items::*}
remove {_p}'s held item from {_p}
add 1 to {reroll::%{_p}'s uuid%}
else:
send "&cYou've already rerolled 3 times!" to {_p}
command gems_reset:
permission: gems.reset
trigger:
itemreset()
command reroll:
permission: gems.reroll
trigger:
name of player's tool contains " &6GEM":
reroll(player)
else:
send "&cYou can't reroll if you aren't holding your gem!"
command gems_random:
permission: gems.random
trigger:
randogem(player)
hey for some reason when i do gems_random it kicks me because it says theres no gems leftSlightly longer, heres the code, should work (had to specify the nbt for gapple because its the only one I could find that didn't match the name of the item)
AppleScript:local function itemreset(): delete {items::*} set {_names::*} to "ENDER", "HASTE", "HOVER", "INVISBILITY", "SPEED", "STRENGTH", "FIREBALL", "BOOMERANG", "SATURATION", "GLOW", "GOD APPLE", "WOLF", "SPECTATOR" and "JUGGERNAUT" loop size of {_names::*} times: {_names::%loop-number%} is not "GOD APPLE": set {_d} to nbt compound from "{%{_names::%loop-number%}%:1b}" else: set {_d} to nbt compound from "{GAPPLE:1b}" add command block named "&6%{_names::%loop-number%}% &6GEM" with nbt {_d} with lore "&6hold in offhand to get effect" to {items::*} local function randogem(p: player): if any: {items::*} is not set size of {items::*} is 0 then: kick {_p} due to "No available gems" else: set {_i} to random item out of {items::*} remove {_i} from {items::*} give {_p} 1 of {_i} local function reroll(p: player): {reroll::%{_p}'s uuid%} < 3: randogem({_p}) add {_p}'s held item to {items::*} remove {_p}'s held item from {_p} add 1 to {reroll::%{_p}'s uuid%} else: send "&cYou've already rerolled 3 times!" to {_p} command gems_reset: permission: gems.reset trigger: itemreset() command reroll: permission: gems.reroll trigger: name of player's tool contains " &6GEM": reroll(player) else: send "&cYou can't reroll if you aren't holding your gem!" command gems_random: permission: gems.random trigger: randogem(player)
Would you like me to break down the code?
same thingWorks fine for me. You sure you reset first? Did you mess with the functions or anything?
its also giving errors when i reloadWorks fine for me. You sure you reset first? Did you mess with the functions or anything?