Dueling grounds problem

My hero attacks the enemy once and then nothing happens. My code is below and I have two screenshots.

# Defeat the enemy hero in a duel!

while True:
    newPos = hero.pos.y - 10
    # Find and attack the enemy inside a loop.
    # When you're done, submit to the multiplayer ladder!
    enemy = hero.findNearestEnemy()
    if enemy:
    if hero.health < 120 and hero.isReady("phase-shift"):
        hero.moveXY(24, 17)
    if hero.isReady("backstab") and hero.isReady("phase-shift"):
        hero.blink({"x":newPos, "y": newPos})
    if pet.isReady("shape-shift"):
    friends = hero.findFriends()
    if hero.gold > hero.costOf("soldier"):
        for friend in friends:
            if friend.type == "soldier":
                hero.command(friend, "attack", enemy)

Maybe its because you are calling scattershot to attack, is there a cooldown for scattershot?

No there is no cooldown on scatersoot.

Okay, well then maybe try using the attack method instead or use both.

Uhh well it workes. Thanks

Is the Red X under the enemy hero? If so, they have bad code and there is nothing you can do about it. This is a well known problem with the multiplayer levels.

Is this one of the CPU opponents? Try to pick another opponent to fight. Sometimes it will let you, or go to the ladder and select another opponent to fight.

1 Like

I’m fighting real people. And some of them have red X’s but some don’t.

Same situation though. Their code likely used the original “Loop” command before it was changed to the “While True” loop and now it creates a problem with their code. Keep picking new people to fight and eventually you will find some to simulate against. If nothing else, fight against the top players. Their code is obviously proven out and they also have very good code to challenge you to compete against.