Started by
leliloni
on
Topic category: Help with Minecraft modding (Java Edition)
I am trying to make a ranged mob that will only shoot at its target when it is further away. If the target comes closer, the mob should attack it with a normal melee attack. Is there a way to do this?
(I am willing to code if there is no other option, but I don‘t have any experiece with it, so I would need a detailed explanation).
So you would create a procedure using the on entity tick update trigger, doing something like: If the player exists within a radius of (let's say you want its max shooting range to be 20 blocks) 20. Do- set attack target of entity - server player (or player) and then enable it being able to have a ranged weapon. and then you would create a procedure of: If the player exists within a radius of (let's say you want it to do melee within three blocks), 3. and then you would set its main hand item something like a sword or smth. Idk if that will work. but I'll do some testing (It might take a while cause I'm busy) Tell me if you need any more help. screenshots ect!