#Custom item losing ability upon enchant

1 messages · Page 1 of 1 (latest)

prisma hawk
#

its cuz if you change the sword it will completely change the skript

#

cuz its given

#

So like

#

you may want to make

#

if name of player's tool is "herenameofsword":

#

because if you change like the unbreakable nbt

#

the {withersword} isnt it anymore

#

Cuz its not the EXCACT same as given

frosty sigil
#

but like waht if the player uses an anvil and anmes it to the sword or wahtever

#

would that work or nah

#

ok i tihnk i understand what youre saying

frosty sigil
#

when i combine the sword and a book in an anvil it adds an nbt tag

#

dyk how to remove that nbt tag while keeping the enchant

#

or is it just not possible

prisma hawk
#

Wdym

#

Nbt tag

#

Huhh

frosty sigil
#

so when you put the sword and an enchant book in an anvil and combine it

#

the nbt goes from 4 to 5

#

and i think that’s why it’s not shooting anymore

frosty sigil
#
on load:
    set {withersword} to unbreakable netherite sword named "&7Wither Sword" with lore "&dA sword forged in the heart of the wither"
on load:
    register new shaped recipe for unbreakable netherite sword named "&7Wither Sword" with lore "&dA sword forged in the heart of the wither" using diamond block, netherite ingot, diamond block, netherite ingot, nether star, netherite ingot, diamond block, netherite ingot and diamond block with id "withersword"

on join:
 set {cooldown_1.%player's uuid%} to false

on right click:
    if player is holding {withersword}:
        if {cooldown_1.%player's uuid%} is false:
            make player shoot a wither skull at speed 3
            set {cooldown_1.%player's uuid%} to true
            wait 15 seconds
            set {cooldown_1.%player's uuid%} to false
        if {cooldown_1.%player's uuid%} is true:
            send "&4&lYou may not use this item now!" to player

on damage:
    if attacker is holding {withersword}:
        increase damage by 1

on enchant:
    if id of the tool contains "withersword":
        set id of the tool to "withersword"
warm carbon
#
  1. Name your variable witherSword. Camel case is cool.
  2. You set up a variable, why not use it in the very next line? register a recipe for the variable instead of typing out the long details of the item again
  • also, its recommended to use the recipe section, as its neater.
  1. Don't set the cooldowns to false. If you do that, they are still set, and thus still take up storage space. Instead, you can just delete them.
  2. Dont name it cooldown_1, when you have dozens of cooldowns, how are you going to remember which is which? Name it something like {cooldown::%player's UUID%::witherSword}
  3. Checking for the variable to identofy the item is finicky, as it requires the item in question to be exactly the variable, no extra enchants, and must have full durability. The best option is to check for a custom NBT tag you add to the item to ID it.
  4. You can set cooldowns to false/true, but the best option is to set them to a time. that way, you can set your cooldown to 15 seconds from now, which will set it to 15 seconds in the future. then, check if now > {cooldownHere} to see if it has passed yet.
  5. You can also make the cooldowns metadata tags
frosty sigil
#

i dont get like half of it but i got it working lolol

#
on load:
    set {withersword} to unbreakable netherite sword named "&7Wither Sword" with lore "&dA sword forged in the heart of the wither"
on load:
    register new shaped recipe for unbreakable netherite sword named "&7Wither Sword" with lore "&dA sword forged in the heart of the wither" using diamond block, netherite ingot, diamond block, netherite ingot, nether star, netherite ingot, diamond block, netherite ingot and diamond block with id "withersword"

on join:
 set {cooldown_1.%player's uuid%} to false

on right click:
    if name of player's tool is "&7Wither Sword":
        if {cooldown_1.%player's uuid%} is false:
            make player shoot a wither skull at speed 3
            set {cooldown_1.%player's uuid%} to true
            wait 1 seconds
            set {cooldown_1.%player's uuid%} to false
        if {cooldown_1.%player's uuid%} is true:
            send "&4&lYou may not use this item now!" to player

on damage:
    if attacker is holding "&7Wither Sword":
        increase damage by 1