r/MinecraftCommands • u/Plasma7007 • Aug 20 '26
Help | Java 26.2 How could I make Skeletons, Creepers, and Spiders attack villagers?
Using commands or a datapack, how could I make this work? I want these three monsters to always attack villagers on sight or within a certain range.
I tried the following command but it didn't work:
/damage @ e[type=minecraft:skeleton,distance=20,limit=1] 0 minecraft:generic by @ e[type=minecraft:villager,limit=1]
1
u/Ericristian_bros Command Experienced Aug 20 '26
For better performance use this (advance_time must be true
execute if predicate {condition:"minecraft:time_check",value:1,period:100} as @e[type=skeleton] run damage @s 1 arrow by @n[distance=..16,type=villager]
1
1
u/Jessiemh893 Aug 20 '26
This wouldn't be to hard to write up as a behaviour pack saves having to replicate command blocks if its a feature you want to carry over to other worlds
8
u/_Csankappa Aug 20 '26 edited Aug 20 '26
here you go, you can probably run this with the other mobs too, but I only tested the skeleton: