enchant tools in players inventory

  • 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 community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

ghostjusr

New Member
Apr 8, 2023
7
1
3
United States
I want to make a script that enchants every tool in a players inventory with efficiency 5. If the player has an item with a lower efficiency level, it is still switched to efficiency 5. I only want tools like the pickaxe, sword, and axe, not armor or random items. Can someone help me?
 
Code:
command enchanttest:
   trigger:
      loop all items in player's inventory:
         if {tools::*} contains loop-item: # Make sure to define all possible tools in {tools::*}!
            enchant loop-item with efficiency 5

Keep in mind: This code I wrote has not been tested and could be slightly buggy.
 
Code:
command enchanttest:
   trigger:
      loop all items in player's inventory:
         if {tools::*} contains loop-item: # Make sure to define all possible tools in {tools::*}!
            enchant loop-item with efficiency 5

Keep in mind: This code I wrote has not been tested and could be slightly buggy.
This is not a good solution of doing it, either you add the tools too a list variable (preferably a ram/temp var) on load, or by checking the items manually.

For the enchanting part I recommend you use filters. Example:
code_language.skript:
enchant (all items in player's inventory where [{-tools::*} contains input]) with efficiency 5
 
  • Like
Reactions: Luke_Sky_Walker