Backwoods Standoff issue

I Can’t get my code to work in Backwoods Standoff. My hero Alejandro cleaves when he’s supposed to, but refuses to attack.

Please post your code and welcome.

1 Like

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

Format your code with </> button.

This is not the way to cleave. You need to check if your hero is ready to cleave, if he is, cleave. Otherwise, you need to attack the enemy.

if enemy:
    if hero.isReady("cleave"):
        #cleave
    else:
        #attack

that didn’t help, thanks for trying

What’s your code right now?

it’s at the top of convo

It looks like your code’s problem is that while it does check whether cleave is ready, that’s not a factor as to whether or not you cleave

how do i fix that? I am just starting out

You’ll need to write an if statement checking whether cleave is ready, then cleave if it is.

That worked thank you!

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.