Savern brawl help with code

Hi everyone, can’t figure why my hero cleaves but then doesn’t seem to attack inbetween…i’m sures there’s a problem with my if statements but can’t see it

self.wait(1)

loop:

flag = self.findFlag()
enemy = self.findNearest(self.findEnemies())
if flag:
    self.pickUpFlag(flag)
    
    pass

elif enemy:
     if self.distanceTo(enemy)<7:
        if self.isReady("cleave"):
         self.cleave(enemy)
    else:
        self.attack(enemy)  

Thanks in advance for all your help

It depends on what you’re trying to do with your code.

I’m assuming you want your character to go after enemies less than 7 distance away, then attack, using cleave when possible.

To do that, you need to nest the ‘else’ along with the regular attack on the same level as ‘if self.isReady()’ so that he attacks normally when he cannot use cleave.

Thanks Zuf,

I knew it was something that was staring me in the face but couldn’t put my finger on it…doh!!!