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 comminuty!
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!
what did you set enchant to?
variables:
{enchant::1} = aqua affinity 1 parsed as enchantment
{enchant::2} = bane of arthropods 1 parsed as enchantment
{enchant::3} = blast protection 1 parsed as enchantment
{enchant::4} = channeling parsed 1 as enchantment
{enchant::5} = curse of binding 1 parsed as enchantment
{enchant::6} = curse of vanishing 1 parsed as enchantment
{enchant::7} = depth strider 1 parsed as enchantment
{enchant::8} = efficiency 1 parsed as enchantment
{enchant::9} = feather falling 1 parsed as enchantment
{enchant::10} = fire aspect 1 parsed as enchantment
{enchant::11} = fire protection 1 parsed as enchantment
{enchant::12} = flame 1 parsed as enchantment
{enchant::13} = fortune 1 parsed as enchantment
{enchant::14} = frost walker 1 parsed as enchantment
{enchant::15} = impaling 1 parsed as enchantment
{enchant::16} = infinity 1 parsed as enchantment
{enchant::17} = knockback 1 parsed as enchantment
{enchant::18} = looting 1 parsed as enchantment
{enchant::19} = loyalty 1 parsed as enchantment
{enchant::20} = luck of the sea 1 parsed as enchantment
{enchant::21} = lure 1 parsed as enchantment
{enchant::22} = mending 1 parsed as enchantment
{enchant::23} = multishot 1 parsed as enchantment
{enchant::24} = piercing 1 parsed as enchantment
{enchant::25} = power 1 parsed as enchantment
{enchant::26} = projectile 1 protection parsed as enchantment
{enchant::27} = protection 1 parsed as enchantment
{enchant::28} = punch 1 parsed as enchantment
{enchant::29} = quick charge 1 parsed as enchantment
{enchant::30} = respiration 1 parsed as enchantment
{enchant::31} = riptide 1 parsed as enchantment
{enchant::32} = sharpness 1 parsed as enchantment
{enchant::33} = silk touch 1 parsed as enchantment
{enchant::34} = smite 1 parsed as enchantment
{enchant::35} = soul speed 1 parsed as enchantment
{enchant::36} = sweeping edge 1 parsed as enchantment
{enchant::37} = thorns 1 parsed as enchantment
{enchant::38} = unbreaking 1 parsed as enchantment
on load:
set {enchant::1} to "aqua_affinity"
set {enchant::2} to "bane_of_arthropods"
set {enchant::3} to "blast_protection"
set {enchant::4} to "channeling"
set {enchant::5} to "binding_curse"
set {enchant::6} to "vanishing_curse"
set {enchant::7} to "depth_strider"
set {enchant::8} to "efficiency"
set {enchant::9} to "feather_falling"
set {enchant::10} to "fire_aspect"
set {enchant::11} to "fire_protection"
set {enchant::12} to "flame"
set {enchant::13} to "fortune"
set {enchant::14} to "frost_walker"
set {enchant::15} to "impaling"
set {enchant::16} to "infinity"
set {enchant::17} to "knockback"
set {enchant::18} to "looting"
set {enchant::19} to "loyalty"
set {enchant::20} to "luck_of_the_sea"
set {enchant::21} to "lure"
set {enchant::22} to "mending"
set {enchant::23} to "multishot"
set {enchant::24} to "piercing"
set {enchant::25} to "power"
set {enchant::26} to "projectile_protection"
set {enchant::27} to "protection"
set {enchant::28} to "punch"
set {enchant::29} to "quick_charge"
set {enchant::30} to "respiration"
set {enchant::31} to "riptide"
set {enchant::32} to "sharpness"
set {enchant::33} to "silk_touch"
set {enchant::34} to "smite"
set {enchant::35} to "soul_speed"
set {enchant::36} to "sweeping"
set {enchant::37} to "thorns"
set {enchant::38} to "unbreaking"
#code to trigger the lines below
set {randomenchant.%player%} to random integer between 1 to 38
set {_enchant} to "%{enchant::%{randomenchant.%player%}%}%"
execute console command "/give %player% enchanted_book 1 0 {StoredEnchantments:[{id:%{_enchant}%,lvl:1}]}"
sadly you cant give enchanted books without a console command
this should do the trick:
Code:on load: set {enchant::1} to "aqua_affinity" set {enchant::2} to "bane_of_arthropods" set {enchant::3} to "blast_protection" set {enchant::4} to "channeling" set {enchant::5} to "binding_curse" set {enchant::6} to "vanishing_curse" set {enchant::7} to "depth_strider" set {enchant::8} to "efficiency" set {enchant::9} to "feather_falling" set {enchant::10} to "fire_aspect" set {enchant::11} to "fire_protection" set {enchant::12} to "flame" set {enchant::13} to "fortune" set {enchant::14} to "frost_walker" set {enchant::15} to "impaling" set {enchant::16} to "infinity" set {enchant::17} to "knockback" set {enchant::18} to "looting" set {enchant::19} to "loyalty" set {enchant::20} to "luck_of_the_sea" set {enchant::21} to "lure" set {enchant::22} to "mending" set {enchant::23} to "multishot" set {enchant::24} to "piercing" set {enchant::25} to "power" set {enchant::26} to "projectile_protection" set {enchant::27} to "protection" set {enchant::28} to "punch" set {enchant::29} to "quick_charge" set {enchant::30} to "respiration" set {enchant::31} to "riptide" set {enchant::32} to "sharpness" set {enchant::33} to "silk_touch" set {enchant::34} to "smite" set {enchant::35} to "soul_speed" set {enchant::36} to "sweeping" set {enchant::37} to "thorns" set {enchant::38} to "unbreaking" #code to trigger the lines below set {randomenchant.%player%} to random integer between 1 to 38 set {_enchant} to "%{enchant::%{randomenchant.%player%}%}%" execute console command "/give %player% enchanted_book 1 0 {StoredEnchantments:[{id:%{_enchant}%,lvl:1}]}"
function randomEnchantedBooks(amount: integer, p: player):
set {_i} to random integer between 1 and 25
if {_i} is 1:
set {_o} to "protection"
set {_x} to random integer between 1 and 4
if {_i} is 2:
set {_o} to "fire_protection"
set {_x} to random integer between 1 and 4
if {_i} is 3:
set {_o} to "feather_falling"
set {_x} to random integer between 1 and 4
if {_i} is 4:
set {_o} to "blast_protection"
set {_x} to random integer between 1 and 4
if {_i} is 5:
set {_o} to "projectile_protection"
set {_x} to random integer between 1 and 4
if {_i} is 6:
set {_o} to "respiration"
set {_x} to random integer between 1 and 3
if {_i} is 7:
set {_o} to "aqua_affinity"
set {_x} to random integer between 1 and 1
if {_i} is 8:
set {_o} to "thorns"
set {_x} to random integer between 1 and 3
if {_i} is 9:
set {_o} to "depth_strider"
set {_x} to random integer between 1 and 3
if {_i} is 10:
set {_o} to "sharpness"
set {_x} to random integer between 1 and 5
if {_i} is 11:
set {_o} to "smite"
set {_x} to random integer between 1 and 5
if {_i} is 12:
set {_o} to "bane_of_arthropods"
set {_x} to random integer between 1 and 5
if {_i} is 13:
set {_o} to "knockback"
set {_x} to random integer between 1 and 2
if {_i} is 14:
set {_o} to "fire_aspect"
set {_x} to random integer between 1 and 2
if {_i} is 15:
set {_o} to "looting"
set {_x} to random integer between 1 and 3
if {_i} is 16:
set {_o} to "efficiency"
set {_x} to random integer between 1 and 5
if {_i} is 17:
set {_o} to "silk_touch"
set {_x} to 1
if {_i} is 18:
set {_o} to "unbreaking"
set {_x} to random integer between 1 and 3
if {_i} is 19:
set {_o} to "fortune"
set {_x} to random integer between 1 and 3
if {_i} is 20:
set {_o} to "power"
set {_x} to random integer between 1 and 5
if {_i} is 21:
set {_o} to "punch"
set {_x} to random integer between 1 and 2
if {_i} is 22:
set {_o} to "flame"
set {_x} to random integer between 1 and 1
if {_i} is 23:
set {_o} to "infinity"
set {_x} to 1
if {_i} is 24:
set {_o} to "luck_of_the_sea"
set {_x} to random integer between 1 and 3
if {_i} is 25:
set {_o} to "lure"
set {_x} to random integer between 1 and 3
set {_enchantItem} to enchanted book
set nbt of {_enchantItem} to "{StoredEnchantments:[{lvl:%{_x}%s,id:""minecraft:%{_o}%""}]}"
give 1 of {_enchantItem} to {_p}