Hi guys, i'm tryna make RPG mobs: When i hit a mob (zombie) it will check if the player is near or far from the damaged mob. When it checks that, if the attacker is in an area of 5 blocks around victim, it'll be the same thing (the mob hits the attacker) but, if the player is 5 blocks far from the victim, the mob's target will be cleared.
Let me know if you did understand it, Thank you!
no errors, neither in console. Just the mob doesn't work as i would like to.
Let me know if you did understand it, Thank you!
Code:
on entity target:
if event-entity is zombie:
cancel event
on damage:
if victim = zombie:
if attacker = player:
if victim is alive:
loop 1000 times:
loop all entities in radius 5 around victim:
if attacker is loop-entity:
set victim's target to attacker
if attacker isn't loop-entity:
clear victim's target
no errors, neither in console. Just the mob doesn't work as i would like to.