Code:
command /ce:
aliases: /customenchants, /customenchant, /enchants
trigger:
set {_item} to gray stained glass pane
set {_enchantmentsList} to book named "&eList Of All The Enchants"
set line 1 of lore of {_enchantmentsList} to ""
set {_commonEnchant} to book named "&7&lCommon Enchant"
set {_uncommonEnchant} to book named "&a&lUncommon Enchant"
set {_rareEnchant} to book named "&1&lRare Enchant"
set {_uniqueEnchant} to book named "&e&lUnique Enchant"
set {_legendaryEnchant} to book named "&6&lLegendary Enchant"
set {_mythicalEnchant} to book named "&d&lMythical Enchant"
# set {_executiveEnchant} to book named "&b&lExecutive Enchant"
set {_gui} to a new chest inventory with 6 rows with name "&b&lCustom Enchants"
set slot (integers between 0 and 53) of {_gui} to {_item}
set slot 10 of {_gui} to {_commonEnchant}
set slot 13 of {_gui} to {_uncommonEnchant}
set slot 16 of {_gui} to {_rareEnchant}
set slot 37 of {_gui} to {_uniqueEnchant}
set slot 40 of {_gui} to {_legendaryEnchant}
set slot 43 of {_gui} to {_mythicalEnchant}
set slot 53 of {_gui} to {_enchantmentsList}
open {_gui} to player
on inventory click:
if name of event-inventory is "&b&lCustom Enchants":
if index of event-slot = 10:
cancel event
if player's level > 1:
remove 1 from player's level
give player book named "&7&lCommon Enchant"
send "You received a &7&lCommon Enchant Book"
else if index of event-slot = 13:
cancel event
if player's level > 2:
remove 1 from player's level
give player book named "&a&lUncommon Enchant"
send "You received a &a&lUncommon Enchant Book"
else if index of event-slot = 16:
cancel event
if player's level > 3:
remove 3 from player's level
give player book named "&1&lRare Enchant"
send "You received a &1&lRare Enchant Book"
else if index of event-slot = 37:
cancel event
if player's level > 4:
remove 4 from player's level
give player book named "&e&lUnique Enchant"
send "You received a &e&lUnique Enchant Book"
else if index of event-slot = 40:
cancel event
if player's level > 5:
remove 5 from player's level
give player book named "&6&lLegendary Enchant"
send "You received a &6&lLegendary Enchant Book"
else if index of event-slot = 43:
cancel event
if player's level > 6:
remove 6 from player's level
give player book named "&d&lMythical Enchant"
send "You received a &d&lMythical Enchant Book"
on right click:
if event-item is book named "&7&lCommon Enchant":
set {custom.enchant} to random integer between 1 and 2
if {custom.enchant} is 1:
set {_book} to enchanted book named "&7&lSmelter"
set line 1 of lore of {_book} to "&7Smelts the ores that you mine."
set line 2 of lore of {_book} to "&eTool Encahntment"
give player {_book}
send "&7Received the &eSmelter&7 Enchantment" to player
else if {custom.enchant} is 2:
set {_book} to enchanted book named "&7Confusion"
set line 1 of lore of {_book} to "&7Chance to apply &eBlindness &7and &eNausea effects"
set line 2 of lore of {_book} to "&7to the enemy!"
set line 3 of lore of {_book} to "&eSword Enchantment"
give player {_book}
send "&7Received the &eConfusion&7 Enchantment" to player
if event-item is book named "&6&lLegendary Enchant":
chance of 100%:
set {custom.enchant} to random integer between 1 and 1
if {custom.enchant} is 1:
set {_book} to enchanted book named "&6&lOverload"
set line 1 of lore of {_book} to "&7Gives the player increased maxed health"
set line 2 of lore of {_book} to "&7Stacks up to 45 hearts"
set line 3 of lore of {_book} to ""
set line 4 of lore of {_book} to "Armor"
give player {_book}
if event-item is book named "&d&lMythical Enchant":
chance of 100%:
set {custom.enchant} to random integer between 1 and 5
if {custom.enchant} is 1:
set {_book} to enchanted book named "&d&lGodly Overload"
set line 1 of lore of {_book} to "&d&lDescription:"
set line 2 of lore of {_book} to "&7Gives the player incrased maxed health"
set line 3 of lore of {_book} to "&7Stacks up to 50 hearts"
set line 4 of lore of {_book} to ""
set line 5 of lore of {_book} to "&d&lApplicable To:"
set line 6 of lore of {_book} to "&7Armor"
set line 7 of lore of {_book} to ""
set line 8 of lore of {_book} to "&d&lRequirements:"
set line 9 of lore of {_book} to "&7Must have Overload 3 on each piece"
give player {_book}
else if {custom.enchant} is 2:
set {_book} to enchanted book named "&d&lHallucination"
set line 1 of lore of {_book} to "&d&lDescription:"
set line 2 of lore of {_book} to "&7Puts victim in webs and bedrock. VISUALLY"
set line 3 of lore of {_book} to "&7You can't hit the enemy, but you can be hit."
set line 4 of lore of {_book} to ""
set line 5 of lore of {_book} to "&d&lApplicable To:"
set line 6 of lore of {_book} to "&7Swords/Axes"
set line 7 of lore of {_book} to ""
set line 8 of lore of {_book} to "&d&lVISUAL ENCHANT"
set line 9 of lore of {_book} to "&7Visual Enchants mean that the effects that happen"
set line 10 of lore of {_book} to "&7Will only show for the victim/attacker."
give player {_book}
else if {custom.enchant} is 3:
set {_book} to enchanted book named "&d&lMama's Mad"
# maybe add a blank line of lore to each new line. Description "", effects: "" applicable to ""
set line 1 of lore of {_book} to "&d&lDescription:"
set line 2 of lore of {_book} to "&7Mama found the grades"
set line 3 of lore of {_book} to "&7Better start running."
set line 4 of lore of {_book} to ""
set line 5 of lore of {_book} to "&d&lEffects:"
set line 6 of lore of {_book} to "&7Gives the player Strength 2.5"
set line 7 of lore of {_book} to ""
set line 8 of lore of {_book} to "&d&lApplicable To:"
set line 9 of lore of {_book} to "&7Swords/Axes"
set line 10 of lore of {_book} to ""
set line 11 of lore of {_book} to "&d&lRequirements:"
set line 12 of lore of {_book} to "&7Must have Rage 3 on the item."
set line 13 of lore of {_book} to ""
set line 14 of lore of {_book} to "&d&lJOKE ENCHANT"
set line 15 of lore of {_book} to "&7While this is a joke enchant, it still gives effects."
give player {_book}
else if {custom.enchant} is 4:
set {_book} to enchanted book named "&d&lLightning"
set line 1 of lore of {_book} to ""
set line 2 of lore of {_book} to ""
set line 3 of lore of {_book} to ""
give player {_book}
else if {custom.enchant} is 5:
set {_book} to enchanted book named "&d&lFatty"
set line 1 of lore of {_book} to ""
set line 2 of lore of {_book} to ""
set line 3 of lore of {_book} to ""
give player {_book}
on inventory click:
if cursor slot of player is book named "&7Confusion", "&f&lEfficiency" or "&a&lFortune":
set {_nm} to name of cursor slot of player
if event-item is any sword:
if event-item's lore doesn't contain "%{_nm}%":
set {_a} to event-item
cancel event
set lore of {_a} to "%lore of {_a}%" and "%{_nm}%"
wait 2 ticks
set cursor slot of player to air
set event-slot to {_a}
else:
cancel event
send "&7You already have that enchantment!"
command /enchanter [<offline player>]:
trigger:
set {_gui} to a new chest inventory with 6 rows with name "&b&lEnchanter"
set {_item} to black stained glass pane named "&c&lHello"
set {_itemB} to barrier named "&4&lFiller" # or change the barrier to red stained glass
set {_itemC} to air
set {_itemA} to anvil named "&f&lClick Me!" with lore "&7&lPut an item on the left side,", "&7&lPut an enchant book on the right side" and "Then click me and it will put the enchant on the item"
set slot (integers between 0 and 53) of {_gui} to {_item}
set slot 31 of {_gui} to {_itemA}
set slot (integers between 11 and 15) of {_gui} to {_itemB}
set slot 20 and 24 of {_gui} to {_itemB}
set slot 29 and 33 of {_gui} to {_itemC}
# its gonna look like
# barrier, barrier, barrier, barrier, barrier
# barrier, barrier, barrier,
# barrier, barrier, barrier,
# ITEM, BOOK,
# barrier, barrier, barrier,
# barrier, barrier, barrier,
# barrier, barrier, barrier,
open {_gui} to player
on inventory click:
if name of event-inventory is "&b&lEnchanter":
if index of event-slot = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52 or 53:
cancel event
on inventory click:
if name of event-inventory is "&b&lEnchanter":
if index of event-slot = 31:
cancel event
if slot 29 of player's current inventory is any sword:
make console execute "/tell Tewahh Hi!"
if slot 33 of player's current inventory is any book:
make console execute "/tell Tewahh Hello!"
So, this is a bit of a request as well as help, I wanna make this code shorter and more optimized, but I dont know how to use functions/loops very well, so i wanna learn how to do this better, but I need someone to put my into the right direction.