[Solved] Help Needed with Siege of Stonehold

This is my code:
while True:
enemy = self.findNearestEnemy()
flag = self.findFlag(“green”)
if flag:
self.pickUpFlag(flag)
elif enemy:
if self.isReady(“cleave”):
self.cleave(enemy)
else:
self.attack(enemy)
But for some reason, it doesn’t work

Could you pls format your code with 3 backticks

I fixed it, it was just where i was placing my flag

1 Like

Oh i got the problem . You have to say if enemy: then attack.

Actually when all of the enemies are dead you will get a problem or if there are no enemy’s @Garv_Jain

In the else loop you have to put an if enemy:
then you have to put under it hero.attack(enemy)