# Sarven road help please

**URL:** <https://discourse.codecombat.com/t/sarven-road-help-please/15330>\
**Category:** Level Help\
**Created:** [July 25, 2018, 10:04pm UTC](https://discourse.codecombat.com/t/sarven-road-help-please/15330 "2018-07-25T22:04:45Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Torazo\_TOKUDA](https://avatars.discourse-cdn.com/v4/letter/t/8797f3/32.png) [@Torazo\_TOKUDA](https://discourse.codecombat.com/u/Torazo_TOKUDA)\
**Post date:** [July 25, 2018, 10:04pm UTC](https://discourse.codecombat.com/t/sarven-road-help-please/15330/1 "2018-07-25T22:04:45Z")

</div>

this is my code

```python
# 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

---

<div class="post-metadata">

**Author:** ![Archion](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/archion/32/26234_2.png) [@Archion](https://discourse.codecombat.com/u/Archion)\
**Post date:** [July 25, 2018, 10:09pm UTC](https://discourse.codecombat.com/t/sarven-road-help-please/15330/2 "2018-07-25T22:09:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Torazo\_TOKUDA](https://avatars.discourse-cdn.com/v4/letter/t/8797f3/32.png) [@Torazo\_TOKUDA](https://discourse.codecombat.com/u/Torazo_TOKUDA)\
**Post date:** [July 25, 2018, 10:16pm UTC](https://discourse.codecombat.com/t/sarven-road-help-please/15330/3 "2018-07-25T22:16:37Z")

</div>

now my hero attacks the munchkins but does not move

---

<div class="post-metadata">

**Author:** ![Chaboi\_3000](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chaboi_3000/32/48486_2.png) [@Chaboi\_3000](https://discourse.codecombat.com/u/Chaboi_3000)\
**Post date:** [July 25, 2018, 10:28pm UTC](https://discourse.codecombat.com/t/sarven-road-help-please/15330/4 "2018-07-25T22:28:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Archion](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/archion/32/26234_2.png) [@Archion](https://discourse.codecombat.com/u/Archion)\
**Post date:** [July 25, 2018, 10:29pm UTC](https://discourse.codecombat.com/t/sarven-road-help-please/15330/5 "2018-07-25T22:29:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Torazo\_TOKUDA](https://avatars.discourse-cdn.com/v4/letter/t/8797f3/32.png) [@Torazo\_TOKUDA](https://discourse.codecombat.com/u/Torazo_TOKUDA)\
**Post date:** [July 26, 2018, 9:28pm UTC](https://discourse.codecombat.com/t/sarven-road-help-please/15330/6 "2018-07-26T21:28:09Z")

</div>

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:

```python
# 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

```

---

<div class="post-metadata">

**Author:** ![Torazo\_TOKUDA](https://avatars.discourse-cdn.com/v4/letter/t/8797f3/32.png) [@Torazo\_TOKUDA](https://discourse.codecombat.com/u/Torazo_TOKUDA)\
**Post date:** [July 26, 2018, 9:47pm UTC](https://discourse.codecombat.com/t/sarven-road-help-please/15330/7 "2018-07-26T21:47:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Archion](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/archion/32/26234_2.png) [@Archion](https://discourse.codecombat.com/u/Archion)\
**Post date:** [July 26, 2018, 10:33pm UTC](https://discourse.codecombat.com/t/sarven-road-help-please/15330/8 "2018-07-26T22:33:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)\
**Post date:** [July 27, 2018, 8:08am UTC](https://discourse.codecombat.com/t/sarven-road-help-please/15330/9 "2018-07-27T08:08:50Z")

</div>

Have you completed the level with the RuneSword?

---

<div class="post-metadata">

**Author:** ![SuperSmacker](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/supersmacker/32/8385_2.png) [@SuperSmacker](https://discourse.codecombat.com/u/SuperSmacker)\
**Post date:** [July 27, 2018, 6:10pm UTC](https://discourse.codecombat.com/t/sarven-road-help-please/15330/10 "2018-07-27T18:10:18Z")

</div>

He did. Read his post.

---

<div class="post-metadata">

**Author:** ![1styoutuber](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/1styoutuber/32/12548_2.png) [@1styoutuber](https://discourse.codecombat.com/u/1styoutuber)\
**Post date:** [June 8, 2020, 10:41pm UTC](https://discourse.codecombat.com/t/sarven-road-help-please/15330/11 "2020-06-08T22:41:19Z")

</div>

I need help with my code this is it:

```python
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:

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

---

<div class="post-metadata">

**Author:** ![1styoutuber](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/1styoutuber/32/12548_2.png) [@1styoutuber](https://discourse.codecombat.com/u/1styoutuber)\
**Post date:** [June 8, 2020, 10:53pm UTC](https://discourse.codecombat.com/t/sarven-road-help-please/15330/12 "2020-06-08T22:53:32Z")

</div>

nevermind I figure it out

---

<div class="post-metadata">

**Author:** ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)\
**Post date:** [June 9, 2020, 7:58am UTC](https://discourse.codecombat.com/t/sarven-road-help-please/15330/13 "2020-06-09T07:58:29Z")

</div>

A post was merged into an existing topic: [General Off-Topic](https://discourse.codecombat.com/t/general-off-topic/21928/45)

---

<div class="post-metadata">

**Author:** ![Asher\_Tu](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/asher_tu/32/12894_2.png) [@Asher\_Tu](https://discourse.codecombat.com/u/Asher_Tu)\
**Post date:** [June 23, 2020, 11:01am UTC](https://discourse.codecombat.com/t/sarven-road-help-please/15330/14 "2020-06-23T11:01:57Z")

</div>

Mod edit: complete solution removed.

---

<div class="post-metadata">

**Author:** ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)\
**Post date:** [June 23, 2020, 11:09am UTC](https://discourse.codecombat.com/t/sarven-road-help-please/15330/16 "2020-06-23T11:09:57Z")

</div>

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
