Siege of Stonehold, please help me with it

I need help on Siege of Stonehold, please help.
here is my code by the way, it’s in Python

    flag = self.findFlag()
    if flag:
        enemy = self.findNearest(enemy)
    if enemy:
        elif self.isReady("cleave")

thanks if you help me with this and i’m sorry if you have to translate this into JavaScript or whatever

Hello there !

Siege of StoneHold is the first complex level you face ! It’s normal to find it hard. Don’t panic ! It’s ok to be defeated several times before you can find a way to victory !

First of all, I think you changed recently your glasses, because you’re not using them right. Your line :

enemy = self.findNearest(enemy)

is wrong. The "findNearest(units) is expecting an array of units. You can find this array of the enemies by changing this line by these two :

enemies= self.findEnemies()
enemy = self.findNearest(enemies)

What I did the first time I beat this level is to understand one thing :

Your archers are the key ! Protecting them is far better than killing enemies !

There are many ways to protect them. You’ll see the bunch of the soldiers is protecting the north. Try to protect them from the south. Stay close to them and try to take as little damage as possible. Don’t fight if your archers arn’t close to you. Also, try to heal from time to time by going back to the base.

I tried the following code, and I won ! This code is in JavaScript, sorry I never learnt Python and came accross some weird indent bugs when trying to provide a python one. I took your code and added a distance condition, to only attack nearby enemies because I don’t care about northern enemies. All my men died, but I lived and killed the last ogre myself. Took me 3 attempts. Good luck ! Try to code it in Python now !

Oh ! And there are MANY better ways to protect your archers. If you’d like to hear about it, come back in this thread.

    flag = this.findFlag();
    if (flag){
        enemies= this.findEnemies();
        enemy = this.findNearest(enemies);
        if (enemy&&this.distanceTo(enemy)<40){

Here is my stuff :

1 Like

Hi, I saw this topic and I wanted to ask if someone could help me with my code?

while True:
    enemy = hero.findNearestEnemy()
    flag = hero.findFlag
    if enemy and hero.distanceTo(enemy) > 20:
        if hero.isReady("cleave"):
        if not hero.isReady("cleave") and hero.isReady("bash"):
    if flag:
        hero.moveXY(pos.x, pos.y)
        flagpos = flag.pos
        fx = flagpos.x
        fy = flagpos.y
        hero.moveXY(fx, fy)

You made a topic for this. Don’t ask help in several places.

milton.jinich, again, any user can revive “dead” topics as long as it is related.
And yes, please post the same post multiple times in different topics as it clutters up the Discourse