Enchantment skript needed

  • Welcome to skUnity!

    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!

titustitus98

Member
Feb 19, 2018
47
0
6
25
Category: Enchants

Suggested name: enchant.sk

Spigot/Skript Version:
paper 1.12.2 (with viaversion, and viabackwards) skript 2.3.6


What I want:
Basicaly what I need is a gui with one basic enchant (for example speed so I can add more later) where I would be able to purchase the enchant with any picks using this currency: {coins::%player%} and I would need the price to increase by a certain amount each and have a max level of 10.

Ideas for commands:
/ench or sneak right-click
Ideas for permissions:
none
When I'd like it by:
At least by this week-end if you can't manage it by then then its fine.
Contact :
discord: titustitus98[Bot Maker]#7085 or here

[doublepost=1554109983,1553850235][/doublepost]bump
 
Try this (not tested):
Code:
import:
    org.bukkit.inventory.ItemFlag

function openEnchantMenu(p: player):
    open virtual chest inventory with 6 rows named "Enchanting" to {_p}
    loop 54 times:
        create gui slot (loop-num - 1) of {_p} with white glass pane named "&f"
    create gui slot 5 of {_p} with tool of {_p}
    set {_price} to 10
    set {_enc::*} to lore of tool of {_p}
    set {_enclvl} to 0
    set {_i} to size of {_enc::*} + 1
    set {_selected} to index of hotbar slot of {_p}
    loop {_enc::*}:
        set {_l::*} to uncolored loop-value parsed as "Speed: %integer%"
        {_l::*} is set:
        set {_enclvl} to {_l::1}
        set {_i} to loop-index
        exit loop
    add {_enclvl}*5 to {_price}
    set {_item} to blue dye named "&aSpeed" with lore "&7Cost: &6%{_price}%" and "&7Your level: %{_enclvl}%"
    if {_enclvl} < 10:
        {_item}.addUnsafeEnchantment(protection, 1)
        {_item}.getItemMeta().addItemFlags(ItemFlag.HIDE_ENCHANTS!)
    create gui slot 10 of {_p} with {_item} to run:
        if {_enclvl} >= 10:
            message "&cYou already reached max level!"
        else if {coins::%{_p}%} ? 0 < {_price}:
            message "&cYou can't afford this enchantment!"
        else:
            remove {_price} from {coins::%{_p}%}
            set {_enc::%{_i}%} to "&bSpeed: &7%{_enclvl}+1%"
            set lore of slot {_selected} of {_p} to {_enc::*}
            message "&aYou purchased &bSpeed %{_enclvl}+1% &afor &6%{_price}%&a."
            close inventory of {_p}
 
Try this (not tested):
Code:
import:
    org.bukkit.inventory.ItemFlag

function openEnchantMenu(p: player):
    open virtual chest inventory with 6 rows named "Enchanting" to {_p}
    loop 54 times:
        create gui slot (loop-num - 1) of {_p} with white glass pane named "&f"
    create gui slot 5 of {_p} with tool of {_p}
    set {_price} to 10
    set {_enc::*} to lore of tool of {_p}
    set {_enclvl} to 0
    set {_i} to size of {_enc::*} + 1
    set {_selected} to index of hotbar slot of {_p}
    loop {_enc::*}:
        set {_l::*} to uncolored loop-value parsed as "Speed: %integer%"
        {_l::*} is set:
        set {_enclvl} to {_l::1}
        set {_i} to loop-index
        exit loop
    add {_enclvl}*5 to {_price}
    set {_item} to blue dye named "&aSpeed" with lore "&7Cost: &6%{_price}%" and "&7Your level: %{_enclvl}%"
    if {_enclvl} < 10:
        {_item}.addUnsafeEnchantment(protection, 1)
        {_item}.getItemMeta().addItemFlags(ItemFlag.HIDE_ENCHANTS!)
    create gui slot 10 of {_p} with {_item} to run:
        if {_enclvl} >= 10:
            message "&cYou already reached max level!"
        else if {coins::%{_p}%} ? 0 < {_price}:
            message "&cYou can't afford this enchantment!"
        else:
            remove {_price} from {coins::%{_p}%}
            set {_enc::%{_i}%} to "&bSpeed: &7%{_enclvl}+1%"
            set lore of slot {_selected} of {_p} to {_enc::*}
            message "&aYou purchased &bSpeed %{_enclvl}+1% &afor &6%{_price}%&a."
            close inventory of {_p}
yeah it doesen't work and how would I even add an effect to the enchant?
 
yeah it doesen't work and how would I even add an effect to the enchant?
I'm sorry, I have no recollection of making that post or that code.

You should've replied faster