Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Need help with Siege of Stonehold


Okay, so I’ve been trying to get this hero to attack, but he just sits there… the only part that’s working in my code is the moveXY… UGH

# Help your friends beat the minions that Thoktar sends against you.
# You'll need great equipment and strategy to win.
# Flags might help, but it's up to you–be creative!
# There is a doctor behind the fence. Move to the X to get healed!
enemy = hero.findNearestEnemy()
flag = hero.findFlag()

if < 100:
    hero.moveXY(19, 69)
if enemy:
    if hero.isReady("cleave") and hero.distanceTo(enemy) < 5:
if enemy:
if flag:


Please format this by editing your post, then highlighting the text and clicking the </> button. I believe this is an indentation error. Also, as the level said, make sure you have the right sword to cleave and solid armor.


By any chance does your hero walk to an enemy and hit them once? You code doesnt use a loop this this should only be happening one time.

If your hero isnt walking over to attack an enemy then chances are the else statement that tells your hero to move is being executed because the enemy variable isnt holding an enemy. I dont know what type of gear you have. I would guess maybe your glasses cant see far enough.


Alright I found 2 Things Kinda Interesting:

  1. You wrote if enemy, then cleave and then another if statement stating if enemy, attack “enemy”. However, this “enemy” may have already died to the cleave earlier so there are two solutions. Redefine the variable enemy. That way, if the enemy is dead, the hero will find a new enemy. If it is the same enemy, nothing will change because it will still be the nearest enemy.

  2. Make sure you try looping your code as @Ty_Ler said. Instead of using moveXY, use the move function which will find the best possible route and allows you to calculate variables inbetween (From what I’ve heard)