How to drop enchanted item ?

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

HeliumBoi

Active Member
Sep 15, 2023
124
7
18
Uzbekistan
So i have this code and it has error, it doesnt drop the item with given enchant protection 1.
and I want the enchant to be hidden too but lmk if you guys know how to do that.


Code:
on death of zombie:
    set {_randomvalue} to random number between 1 and 10
    set {_deathvalue} to victim's location
    if {_randomvalue} is less than or equal to 3:
        drop 1 scute named "&bmorganite piece" of protection 1 0.6 meters above {_deathvalue}

So in this code, when you kill a zombie you have 30% chanse to get custom drop(scute). and i want that item to be enchanted so players dont think its normal item.
 
So i have this code and it has error, it doesnt drop the item with given enchant protection 1.
and I want the enchant to be hidden too but lmk if you guys know how to do that.


Code:
on death of zombie:
    set {_randomvalue} to random number between 1 and 10
    set {_deathvalue} to victim's location
    if {_randomvalue} is less than or equal to 3:
        drop 1 scute named "&bmorganite piece" of protection 1 0.6 meters above {_deathvalue}

So in this code, when you kill a zombie you have 30% chanse to get custom drop(scute). and i want that item to be enchanted so players dont think its normal item.
The best way to modify extra data like enchants/NBT data/ETC is to set the item as a seperate variable THEN enchant the variable/modify it as needed and do with it what you wish (You'll also need the expression "with all flags hidden" or a different one if you plan to set all flags hidden via solely NBT based statements to hide the enchant). I won't give the solution away of how to do this, but check my comment before this. I provided a solution for someone asking how to modify an enchantment on an item which would be a similar enough solution that you could use for this (Check it out here).