I'm trying to make a damaging snowball command which doesn't need redstone (comparators, repeaters etc.) This is the entire code:

Command one:

/scoreboard players set xXElite_PythonXx HoldSnowball 1 {SelectedItemSlot:0,Inventory:[{tag:{display:{Name:"shuriken",Lore:["_____"]}}}]}

Command two:

/execute @e[score_HoldSnowball_min=1] ~ ~ ~ scoreboard players set @e[type=Snowball,rm=3,r=4] Snowball 1

Command three:

/execute @e[type=Snowball,score_Snowball_min=1] ~ ~ ~ effect @e[r=2] wither 1 1 true

Command four:

/scoreboard players set xXElite_PythonXx HoldSnowball 0

Command two is crucial in order for the whole damaging schematic to work, but the problem is that it doesn't execute the command, it instead says:

[15:55:42] Failed to execute 'scoreboard players set @e[type=Snowball,rm=3,r=4] Snowball 1' as xXElite_PythonXx

Could you please help to fix the problem with command number two? What is the correct code?

  • 1
    Unless there's a snowball 3-4 blocks from you as you open the command block, then you should expect to see that error message (because it fails to find @e[type=Snowball,rm=3,r=4] in that tick). If you set the Snowball objective to display on the sidebar, do you see snowballs being added to it as you throw them? – SirBenet Sep 14 '16 at 16:15
  • Does it only show the message, or also doesn't work? If it doesnt work, use a bigger range: @e[type=Snowball,r=4] – RudolfJelin Sep 15 '16 at 13:15

I found out that if you put this command into a repeating command block, it should work:

/execute @e[type=Snowball] ~ ~ ~ effect @e[type=!Player,r=2] minecraft:instant_damage 1 1

You can alter the damage amplifier by changing the second 1 after instant damage higher. Unfortunately, this will not effect zombies. If you wish to give instant damage to all entities except yourself, I would use:

/execute @e[type=Snowball] ~ ~ ~ effect @e[rm=1,r=2] minecraft:instant_damage 1 1

If you just want to target zombies use:

/execute @e[type=Snowball] ~ ~ ~ effect @e[type=Zombie,r=2] minecraft:instant_health

Make sure to type:

/gamerule commandBlockOutput false

I hope that this has helped, I tried to make it as simple as possible. Have fun with this command!

| improve this answer | |

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