enchantment request

  • 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: enchanting

Suggested name: enchantment.sk

Spigot/Skript Version: 2.3.7

What I want:
A skript that allows enchanting items using a lore system so that the enchants are binded to the item not the player.

Ideas for commands:
/enchant
Ideas for permissions:
none
When I'd like it by: Asap
 
I don't get what you mean can you be more directly about what you mean? Btw, in normal MC it is already binded to the tool? But do you mean custom enchantments?
 
What custom enchantments? And do you know how to skript or do you need the full skript?
 
I just need one example enchantment such as a speed enchant or something.
Surprisingly this works:
Code:
every second:
    loop all players:
        set {_p} to loop-player
        loop all items in {_p}'s inventory:
            if lore of loop-item contains "&9Speed modifier":
                apply speed 1 to loop-player for 1 second

command /enchant <text>:
    permission: Enchant
    permission message: &cNo Access
    usage: &cWrite a modifier
    trigger:
        if arg-1 is "Speed":
            set lore of player's tool to "%lore of player's tool% -- &9Speed Modifier &5--"
 
  • Like
Reactions: NeedHelp
Surprisingly this works:
Code:
every second:
    loop all players:
        set {_p} to loop-player
        loop all items in {_p}'s inventory:
            if lore of loop-item contains "&9Speed modifier":
                apply speed 1 to loop-player for 1 second

command /enchant <text>:
    permission: Enchant
    permission message: &cNo Access
    usage: &cWrite a modifier
    trigger:
        if arg-1 is "Speed":
            set lore of player's tool to "%lore of player's tool% -- &9Speed Modifier &5--"
hmm ok but what if I want to make a command "say /speed1" put in the lore "Speed 1" and then increase it by 1 every time the command is executed.
 
hmm ok but what if I want to make a command "say /speed1" put in the lore "Speed 1" and then increase it by 1 every time the command is executed.
Dude! I got it working:
Code:
command /enchant <text>:
    permission: Enchant
    permission message: &cNo Access
    usage: &cWrite a modifier
    trigger:
        if arg-1 is "Speed":
            if lore of player's tool contains "&9Speed Modifier":
                set {_lore} to lore of player's tool
                replace colored "-- &9speed modifier" in {_lore} with ""
                replace colored "&5--" in {_lore} with ""
                replace " " in {_lore} with ""
                set {_lore} to uncolored "%{_lore}%" parsed as a number
                add 1 to {_lore}
                set lore of player's tool to "&5-- &9Speed Modifier %{_lore}% &5--"
            else:
                set lore of player's tool to "&5-- &9Speed Modifier 1 &5--"


every second:
    loop all players:
        set {_p} to loop-player
        loop all items in {_p}'s inventory:
            set {_lore} to lore of loop-item
            replace colored "-- &9speed modifier" in {_lore} with ""
            replace colored "&5--" in {_lore} with ""
            set {_lore} to uncolored {_lore} parsed as a number
            if lore of loop-item contains "&9Speed modifier":
                apply speed {_lore} to loop-player for 1 second
 
Prob is best to use this instead of "every second" and loop all players.

Code:
on player's tool change:
    if lore of player's tool contains "&9Speed Modifier":
        set {_lore} to lore of event-item
        replace colored "-- &9speed modifier" in {_lore} with ""
        replace colored "&5--" in {_lore} with ""
        set {_lore} to uncolored {_lore} parsed as a number
        while event-player is holding event-item:
            apply speed {_lore} to event-player for 1 second
            wait 10 ticks
 
Prob is best to use this instead of "every second" and loop all players.

Code:
on player's tool change:
    if lore of player's tool contains "&9Speed Modifier":
        set {_lore} to lore of event-item
        replace colored "-- &9speed modifier" in {_lore} with ""
        replace colored "&5--" in {_lore} with ""
        set {_lore} to uncolored {_lore} parsed as a number
        while event-player is holding event-item:
            apply speed {_lore} to event-player for 1 second
            wait 10 ticks
I think he want it like this:
Code:
command /enchant <text>:
    permission: Enchant
    permission message: &cNo Access
    usage: &cWrite a modifier
    trigger:
        if arg-1 is "Speed":
            if lore of player's tool contains "&9Speed Modifier":
                set {_lore} to lore of player's tool
                replace colored "-- &9speed modifier" in {_lore} with ""
                replace colored "&5--" in {_lore} with ""
                replace " " in {_lore} with ""
                set {_lore} to uncolored "%{_lore}%" parsed as a number
                add 1 to {_lore}
                set lore of player's tool to "&5-- &9Speed Modifier %{_lore}% &5--"
            else:
                set lore of player's tool to "&5-- &9Speed Modifier 1 &5--"
        loop all items in player's inventory:
            set {_lore} to lore of loop-item
            replace colored "-- &9speed modifier" in {_lore} with ""
            replace colored "&5--" in {_lore} with ""
            set {_lore} to uncolored {_lore} parsed as a number
            if lore of loop-item contains "&9Speed modifier":
        while loop-item is in player's inventory:
                    apply speed {_lore} to loop-player for 1 second
 
 
on pickup:
    set {_lore} to lore of event-item
    replace colored "-- &9speed modifier" in {_lore} with ""
    replace colored "&5--" in {_lore} with ""
    set {_lore} to uncolored {_lore} parsed as a number
    if lore of event-item contains "&9Speed modifier":
        while event-item is in event-player's inventory:
            apply speed {_lore} to event-player for 1 second

it has not been tested yet
 
ok thanks guys I should prob be able to do my stuff with this, Ill post back if I need any further help.