[SOLVED] Am stuck at Siege of Stonehold


#1

I’m stuck at this level, even though I have 730 health and a 28 DPS. Please help.
This is my kinda crappy code:

while True:
    enemy = hero.findNearestEnemy()
    flag = hero.findFlag("green")
    if enemy and hero.isReady("cleave"):
        hero.cleave(enemy)
    elif flag:
        hero.moveXY(19, 69)
        hero.moveXY(53, 69)
    elif enemy:
        hero.attack(enemy)

(Python) (has been edited)
Does anyone have a working code I can use or some help for me?


#2

Before any one can help you, you need to format your code properly, otherwise it is all the same line, and you can’t see the indentation. To format your code you should click on the button on the top which looks like this </>. Then this should appear on your screen.
09
copy all your code into where it says, type or paste code here. Otherwise the code is not formatted properly is impossible to read.


#3


#4

Your code,

while True:
    enemy = hero.findNearestEnemy()
    flag = hero.findFlag(“green”)
    if enemy and hero.isReady(“cleave”):
        hero.cleave(enemy)
    elif flag:
        hero.moveXY(19, 69)
        hero.moveXY(53, 69)
    elif enemy:
        hero.attack(enemy)

I think it’s to do with your flags, if you don’t hero.pickUpFlag() in the elif flag: then the flag will stay there and you won’t be able to put down another one. Instead you could use hero.pickUpFlag() and you would remove the flag and move to the location of the flag. Also maybe instead of elif enemy: you could say,

else:
    if enemy:
        hero.attack(enemy)

maybe, I think it goes a bit weird if you have 2 elifs after each other.
Hope this helps :grin:


#5

Thanks, I’m going to try that.


#6

Well I tried it and it worked. Tysm


#7

So it’s solved? (20)


#8

yeah it is solved :slight_smile: