Give player enchanted book with list variable for enchants

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

  • LOOKING FOR A VERSION OF SKRIPT?

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

Status
Not open for further replies.
Apr 12, 2017
36
0
0
24
I am trying to make a disenchantment command that will later tie in with an npc. Atm im using a command that requires permissions.
code_language.skript:
command /disenchant:
    trigger:
        player has permission "disenchant"
        set {_enchants::*} to enchants of player's tool
        send "&aSucessfully removed %{_enchants::*}% from tool!" to player
        set {_enchants::*} to "{_enchants::*}" parsed as text
        disenchant player's tool
        give player enchanted book of {_enchants::*}
It is showing that "::*}" is not a valid item data.
Thanks!
xiKvsMN.png
 
EDIT:
I thought i Had it working, turns out I didn't, back to the drawing board
[doublepost=1528230943,1528226071][/doublepost]Okay, I racked my brain for an hour or so on this.
This is not the most spectacular way of doing things, but it works.
You will need SkStuff (for NBT support)

code_language.skript:
command /disenchant:
    trigger:
        player has permission "disenchant"
        set {_enchants::*} to enchants of player's tool
        set {_tool} to player's held item
        set {_nbt} to tag "ench" of nbt of {_tool}
        send "&aSucessfully removed %{_enchants::*}% from tool!" to player
        disenchant player's tool
        execute console command "give %player% enchantedbook 1 0 {StoredEnchantments:%{_nbt}%}"
 
Status
Not open for further replies.