Sarven road help please

this is my code

# Get to the oasis. Watch out for new enemies: ogre scouts!
# Go up and right by adding to the current X and Y position.
enemy = hero.findNearestEnemy()
xPos = 10
yPos = 14
while True:
    # If there's an enemy, attack.
    if enemy:
        hero.attack(enemy)
        # Else, keep moving up and to the right. 
    else:
        hero.moveXY(xPos + 3, yPos + 3)
        pass

It does not attack munchkins and not moving great

you have to put the xPos and yPos and findNearest enemy in the while loop so it continuasly finds enemies and other stuff

now my hero attacks the munchkins but does not move

Increment the XPos and the YPos so it adds after each loop, then tell the hero to move to the new incremented position

Instead of xPos and Ypos put hero.pos.x + 3 and hero.pos.y +3 its the same thing

I think that helps a lot but my code doesn’t change or its I don’t understand the meanings of what you’re saying.
Here is my code:

# Get to the oasis. Watch out for new enemies: ogre scouts!
# Go up and right by adding to the current X and Y position.
while True:
    enemy = hero.findNearestEnemy()
    xPos = 10
    yPos = 14
    # If there's an enemy, attack.
    if enemy:
        hero.attack(enemy)
        # Else, keep moving up and to the right. 
    else:
        hero.pos.y + 3
        hero.pos.x + 3
        pass

oh wait I got a totally different code and it could not do it so I just bought the runesword and did it

I meant like moveXY(hero.pos.x+3, hero.pos.y)

1 Like

Have you completed the level with the RuneSword?

He did. Read his post.

I need help with my code this is it:

enemy = hero.findNearestEnemy()
hero.pos + 3
hero.pos + 3
while True:
    # If there's an enemy, attack.
    if enemy.type == "Ogre scout":
        hero.attack(enemy)
        hero.attack(enemy)
        hero.attack(enemy)
    if hero.isReady("cleave"):
        hero.cleave(enemy)
        # Else, keep moving up and to the right. 
    else:
        hero.moveXY(hero.pos.x + 3, hero.pos.y + 3)
        pass

it says cant read the property of type:

nevermind I figure it out

A post was merged into an existing topic: General Off-Topic

Mod edit: complete solution removed.

Hi @Asher_Tu, thanks for posting your code, but posting complete solutions is not permitted. If your code doesn’t work it will be a hero/equipment problem. If so please post a screenshot of the level and equipment screens.
I will hide the solution so that other people can’t use it.
Thanks,
Danny

1 Like