loop:
enemy = self.findNearestEnemy()
distance = self.distanceTo(enemy)
if self.isReady("cleave"):
if distance < 10:
self.cleave(enemy)
else:
self.attack(enemy)
And why this error: distanceTo target is null. Does the target exist?(Use if?)
If this code is correct:
loop:
enemy = self.findNearestEnemy()
distance = self.distanceTo(enemy)
if distance < 10:
# Attack if they get too close to the peasant.
self.attack(enemy)
else:
self.moveXY(40, 37)
place three ` characters (on keyboard next to 1) on a line of it’s own both before and after your pasted code for formatting so people can read it here.