# Dueling grounds problem

**URL:** <https://discourse.codecombat.com/t/dueling-grounds-problem/25623>\
**Category:** Bugs\
**Created:** [November 22, 2020, 11:59pm UTC](https://discourse.codecombat.com/t/dueling-grounds-problem/25623 "2020-11-22T23:59:09Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Tang](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/eric_tang/32/15310_2.png) [@Eric\_Tang](https://discourse.codecombat.com/u/Eric_Tang)\
**Post date:** [November 22, 2020, 11:59pm UTC](https://discourse.codecombat.com/t/dueling-grounds-problem/25623/1 "2020-11-22T23:59:09Z")

</div>

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

 ![2020-11-22-165649_1680x1050_scrot](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/5/2/52e7d36f99932027ae7ad51a03457617edc9a763.jpeg)  
 ![2020-11-22-165552_1680x1050_scrot](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/6/7/679d3acebba7d7fb7a46c9654db0064d88f5c625.png)

```python
# 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:
        hero.scattershot(enemy)
    if hero.health < 120 and hero.isReady("phase-shift"):
        hero.phaseShift()
        hero.moveXY(24, 17)
        hero.scattershot(enemy)
    if hero.isReady("backstab") and hero.isReady("phase-shift"):
        hero.phaseShift()
        hero.move(enemy.pos)
        hero.backstab(enemy)
        hero.blink({"x":newPos, "y": newPos})
    if pet.isReady("shape-shift"):
        pet.shapeShift()
    friends = hero.findFriends()
    if hero.gold > hero.costOf("soldier"):
        hero.summon("soldier")
        for friend in friends:
            if friend.type == "soldier":
                hero.command(friend, "attack", enemy)

```

---

<div class="post-metadata">

**Author:** ![abc](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@abc](https://discourse.codecombat.com/u/abc)\
**Post date:** [November 23, 2020, 12:38am UTC](https://discourse.codecombat.com/t/dueling-grounds-problem/25623/2 "2020-11-23T00:38:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Eric\_Tang](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/eric_tang/32/15310_2.png) [@Eric\_Tang](https://discourse.codecombat.com/u/Eric_Tang)\
**Post date:** [November 23, 2020, 12:38am UTC](https://discourse.codecombat.com/t/dueling-grounds-problem/25623/3 "2020-11-23T00:38:43Z")

</div>

No there is no cooldown on scatersoot.

---

<div class="post-metadata">

**Author:** ![abc](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@abc](https://discourse.codecombat.com/u/abc)\
**Post date:** [November 23, 2020, 12:39am UTC](https://discourse.codecombat.com/t/dueling-grounds-problem/25623/4 "2020-11-23T00:39:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Eric\_Tang](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/eric_tang/32/15310_2.png) [@Eric\_Tang](https://discourse.codecombat.com/u/Eric_Tang)\
**Post date:** [November 23, 2020, 12:44am UTC](https://discourse.codecombat.com/t/dueling-grounds-problem/25623/5 "2020-11-23T00:44:35Z")

</div>

Uhh well it workes. Thanks

---

<div class="post-metadata">

**Author:** ![brooksy125](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/brooksy125/32/9966_2.png) [@brooksy125](https://discourse.codecombat.com/u/brooksy125)\
**Post date:** [November 23, 2020, 12:44am UTC](https://discourse.codecombat.com/t/dueling-grounds-problem/25623/6 "2020-11-23T00:44:57Z")

</div>

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.

> [@'loop' breaks multiplayer code](https://discourse.codecombat.com/t/loop-breaks-multiplayer-code/17353/13):
>
> @Chaboi_3000 Who can change the Simple, Easy, Hard code selections when starting out in the Multiplayer? When playing Blue in Harrowland, the Simple CPU code locks your code up and you can’t complete the level. Even when playing red, the enemy code doesn’t work, but you don’t get locked up. Below is a post with a video showing the code being locked up when playing as Blue. I switched the opponent to the Easy enemy and it worked.

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.

---

<div class="post-metadata">

**Author:** ![Eric\_Tang](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/eric_tang/32/15310_2.png) [@Eric\_Tang](https://discourse.codecombat.com/u/Eric_Tang)\
**Post date:** [November 23, 2020, 12:45am UTC](https://discourse.codecombat.com/t/dueling-grounds-problem/25623/7 "2020-11-23T00:45:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![brooksy125](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/brooksy125/32/9966_2.png) [@brooksy125](https://discourse.codecombat.com/u/brooksy125)\
**Post date:** [November 23, 2020, 12:49am UTC](https://discourse.codecombat.com/t/dueling-grounds-problem/25623/8 "2020-11-23T00:49:29Z")

</div>

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.
