[SOLVED] Backwoods standoff if/else

i run the code and it does everything right until i get to hero.cleave(enemy) it cleaves and then doesn’t go onto the else statement it just waits till cleave is ready again and never goes to else

while True:
    enemy = hero.findNearestEnemy()
    # Use an if-statement with isReady to check "cleave":
    if enemy: 
        ready = hero.isReady("cleave")
        # Cleave! 
    # Else, if cleave is not ready: it never goes to else
        # Attack the nearest ogre!

There’s an issue in your if-condition statement; hero.isReady("cleave") isn’t
in the condition, and the else: should be on the same indentation.

if ready-to-cleave:
then cleave
then attack

So, your code should be something like:

You can also combine the if statement with the isReady in one line.

if hero.isReady("cleave"):
1 Like

thank you so much!!!

1 Like