Jump to content

Shield Durability Does Not Work


Fletchermed

Recommended Posts

I am having trouble getting shields to work with mythicmobs. when they player is attacked while blocking, they don't lose durability, or break. so i added code to remove custom durability when the player takes damage but it doesn't break, can someone please help me?

here is the code that i have been trying to get to work
on damage of player:
    if the victim is blocking:
        if the victim's tool is a shield:
            add 1 to the durability of the victim's tool
            if the victim's tool's durability < 1:
                set the victim's tool to air
                execute console command "/execute at %victim% run playsound minecraft:item.shield.break master %victim% ~ ~ ~ 1 1"
        else if the victim's offhand tool is a shield:
            add 1 to the durability of the victim's offhand tool
            if the victim's offhand tool's durability < 1:
                set the victim's offhand tool to air
                execute console command "/execute at %victim% run playsound minecraft:item.shield.break master %victim% ~ ~ ~ 1 1"

for some odd reason, the durability goes into the negatives and doesn't break when below 1 durability. there is no errors when i reload the skript either.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...