# \[Solved\] Last Paladin does not move

**URL:** <https://discourse.codecombat.com/t/solved-last-paladin-does-not-move/25990>\
**Category:** Level Help\
**Created:** [December 10, 2020, 7:27pm UTC](https://discourse.codecombat.com/t/solved-last-paladin-does-not-move/25990 "2020-12-10T19:27:51Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![milton.jinich](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/milton.jinich/32/21419_2.png) [@milton.jinich](https://discourse.codecombat.com/u/milton.jinich)\
**Post date:** [December 10, 2020, 7:27pm UTC](https://discourse.codecombat.com/t/solved-last-paladin-does-not-move/25990/1 "2020-12-10T19:27:51Z")

</div>

Here 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:
        # Find the projectile nearest to the friend:
        projectiles = hero.findEnemyMissiles()
        # If the projectile exists
        # AND is closer than 10 meters to the paladin:
        for projectile in projectiles:
            if friend.type == "paladin":
                if friend.distanceTo(projectile) <= 10:
                    # Command the friend to "shield":
                    hero.command(friend, "shield")
                # ELSE, when there is no potential danger:
                else:
                    # Advance the paladin:
                    hero.command(friend, "move",{'x' : friend.pos.x + 3, 'y' : friend.pos.y})
                if friend.type == "paladin" and friend.health <= 100:
                    if friend.canCast("heal", friend):
                        hero.command(friend, "cast", "heal", friend)
                    else:
                        if friend.health >= 200:
                            
                            hero.command(friend, "move",{'x' : friend.pos.x + 3, 'y' : friend.pos.y})
                    
                
                pass
            else:
                # If not a paladin, just advance:
                hero.command(friend, "move",{'x' : friend.pos.x + 0, 'y' : friend.pos.y})
        
    # Advance the hero in the x direction:
    hero.move({'x':hero.pos.x + 50, 'y':hero.pos.y})```
````

---

<div class="post-metadata">

**Author:** ![milton.jinich](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/milton.jinich/32/21419_2.png) [@milton.jinich](https://discourse.codecombat.com/u/milton.jinich)\
**Post date:** [December 10, 2020, 7:29pm UTC](https://discourse.codecombat.com/t/solved-last-paladin-does-not-move/25990/2 "2020-12-10T19:29:33Z")

</div>

here is a screen shot

 ![Screen Shot 2020-12-10 at 2.29.10 PM](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/5/1/51346b6547f465909529526eb7387680c86284c1.jpeg)

---

<div class="post-metadata">

**Author:** ![Code\_Master](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/code_master/32/16184_2.png) [@Code\_Master](https://discourse.codecombat.com/u/Code_Master)\
**Post date:** [December 10, 2020, 8:01pm UTC](https://discourse.codecombat.com/t/solved-last-paladin-does-not-move/25990/3 "2020-12-10T20:01:45Z")

</div>

Try changing your code into something like this:

```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 == 'paladin':
            # Find the projectile nearest to the friend:
            projectile = friend.findNearestEnemyMissile()
            # If the projectile exists
            # AND is closer than 10 meters to the paladin:
            if projectile and friend.distanceTo(projectile) < 10:
                # shield here
            # ELSE, when there is no potential danger:
            else:
                # Advance the paladin:
                hero.command(friend, "move",{'x' : friend.pos.x + 3, 'y' : friend.pos.y})
                
        else:
            # If not a paladin, just advance:
            # move your other people
        
    # Advance the hero in the x direction:
    hero.move({'x':hero.pos.x + 50, 'y':hero.pos.y})

```

---

<div class="post-metadata">

**Author:** ![milton.jinich](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/milton.jinich/32/21419_2.png) [@milton.jinich](https://discourse.codecombat.com/u/milton.jinich)\
**Post date:** [December 10, 2020, 8:19pm UTC](https://discourse.codecombat.com/t/solved-last-paladin-does-not-move/25990/4 "2020-12-10T20:19:21Z")

</div>

here is my updated version still does not work. the paladins don’t do anything now.

````python
# 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 == 'paladin':
            # Find the projectile nearest to the friend:
            projectile = friend.findNearestEnemyMissile()
            # If the projectile exists
            # AND is closer than 10 meters to the paladin:
            if projectile and friend.distanceTo(projectile) < 10:
                hero.command(friend, "sheild")
            # ELSE, when there is no potential danger:
            else:
                # Advance the paladin:
                hero.command(friend, "move",{'x' : friend.pos.x + 3, 'y' : friend.pos.y})
                
        else:
            # If not a paladin, just advance:
            hero.command(friend, "move", friend.pos.x + 1, friend.pos.y)
        
    # Advance the hero in the x direction:
    hero.move({'x':hero.pos.x + 50, 'y':hero.pos.y})```
````

---

<div class="post-metadata">

**Author:** ![Alexbrand](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@Alexbrand](https://discourse.codecombat.com/u/Alexbrand)\
**Post date:** [December 10, 2020, 8:42pm UTC](https://discourse.codecombat.com/t/solved-last-paladin-does-not-move/25990/5 "2020-12-10T20:42:27Z")

</div>

> [@\[SOLVED\] Help! Make Advances](https://discourse.codecombat.com/t/solved-help-make-advances/25584/18):
>
> I looked other solutions and as far as I see nobody uses default code guideline completely.

Try `hero.moveXY(hero.pos.x + 1, hero.pos.y)`

---

<div class="post-metadata">

**Author:** ![milton.jinich](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/milton.jinich/32/21419_2.png) [@milton.jinich](https://discourse.codecombat.com/u/milton.jinich)\
**Post date:** [December 10, 2020, 9:41pm UTC](https://discourse.codecombat.com/t/solved-last-paladin-does-not-move/25990/7 "2020-12-10T21:41:43Z")

</div>

hey I don’t have Proclamation V so I can’t use vectors

---

<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:** [December 10, 2020, 9:47pm UTC](https://discourse.codecombat.com/t/solved-last-paladin-does-not-move/25990/8 "2020-12-10T21:47:50Z")

</div>

> [@milton.jinich](#):
>
> `hero.command(friend, "sheild")`

You spelled shield wrong in your code, you wrote sheild.

---

<div class="post-metadata">

**Author:** ![Alexbrand](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@Alexbrand](https://discourse.codecombat.com/u/Alexbrand)\
**Post date:** [December 10, 2020, 9:53pm UTC](https://discourse.codecombat.com/t/solved-last-paladin-does-not-move/25990/9 "2020-12-10T21:53:27Z")

</div>

> [@xython](#):
>
> This is one of my most commented levels and solved every time differently

Whoa)

Yep, I like vectors much more than moveXY )

---

<div class="post-metadata">

**Author:** ![milton.jinich](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/milton.jinich/32/21419_2.png) [@milton.jinich](https://discourse.codecombat.com/u/milton.jinich)\
**Post date:** [December 10, 2020, 9:57pm UTC](https://discourse.codecombat.com/t/solved-last-paladin-does-not-move/25990/10 "2020-12-10T21:57:14Z")

</div>

I fixed it. It works now

---

<div class="post-metadata">

**Author:** ![Alexbrand](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@Alexbrand](https://discourse.codecombat.com/u/Alexbrand)\
**Post date:** [December 10, 2020, 9:59pm UTC](https://discourse.codecombat.com/t/solved-last-paladin-does-not-move/25990/11 "2020-12-10T21:59:17Z")

</div>

Cool, cool) Everybody may leave the place)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/a/a9445509d1a758c41b5ddcddc8c8e20a5dedb67f.png) [@system](https://discourse.codecombat.com/u/system)\
**Post date:** [December 11, 2020, 9:59am UTC](https://discourse.codecombat.com/t/solved-last-paladin-does-not-move/25990/12 "2020-12-11T09:59:18Z")

</div>

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
