I have some command blocks set up that makes any mob I hit gain the wither effect. Is there a way to make it so when a player is near a mob with the wither effect, the player will gain the regeneration effect for the duration of the mob's effect?

  • Guardian attack with negative damage? – SF. Jul 4 '17 at 11:58

Put in a repeating commandblock with this in it:

/scoreboard players tag @e[tag=wb] remove wb

That will just remove a tag I put as wb from any mob.

Then put an always active chain command leading out with the command:

/scoreboard players tag @e add wb {ActiveEffects:[{Id:20b}]}

This will give any mob with wither the tag wb which will be removed by the first command after this next command is run in an always active chain commandblock leading out from the second one:

/execute @e[tag=wb] ~ ~ ~ effect @a[r=3] minecraft:regeneration 2 1

This gives any player in a radius of 3 to a mob with wither the regen effect. In the selector for the player add whatever scoreboard values you want if you want it to apply to only specific players and not any.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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