# \[SOLVED\] Make Advances

**URL:** <https://discourse.codecombat.com/t/solved-make-advances/24799>\
**Category:** Level Help\
**Created:** [October 15, 2020, 9:10pm UTC](https://discourse.codecombat.com/t/solved-make-advances/24799 "2020-10-15T21:10:40Z")\
**Posts on this page:** 17\
**Page:** 1

<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:** [October 15, 2020, 9:10pm UTC](https://discourse.codecombat.com/t/solved-make-advances/24799/1 "2020-10-15T21:10:40Z")

</div>

Everything goes fine until the end. My last paladin just stops, and the archers move on and die, how do I make make my paladin move to the very end? Here is what happens:  
 ![Screenshot 2020-10-15 at 4.59.14 PM](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/5/59d82bcd2fb8892dd4d876fd1cdb684d950fa7ed.png)

 ![Screenshot 2020-10-15 at 4.59.34 PM](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/8/809225a15b285dd68aea1f1376cd4ce4af4c495b.png)  
This is my code:

```python
# Advance through the forgotten tomb.
# Be wary, traps lay in wait to ruin your day!

# The Paladins volunteer to lead the way.
# Command them to shield against incoming projectiles.
while True:
    friends = hero.findFriends()
    # findEnemyMissiles finds all dangerous projectiles.
    projectiles = hero.findEnemyMissiles()
    for friend in friends:
        if friend.type is "paladin":
            # Find the projectile nearest to the friend:
            for projectile in projectiles:
                distance = friend.distanceTo(projectile)
                # If the projectile exists
                # AND is closer than 10 meters to the paladin:
                if projectile and distance < 10:
                    # Command the friend to "shield":
                    hero.command(friend, "shield", friend)
                # ELSE, when there is no potential danger:
                else:
                    # Advance the paladin:
                    hero.command(friend, "move", {"x": friend.pos.x + 50, "y": friend.pos.y})
            pass
        else:
            # If not a paladin, just advance:
            hero.command(friend, "move", {"x": friend.pos.x + 20, "y": friend.pos.y})
        pass
    # Advance the hero in the x direction:
    hero.moveXY(hero.pos.x + 10, hero.pos.y)

```

---

<div class="post-metadata">

**Author:** ![Lydia\_Song](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/lydia_song/32/31461_2.png) [@Lydia\_Song](https://discourse.codecombat.com/u/Lydia_Song)\
**Post date:** [October 16, 2020, 2:42am UTC](https://discourse.codecombat.com/t/solved-make-advances/24799/2 "2020-10-16T02:42:17Z")

</div>

Is this past mountain? If so, I cannot help you, sorry ☹  
Lydia

---

<div class="post-metadata">

**Author:** ![ineedhelpwithcoding](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ineedhelpwithcoding/32/30168_2.png) [@ineedhelpwithcoding](https://discourse.codecombat.com/u/ineedhelpwithcoding)\
**Post date:** [October 16, 2020, 5:49am UTC](https://discourse.codecombat.com/t/solved-make-advances/24799/3 "2020-10-16T05:49:45Z")

</div>

i’m pretty sure this is the link @Lydia_Song [https://codecombat.com/play/level/make-advances](https://codecombat.com/play/level/make-advances)

---

<div class="post-metadata">

**Author:** ![ineedhelpwithcoding](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ineedhelpwithcoding/32/30168_2.png) [@ineedhelpwithcoding](https://discourse.codecombat.com/u/ineedhelpwithcoding)\
**Post date:** [October 16, 2020, 5:52am UTC](https://discourse.codecombat.com/t/solved-make-advances/24799/4 "2020-10-16T05:52:25Z")

</div>

> [@abc](#):
>
> ![Screenshot 2020-10-15 at 4.59.14 PM](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/5/59d82bcd2fb8892dd4d876fd1cdb684d950fa7ed.png)
> 
> ![Screenshot 2020-10-15 at 4.59.34 PM](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/8/809225a15b285dd68aea1f1376cd4ce4af4c495b.png)

weird because for me it says paladins go and attack starting from the left and going to the right

---

<div class="post-metadata">

**Author:** ![ineedhelpwithcoding](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ineedhelpwithcoding/32/30168_2.png) [@ineedhelpwithcoding](https://discourse.codecombat.com/u/ineedhelpwithcoding)\
**Post date:** [October 16, 2020, 5:56am UTC](https://discourse.codecombat.com/t/solved-make-advances/24799/5 "2020-10-16T05:56:41Z")

</div>

here is where it is located and its not passed mountain

 ![image](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/f/f3963bc447440729749a9b888238ea5cf7cab672.jpeg)

---

<div class="post-metadata">

**Author:** ![jka2706](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/jka2706/32/13636_2.png) [@jka2706](https://discourse.codecombat.com/u/jka2706)\
**Post date:** [October 16, 2020, 9:37am UTC](https://discourse.codecombat.com/t/solved-make-advances/24799/6 "2020-10-16T09:37:54Z")

</div>

Hi abc,

Instead of:

> [@abc](#):
>
> ```python
> # Find the projectile nearest to the friend:
> for projectile in projectiles:
> 
> ```

just use:

```python
            var projectile = friend.findNearest(projectiles);

```

I also made the friends stay just behind their nearest paladin (otherwise they ran ahead and got killed). And I also put a paladin heal function in, and I had to play around with the distance that the paladins and the hero moved each time to make it work.

Jenny

---

<div class="post-metadata">

**Author:** ![Lydia\_Song](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/lydia_song/32/31461_2.png) [@Lydia\_Song](https://discourse.codecombat.com/u/Lydia_Song)\
**Post date:** [October 16, 2020, 2:34pm UTC](https://discourse.codecombat.com/t/solved-make-advances/24799/7 "2020-10-16T14:34:09Z")

</div>

He is in Python, not JavaScript Jenny.  
So it would be

```python
projectile = friend.findNearest(hero.findEnemyMissiles())

```

If I’m not mistaken.  
Lydia

---

<div class="post-metadata">

**Author:** ![jka2706](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/jka2706/32/13636_2.png) [@jka2706](https://discourse.codecombat.com/u/jka2706)\
**Post date:** [October 16, 2020, 3:04pm UTC](https://discourse.codecombat.com/t/solved-make-advances/24799/8 "2020-10-16T15:04:21Z")

</div>

Good point, thanks Lydia 😁

---

<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:** [October 16, 2020, 4:55pm UTC](https://discourse.codecombat.com/t/solved-make-advances/24799/9 "2020-10-16T16:55:28Z")

</div>

> [@jka2706](#):
>
> I also made the friends stay just behind their nearest paladin (otherwise they ran ahead and got killed).

If I command the archers to stay back, they survive, but my last paladin stops and lets himself be killed by a fireball

---

<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:** [October 16, 2020, 8:58pm UTC](https://discourse.codecombat.com/t/solved-make-advances/24799/10 "2020-10-16T20:58:32Z")

</div>

The problem here is my bottom paladin, no matter what I do, he always just stops short.

---

<div class="post-metadata">

**Author:** ![ineedhelpwithcoding](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ineedhelpwithcoding/32/30168_2.png) [@ineedhelpwithcoding](https://discourse.codecombat.com/u/ineedhelpwithcoding)\
**Post date:** [October 22, 2020, 5:38am UTC](https://discourse.codecombat.com/t/solved-make-advances/24799/11 "2020-10-22T05:38:23Z")

</div>

is your code still the same??  
edit: sorry i cannot help you as when i use your code the problem is different to yours

---

<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:** [October 26, 2020, 9:44pm UTC](https://discourse.codecombat.com/t/solved-make-advances/24799/12 "2020-10-26T21:44:00Z")

</div>

I tried doing that, but then I only disable my middle trap. My paladins all go for their targets, but my top one doesn’t make it to it’s target because my bottom paladin dies first. I don’t know why, but it keeps killing my bottom paladin.

---

<div class="post-metadata">

**Author:** ![Lydia\_Song](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/lydia_song/32/31461_2.png) [@Lydia\_Song](https://discourse.codecombat.com/u/Lydia_Song)\
**Post date:** [October 26, 2020, 9:55pm UTC](https://discourse.codecombat.com/t/solved-make-advances/24799/13 "2020-10-26T21:55:14Z")

</div>

Unfortunately, I can’t help you, because I haven’t passed the level myself!  
Lydia

---

<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:** [October 26, 2020, 10:00pm UTC](https://discourse.codecombat.com/t/solved-make-advances/24799/14 "2020-10-26T22:00:59Z")

</div>

That’s okay. Now my top paladin is stuck

---

<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:** [October 26, 2020, 10:17pm UTC](https://discourse.codecombat.com/t/solved-make-advances/24799/15 "2020-10-26T22:17:00Z")

</div>

I finally solved it!

---

<div class="post-metadata">

**Author:** ![Lydia\_Song](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/lydia_song/32/31461_2.png) [@Lydia\_Song](https://discourse.codecombat.com/u/Lydia_Song)\
**Post date:** [October 26, 2020, 10:19pm UTC](https://discourse.codecombat.com/t/solved-make-advances/24799/16 "2020-10-26T22:19:21Z")

</div>

Congrats! Altough I did absolutely nothing . . . 😅  
Lydia

---

<div class="post-metadata">

**Author:** ![ineedhelpwithcoding](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ineedhelpwithcoding/32/30168_2.png) [@ineedhelpwithcoding](https://discourse.codecombat.com/u/ineedhelpwithcoding)\
**Post date:** [October 27, 2020, 5:22am UTC](https://discourse.codecombat.com/t/solved-make-advances/24799/17 "2020-10-27T05:22:18Z")

</div>

tick the box which helped you the most(even thought you just solved it yourself 🤣)
