# Siege of stokehold won't work

**URL:** <https://discourse.codecombat.com/t/siege-of-stokehold-wont-work/19474>\
**Category:** Level Help\
**Created:** [October 28, 2019, 6:29pm UTC](https://discourse.codecombat.com/t/siege-of-stokehold-wont-work/19474 "2019-10-28T18:29:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raven](https://avatars.discourse-cdn.com/v4/letter/r/9fc348/32.png) [@Raven](https://discourse.codecombat.com/u/Raven)\
**Post date:** [October 28, 2019, 6:29pm UTC](https://discourse.codecombat.com/t/siege-of-stokehold-wont-work/19474/1 "2019-10-28T18:29:02Z")

</div>

I am at siege of stokehold and My character won’t move to pick up flags or anything. I’m not subscribed, am a beginner to code. I’m learning Python.

Here’s my code:  
’ ’ ’  
enemy= hero.findNearestEnemy()  
flag=hero.findFlag()  
green= hero.findFlag(‘green’)  
black= hero.findFlag(‘black’)  
while True:

```
if flag:
    if flag.color is 'green':
        hero.moveXY(19, 69)
    elif flag.color is "black":
        hero.move(flag.pos.x, flag.pos.y)
        hero.pickUpFlag(black)
        hero.attack(enemy)
    else:
        if hero.isReady('cleave'):
            hero.cleave(enemy)
        else:
            hero.attack(enemy)

```

’ ’ ’  
Thanks for the help,  
Raven

---

<div class="post-metadata">

**Author:** ![CODEBOY2](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/codeboy2/32/13507_2.png) [@CODEBOY2](https://discourse.codecombat.com/u/CODEBOY2)\
**Post date:** [October 28, 2019, 6:33pm UTC](https://discourse.codecombat.com/t/siege-of-stokehold-wont-work/19474/2 "2019-10-28T18:33:14Z")

</div>

please format your code good so we can see your problem

> [@\[Essentials\] How To Post/Format Your Code Correctly](https://discourse.codecombat.com/t/essentials-how-to-post-format-your-code-correctly/15521):
>
> Formatting your code before posting code is essential to our community, and if you don’t we might not be able to help frowning Everyone must know how to format ALL of your code properly. It’s really easy and only requires a very small amount of effort. To post your code from the game , use the \</\> button or it won’t format properly. When you click the \</\> button, the following will appear: Please paste ALL …

---

<div class="post-metadata">

**Author:** ![pa\_ki](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/pa_ki/32/10821_2.png) [@pa\_ki](https://discourse.codecombat.com/u/pa_ki)\
**Post date:** [October 28, 2019, 8:32pm UTC](https://discourse.codecombat.com/t/siege-of-stokehold-wont-work/19474/3 "2019-10-28T20:32:41Z")

</div>

in

```python
   elif flag.color is "black":
        hero.move(flag.pos.x, flag.pos.y)
        hero.pickUpFlag(black)
        hero.attack(enemy)

```

hero.attack(enemy)  
use an if-statement  
(like if enemy and flag)
