Stuck on Siege of Stonehold - Python

Hey,

My hero doesn’t move when I place a flag, is there something wrong with my code?

flag = hero.findFlag()
enemy = hero.findNearestEnemy()

if flag:
    hero.pickUpFlag(flag)
elif enemy:
    if hero.isReady("cleave"):
        hero.cleave(enemy)
    else:
        hero.attack(enemy)
        pass

Do you have a while-True loop around your code?

You have to define what type of flag that is. You have to say: flag = hero.findFlag("some kind of color"). The colors could be green, purple, or black.

You have to define the flag so use before hero.pickUpFlag(flag):

flag = hero.findFlag(“flags color”)

Tell me if you got it, if not let me know.:hugs:

Thanks guys I did all of the suggestions and it seemed to work

(Solution removed)

It’s great that you finished the level but please don’t post finished code or final solutions. The purpose of this board is to help people figure out the solutions themselves so they can learn. Simply providing solutions/code is counterproductive to the main goal. Thank you.

I’m glad I could help!:slightly_smiling_face:

1 Like