Help with Make Advances

So, I am confused on how to set the varibale advance to work. Can I get some help. I am using Python, Here is my code:

# 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:
            nearest = hero.findNearest(projectile)
            # If the projectile exists
            # AND is closer than 10 meters to the paladin:
            if projectile and paladin:
                
                # Command the friend to "shield":
                hero.command(paladin, "sheild", hero)
            # ELSE, when there is no potential danger:
            else:
                
                # Advance the paladin:
                
            pass
        else:
            # If not a paladin, just advance:
            
        pass
    # Advance the hero in the x direction:
    

I have two blanks still. Because I got confused.

Can I have the link to the level plz?

https://codecombat.com/play/level/make-advances?

I can’t play the level because I am not a subscriber but you need to Advance the paladin or just advance

I am not sure :expressionless: that was helpful

1 Like

Yeah, I know but making the advance is what is confusing me.

hmm… maybe you can try something like

newX = hero.pos.x + 10
newY = hero.pos.y
hero.moveXY(newX, newY)

did that work?(20 chars must burn)

I’m not sure that I will work but gimme a moment.

okay (I hate 20 chars)

Nope, it doesn’t work since it just sends me to my death.

try something like that.

did it work?(20 chars must die)

Under this one

You should put this piece

And under this too you have to use the same code piece

And Paladin is never defined but maybe I just missed something.
So maybe change the “paladin” in:

to friend

1 Like

Okay, so I have this code now.

# 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:
            nearest = hero.findNearest(projectile)
            # If the projectile exists
            # AND is closer than 10 meters to the paladin:
            if projectile and friend:
                
                # Command the friend to "shield":
                hero.command(friend, "sheild", hero)
            # ELSE, when there is no potential danger:
            else:
                
                # Advance the paladin:
                newX = hero.pos.x + 10
                newY = hero.pos.y
                hero.moveXY(newX, newY)
            pass
        else:
            # If not a paladin, just advance:
            newX = hero.pos.x + 10
            newY = hero.pos.y
            hero.moveXY(newX, newY)
        pass
    # Advance the hero in the x direction:
    newX = hero.pos.x + 10
    newY = hero.pos.y
    hero.moveXY(newX, newY)

And I have a error. Here is an screenshot of it.
image

3rd line in this quote. projectile needs to be projectiles

1 Like

My next error is saying "shield" not defined. Should I change that to "defend" ?

Uh… I mean try it? I’ve not passed that level yet so I’m going off what I know about coding but here I’m lost…

1 Like