Return to thornbush Farm. Help! (python)[SOLVED]

I need help with the Return to thornbush Farm. My code isnt working because he thinks that a peasent is an enemy pls help. SOS! btw is python.

1 Like

Please post your code

1 Like

Could you please post your code?

Oh, lol we posted at the same time.

2 Likes

ok. And I didn’t think it would be this quick.

2 Likes
# The function maybeBuildTrap defines TWO parameters!
def maybeBuildTrap(x, y):
    # Use x and y as the coordinates to move to.
    enemy = hero.findNearestEnemy()
    if enemy:
        # Use buildXY to build a "fire-trap" at the given x and y.
        enemy = hero.findNearestEnemy()
        hero.findNearestEnemy()
        hero.buildXY("fire-trap", 43, 50)
        hero.buildXY("fire-trap", 25,34)
        hero.buildXY("fire-trap", 43, 20)
while True:
    # This calls maybeBuildTrap, with the coordinates of the top entrance.
    maybeBuildTrap(43, 50)
    
    # Now use maybeBuildTrap at the left entrance!
    maybeBuildTrap(25, 34)
    # Now use maybeBuildTrap at the bottom entrance!
    maybeBuildTrap(43, 20)

delete this and replace it with hero.buldXY(“fire-trap”, x,y)

3 Likes

ok ill try and c if it works

2 Likes

it says Unterminated

post your code.
2030330

# The function maybeBuildTrap defines TWO parameters!
def maybeBuildTrap(x, y):
    # Use x and y as the coordinates to move to.
    enemy = hero.findNearestEnemy()
    if enemy:
        # Use buildXY to build a "fire-trap" at the given x and y.
        hero.buldXY(“fire-trap”, x,y)
while True:
    # This calls maybeBuildTrap, with the coordinates of the top entrance.
    maybeBuildTrap(43, 50)
    
    # Now use maybeBuildTrap at the left entrance!
    maybeBuildTrap(25, 34)
    # Now use maybeBuildTrap at the bottom entrance!
    maybeBuildTrap(43, 20)

before this line you have to have a hero.moveXY(x,y)

2 Likes

ok giv me a sec 2 type that

I see the problem your quotes are wrong they are supposed to be

hero.buildXY("fire-trap", x, y)
 

try that

2 Likes

Sadly it still didn’t work.

What’s the error/problem?

he still is killing the peasent

1 Like

Peter, can you help him her for a little I need to go eat breakfast.

1 Like

On line 4 try to move to x y, not build the fire trap.

2 Likes