# \[SOLVED\] Antipodes level help :/ (python)

**URL:** <https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500>\
**Category:** Level Help\
**Created:** [March 30, 2022, 5:46pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500 "2022-03-30T17:46:28Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![rlly\_bad\_at\_this](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rlly_bad_at_this/32/28369_2.png) [@rlly\_bad\_at\_this](https://discourse.codecombat.com/u/rlly_bad_at_this)\
**Post date:** [March 30, 2022, 5:46pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500/1 "2022-03-30T17:46:28Z")

</div>

so ive got the clone part down pat, but im not sure what I need to write for the attack-the-warlock code? i know what i need to do but im not too sure how to do it. neither my hero nor my archers go and attack the warlock, and they just sit there and i run out of time

heres my code (that wont work):

```python
# When all clones disappears, attack the warlock.
enemy = hero.findNearestEnemy()
if enemy:
    if enemy.type == "warlock":
        while enemy.health > 0:
            hero.command(friend, "attack", enemy)
            hero.attack(enemy)

```

---

<div class="post-metadata">

**Author:** ![rlly\_bad\_at\_this](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rlly_bad_at_this/32/28369_2.png) [@rlly\_bad\_at\_this](https://discourse.codecombat.com/u/rlly_bad_at_this)\
**Post date:** [March 30, 2022, 6:08pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500/2 "2022-03-30T18:08:50Z")

</div>

@cheddarcheese i summon you, you’re super smart

---

<div class="post-metadata">

**Author:** ![Lanto](https://avatars.discourse-cdn.com/v4/letter/l/48db29/32.png) [@Lanto](https://discourse.codecombat.com/u/Lanto)\
**Post date:** [March 30, 2022, 6:19pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500/3 "2022-03-30T18:19:37Z")

</div>

1. Not sure but it seems useful if you give us the rest of your code as well, it might seem ‘‘down’’ for you but can still contain problems. You can always delete it later/ask a mod to delete if you think it’s a possible spoiler for other people.
2. Please define what ‘‘wont work’’ means here, does your hero refuse to do anything, does your hero die, there are various scenarios.
3. In case your hero dies because the warlock is too strong (?), maybe see if there are other ways to attack him.

---

<div class="post-metadata">

**Author:** ![Aya](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/aya/32/42680_2.png) [@Aya](https://discourse.codecombat.com/u/Aya)\
**Post date:** [March 30, 2022, 6:30pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500/4 "2022-03-30T18:30:47Z")

</div>

> [@rlly\_bad\_at\_this](#):
>
> ```python
> enemy = hero.findNearestEnemy()
> if enemy:
> if enemy.type == "warlock":
> while enemy.health > 0:
> hero.command(friend, "attack", enemy)
> hero.attack(enemy)
> 
> ```

what you can do before this is wait a few seconds, around: 7 secs and i think it would work, that way, you can be sure that this code runs when all the clones are gone

---

<div class="post-metadata">

**Author:** ![Lanto](https://avatars.discourse-cdn.com/v4/letter/l/48db29/32.png) [@Lanto](https://discourse.codecombat.com/u/Lanto)\
**Post date:** [March 30, 2022, 6:31pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500/5 "2022-03-30T18:31:44Z")

</div>

The other part seems fine, you can delete it if you want.  
I see you are trying to make your archers attack the warlock now, does this solve the level?

---

<div class="post-metadata">

**Author:** ![rlly\_bad\_at\_this](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rlly_bad_at_this/32/28369_2.png) [@rlly\_bad\_at\_this](https://discourse.codecombat.com/u/rlly_bad_at_this)\
**Post date:** [March 30, 2022, 6:33pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500/6 "2022-03-30T18:33:39Z")

</div>

no, i was using the archers in the first place, i had just added my hero in the mix to see if that’d help but it didnt. and @Aya, im not sure what you mean by wait, i havent learned anything about using wait

---

<div class="post-metadata">

**Author:** ![Lanto](https://avatars.discourse-cdn.com/v4/letter/l/48db29/32.png) [@Lanto](https://discourse.codecombat.com/u/Lanto)\
**Post date:** [March 30, 2022, 6:36pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500/7 "2022-03-30T18:36:03Z")

</div>

Are all the archers attacking? Your code seems a bit incomplete

---

<div class="post-metadata">

**Author:** ![rlly\_bad\_at\_this](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rlly_bad_at_this/32/28369_2.png) [@rlly\_bad\_at\_this](https://discourse.codecombat.com/u/rlly_bad_at_this)\
**Post date:** [March 30, 2022, 6:36pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500/8 "2022-03-30T18:36:27Z")

</div>

no, they’re not attacking and everyone just sits there. 😕

---

<div class="post-metadata">

**Author:** ![Lanto](https://avatars.discourse-cdn.com/v4/letter/l/48db29/32.png) [@Lanto](https://discourse.codecombat.com/u/Lanto)\
**Post date:** [March 30, 2022, 6:36pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500/9 "2022-03-30T18:36:56Z")

</div>

Try commanding all of them. I’m not spoiling the code, but you should know from similar levels 🙂

---

<div class="post-metadata">

**Author:** ![rlly\_bad\_at\_this](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rlly_bad_at_this/32/28369_2.png) [@rlly\_bad\_at\_this](https://discourse.codecombat.com/u/rlly_bad_at_this)\
**Post date:** [March 30, 2022, 6:38pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500/10 "2022-03-30T18:38:05Z")

</div>

i thought that’s what i was doing? sorry im a little confused.

---

<div class="post-metadata">

**Author:** ![Lanto](https://avatars.discourse-cdn.com/v4/letter/l/48db29/32.png) [@Lanto](https://discourse.codecombat.com/u/Lanto)\
**Post date:** [March 30, 2022, 6:38pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500/11 "2022-03-30T18:38:59Z")

</div>

In your current code it seems to me like you are not commanding all your archers. There is only a line that states how an individual archer could attack, but none of them is attacking at all

---

<div class="post-metadata">

**Author:** ![rlly\_bad\_at\_this](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rlly_bad_at_this/32/28369_2.png) [@rlly\_bad\_at\_this](https://discourse.codecombat.com/u/rlly_bad_at_this)\
**Post date:** [March 30, 2022, 6:42pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500/12 "2022-03-30T18:42:09Z")

</div>

```python
friends = hero.findFriends()
for friend in friends:
    enemy = friend.findNearestEnemy()
    if enemy:
        if enemy.type == "warlock":
            while enemy.health > 0:
                hero.attack(enemy)
                hero.command(friend, "attack", enemy)

```

is this what you mean? because if so it doesnt work

---

<div class="post-metadata">

**Author:** ![Lanto](https://avatars.discourse-cdn.com/v4/letter/l/48db29/32.png) [@Lanto](https://discourse.codecombat.com/u/Lanto)\
**Post date:** [March 30, 2022, 6:46pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500/13 "2022-03-30T18:46:34Z")

</div>

Try putting the enemy = statement outside of the for loop. With hero. not friend.

---

<div class="post-metadata">

**Author:** ![rlly\_bad\_at\_this](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rlly_bad_at_this/32/28369_2.png) [@rlly\_bad\_at\_this](https://discourse.codecombat.com/u/rlly_bad_at_this)\
**Post date:** [March 30, 2022, 6:48pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500/14 "2022-03-30T18:48:08Z")

</div>

nada 😕 (20 characters)

---

<div class="post-metadata">

**Author:** ![Lanto](https://avatars.discourse-cdn.com/v4/letter/l/48db29/32.png) [@Lanto](https://discourse.codecombat.com/u/Lanto)\
**Post date:** [March 30, 2022, 6:48pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500/15 "2022-03-30T18:48:39Z")

</div>

Try taking the hero.attack(enemy) statement out of the for loop. This might be causing the hero to focus on attacking and not on commanding

---

<div class="post-metadata">

**Author:** ![rlly\_bad\_at\_this](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rlly_bad_at_this/32/28369_2.png) [@rlly\_bad\_at\_this](https://discourse.codecombat.com/u/rlly_bad_at_this)\
**Post date:** [March 30, 2022, 6:49pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500/16 "2022-03-30T18:49:06Z")

</div>

they still just stand there

---

<div class="post-metadata">

**Author:** ![Lanto](https://avatars.discourse-cdn.com/v4/letter/l/48db29/32.png) [@Lanto](https://discourse.codecombat.com/u/Lanto)\
**Post date:** [March 30, 2022, 6:49pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500/17 "2022-03-30T18:49:21Z")

</div>

Please post your latest code

---

<div class="post-metadata">

**Author:** ![rlly\_bad\_at\_this](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/rlly_bad_at_this/32/28369_2.png) [@rlly\_bad\_at\_this](https://discourse.codecombat.com/u/rlly_bad_at_this)\
**Post date:** [March 30, 2022, 6:49pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500/18 "2022-03-30T18:49:41Z")

</div>

sure.

```python
friends = hero.findFriends()
enemy = hero.findNearestEnemy()
for friend in friends:
    if enemy:
        if enemy.type == "warlock":
            while enemy.health > 0:
                hero.command(friend, "attack", enemy)

```

---

<div class="post-metadata">

**Author:** ![Lanto](https://avatars.discourse-cdn.com/v4/letter/l/48db29/32.png) [@Lanto](https://discourse.codecombat.com/u/Lanto)\
**Post date:** [March 30, 2022, 6:50pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500/19 "2022-03-30T18:50:54Z")

</div>

Try putting this particular code you posted in a while loop. I am not sure if that makes a difference, but if it doesn’t, I have another suggestion

---

<div class="post-metadata">

**Author:** ![Aya](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/aya/32/42680_2.png) [@Aya](https://discourse.codecombat.com/u/Aya)\
**Post date:** [March 30, 2022, 6:51pm UTC](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500/20 "2022-03-30T18:51:34Z")

</div>

So about the wait, i dont recall a level where they teach it, but if you have a watch with hero.wait, you can use it this way: `hero.wait(7)` this would make it wait for 7 secs

[Next page](https://discourse.codecombat.com/t/solved-antipodes-level-help-python/32500.md?page=2)
