3

Minecraft command block

TheUndyingAbyss 3/1/26 5:50 am
119
3/1/2026 9:39 am
So i have this one map ive been making for a while but i was wondering if there was a way to make mobs give effects whenever they attack players like how husks apply hunger and wither skeletons apply wither using command blocks. but for other mobs
Posted by
TheUndyingAbyss
Level 1 : New Miner
0

  Have something to say?

JoinSign in

2

Beaufort-Scale-5
03/01/2026 9:39 am
He/Him • Level 34 : Artisan Mage
You can apply Effects when a player is Damaged using Command Blocks by setting up a simple scoreboard loop:

On an impulse block or in the console, activate once:
scoreboard objectives add dmgTaken minecraft.custom:minecraft.damage_taken

I would also add the scoreboard display when testing:
/scoreboard objectives setdisplay sidebar dmgTaken

Then on a repeating command block:
execute as @a[scores={dmgTaken=2..}] run effect give @s minecraft:glowing 5 0 false

Link a chain command block (Conditional, Always Active) to the repeating block:
scoreboard players set @a[scores={dmgTaken=1..}] dmgTaken 0
(This allows the score to reset so the effect can be applied again.)


However, yes, CyborgVillager is on point here that a datapack may give you more flexibility and precision. The command loop above is basic and will trigger whenever a player takes ANY damage.
1
CyborgVillager
03/01/2026 6:37 am
Level 26 : Expert Network Explorer
history
Quite frankly I think making a datapack would be easier than using a command block due to more controls you can have ( better readability) for stuff like this.


I did a bit of digging and found CorgiXP YT video called 👉 Minecraft Summon Command Tutorial | Custom Mobs with NBT (Java 1.21)



And for abilities the only one I could find for command blocks was for the Bedrock edition, made by Jervenshmine How to give mobs custom abilities | Minecraft Bedrock Command Tutorial

- Hope those helps👍 You might have to edit a bit from the Bedrock to Java, but it should give you an idea
2

Welcome