Stuck on Siege of Stonehold - Python


#1

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

#2

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


#3

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.


#4

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

flag = hero.findFlag(“flags color”)


#5

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


#6

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

(Solution removed)


#7

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.


#8

I’m glad I could help!:slightly_smiling_face: