Village warder HELP!

This function attacks the nearest enemy.

def findAndAttackEnemy():
enemy = hero.findNearestEnemy()
if enemy:
hero.attack(enemy)

def findAndCleaveEnemy():
# Define a function to cleave enemies (but only when the ability is ready).
enemy = hero.findNearestEnemy()
if enemy:
hero.cleave(enemy)
pass

In your main loop, patrol, cleave, and attack.

while True:
# Move to the patrol point, cleave, and attack.
hero.moveXY(35, 34)
findAndCleaveEnemy()
findAndAttackEnemy()
# Move to the other point, cleave, and attack.
hero.moveXY(60, 31)
findAndCleaveEnemy()
findAndAttackEnemy()

what have i done wrong
thanks

Use cleave only when it ready as requested
hero.isReady(action) from wristwatch
Guide for isReady
without checking if cleave ready or not the hero will try to do “cleave” over and over and over

thank you for the feedback

When is says “while true”, this is a boolean that will execute the code inside the {} when ‘True’.

In this case on this level, I don’t know what has to be ‘True’ for it to execute. When I read ‘while true’, I say to myself, ‘while what’s true?’.

Can someone tell me what has to be ‘true’ in this case?

Usually, it’s while the conditional statements like, if enemy, are true. In this case it applies to while the hero is able to moveXY to the two assigned positions.