Sarven Siege help on level 6

I’m having trouble getting the soldier to attack after I summon them. Help please?

while True:
    flag = hero.findFlag()
    enemy = hero.findNearestEnemy()
    if flag:
    if enemy:
        if >= hero.costOf("soldier"):
        enemy = hero.findNearestEnemy()
            if enemy:
                for friend in friends:
                    hero.command(friend, "attack", enemy)

Try that

1 Like

You can just equip the bear trap belt.
Using hero.buildXY("soldier", x, y) can make the soldier has its own AI to attack auto on default.

Just one soldier got built.

Again, only one soldier get ssummoned

That’s probably because the hero would always prioritize attacking enemies before summoning soldiers, try moving the code for summoning to be in front of the attacking code. (and change the attacking code to be an elif instead of if)