4

I've made a sword that gives slowness 10 for 2 seconds to any player that is hit by it. It used to worked, but now seems to not work for some reason. This is how it works:

There are two scoreboards, dmgTFS which is damage taken and dmgDFS which is damage dealt.

The command blocks are laid out like this:

[R] > [C] > [C] > [C] > [C] > [comparator] > [impulse] > [C] > [C] > [C] (R= repeating, C= chain, impulse= impulse)

Commands (from left to right):

/scoreboard players tag @a add holdingFS {SelectedItem:{id:"minecraft:iron_sword",tag:{display:{Name:"Frost Sword"}}}}

/scoreboard players tag @a[score_dmgDFS_min=1,tag=holdingFS] add hit

/execute @a[tag=hit] ~ ~ ~ /execute @a[r=5,tag=!hit] ~ ~ ~ /scoreboard players tag @p[score_dmgTFS_min=1,r=0,c=1] add possHit

/execute @a[tag=hit] ~ ~ ~ /scoreboard players operation @a[tag=possHit,r=5] dmgTFS -= @p[tag=hit,r=0,c=1] dmgDFS

/execute @a[tag=possHit,score_dmgTFS_min=0] ~ ~ ~ /scoreboard players tag @p[r=0,c=1] add confirmedHit

(comparator goes here)

/execute @a[tag=confirmedHit] ~ ~ ~ /effect @p[r=0,c=1] slowness 2 10

/scoreboard players tag @a[tag=confirmedHit] remove possHit

/execute @a[tag=confirmedHit] ~ ~ ~ /scoreboard players tag @a[tag=hit,r=5] remove hit

/scoreboard players tag @a[tag=confirmedHit] remove confirmedHit

There are also three separate repeating command blocks that constantly set the score of dmgDFS and dmgTFS to 0 and that constantly remove the holdingFS tag. Once again, it worked at first, but somehow doesn't seem to work now.

Here's the world if you need to experiment with the commands (the area with the commands is outlined with red wool): https://www.mediafire.com/?erif2zo7q25fkq7

What seems to be preventing it from working?

2 Answers 2

1

It works now. I just removed the comparator (I don't know what I was thinking, the comparator is like a worse chain command block) and put the scoreboard resets at the end of the line and it works just fine now.

1
  • Don't forget to mark this as the accepted answer.
    – Codingale
    Commented Feb 23, 2017 at 10:23
0

Your short form is a bit...confusing... I wonder if you explain them incorrectly as it makes the commands not logical... I thought TFS is taken and DFS is dealt.

If i am correct, then i am sorry, i cannot find any logical mistake in your commands, but the execute of /execute @a[tag=possHit,score_dmgTFS_min=0] ~ ~ ~ /scoreboard players tag @p[r=0,c=1] add confirmedHit is not necessary.

If i am not correct, then i just cannot understand why your command is like that...


Also, you can check that if your commands that clear the score is executed after the above command, if not, that should be the reason for that.

If this is really the problem, you can add those clear commands after the above command blocks(before the comparator)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.