# Level: Peasant Protection

**URL:** <https://discourse.codecombat.com/t/level-peasant-protection/1329>\
**Category:** Adventurer\
**Created:** [November 12, 2014, 8:22pm UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329 "2014-11-12T20:22:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![george](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/george/32/1530_2.png) [@george](https://discourse.codecombat.com/u/george)\
**Post date:** [November 12, 2014, 8:22pm UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329/1 "2014-11-12T20:22:07Z")

</div>

This is a definite step up in complexity from previous levels: we’re asking players to not just access object properties but to do a little comparison and logic based on the result of object property queries. Is this too much too fast? Just right? We’d love to know.

---

<div class="post-metadata">

**Author:** ![Barbarossa](https://avatars.discourse-cdn.com/v4/letter/b/71c47a/32.png) [@Barbarossa](https://discourse.codecombat.com/u/Barbarossa)\
**Post date:** [November 12, 2014, 8:39pm UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329/2 "2014-11-12T20:39:29Z")

</div>

Too much, too… out of no where.

I got started, found myself without findNearest, scratched my head and came here. If there are any clues as to what is to be done I certainly missed them.

---

<div class="post-metadata">

**Author:** ![Barbarossa](https://avatars.discourse-cdn.com/v4/letter/b/71c47a/32.png) [@Barbarossa](https://discourse.codecombat.com/u/Barbarossa)\
**Post date:** [November 12, 2014, 8:46pm UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329/3 "2014-11-12T20:46:55Z")

</div>

And one more thing: now that I wanted to give it another try the start button was grayed out and I had to redo “shield rush” before I could start again. Still no clue how to though ☹

---

<div class="post-metadata">

**Author:** ![kilmiquix](https://avatars.discourse-cdn.com/v4/letter/k/41988e/32.png) [@kilmiquix](https://discourse.codecombat.com/u/kilmiquix)\
**Post date:** [November 13, 2014, 1:07am UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329/4 "2014-11-13T01:07:18Z")

</div>

This one is tough. I admit I’m having trouble here…

---

<div class="post-metadata">

**Author:** ![matt](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@matt](https://discourse.codecombat.com/u/matt)\
**Post date:** [November 13, 2014, 8:20am UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329/5 "2014-11-13T08:20:41Z")

</div>

I think this one looks ok. The initial code that’s there at the start gives a run in to whats needed hopefully. But would be interesting to hear whats tough - is it the returning to the peasant after an attack?

---

<div class="post-metadata">

**Author:** ![iamfritch](https://avatars.discourse-cdn.com/v4/letter/i/f9ae1b/32.png) [@iamfritch](https://discourse.codecombat.com/u/iamfritch)\
**Post date:** [November 13, 2014, 11:45am UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329/6 "2014-11-13T11:45:19Z")

</div>

It is a bit of a jump, but for me it won’t let me equip any glasses for this level. The first glasses you get are restricted and the glasses I got the level just before still say locked. This is not intended, correct?

EDIT:  
Already posted in github [https://github.com/codecombat/codecombat/issues/1746](https://github.com/codecombat/codecombat/issues/1746)  
I’ll be looking there instead.

---

<div class="post-metadata">

**Author:** ![Leslie](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@Leslie](https://discourse.codecombat.com/u/Leslie)\
**Post date:** [November 13, 2014, 10:33pm UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329/7 "2014-11-13T22:33:05Z")

</div>

It’d be good to highlight the new part in this level. As it is not repeated in the next level and needed.

```
loop:
    enemy = self.findNearestEnemy()
    distance = self.distanceTo(enemy.pos)

```

On this level I skimmed over it and just added what was needed but had to come back to it.

---

<div class="post-metadata">

**Author:** ![kilmiquix](https://avatars.discourse-cdn.com/v4/letter/k/41988e/32.png) [@kilmiquix](https://discourse.codecombat.com/u/kilmiquix)\
**Post date:** [November 13, 2014, 11:34pm UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329/8 "2014-11-13T23:34:22Z")

</div>

In retrospect, I think the level is fine. I was just being stupid and forgot that I didn’t need to attack twice since I had a more powerful sword.

Considering I have virtually zero experience with coding, I think the progressive challenge of the game is great!

---

<div class="post-metadata">

**Author:** ![ulrich44](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ulrich44/32/1597_2.png) [@ulrich44](https://discourse.codecombat.com/u/ulrich44)\
**Post date:** [November 14, 2014, 4:51am UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329/9 "2014-11-14T04:51:50Z")

</div>

hello is my first visit in your foum, I glad stay here.

---

<div class="post-metadata">

**Author:** ![malcolm](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/malcolm/32/1587_2.png) [@malcolm](https://discourse.codecombat.com/u/malcolm)\
**Post date:** [November 14, 2014, 6:48am UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329/10 "2014-11-14T06:48:15Z")

</div>

I seem to have the same bug where I can’t get the new glasses to equip.

Do I have to log out and log back in to reset the level, or can I just reload the page?

[edit] when I try to equip the range glasses I get a warning, where it would usually say, “warrior only” with the cryptic message “only” - hope this helps.

---

<div class="post-metadata">

**Author:** ![DollarAkshay](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@DollarAkshay](https://discourse.codecombat.com/u/DollarAkshay)\
**Post date:** [November 14, 2014, 3:58pm UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329/11 "2014-11-14T15:58:07Z")

</div>

Awesome Level 😃 I like it 😃

Its definitley tough compared to the other levels, but if you compare this to the multiplayer levels its nothing.

It definitely a good [level.It](http://level.It) teaches you how to think in a very algorithmic way.

Looking forward to more of such levels.

---

<div class="post-metadata">

**Author:** ![dwhittaker](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/dwhittaker/32/2114_2.png) [@dwhittaker](https://discourse.codecombat.com/u/dwhittaker)\
**Post date:** [November 14, 2014, 4:09pm UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329/12 "2014-11-14T16:09:36Z")

</div>

I had no issues with this one. My son struggled with it on a couple of levels, but the biggest one was realizing the the say commands take time and were slowing things down and causing him to fail. Maybe something in the comments about “instead of talking, maybe I should do something!”

---

<div class="post-metadata">

**Author:** ![Enya](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/enya/32/1621_2.png) [@Enya](https://discourse.codecombat.com/u/Enya)\
**Post date:** [November 14, 2014, 6:22pm UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329/13 "2014-11-14T18:22:56Z")

</div>

I get error “Lin2 : Undefine is not a function” I believe the cause of error is because I cannot equip the glasses causing the code “enemy = self.findNearestEnemy()”. I have both glasses and it say the wooden glasses is restricted. Is there a work around for this? Thanks

---

<div class="post-metadata">

**Author:** ![nick](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/nick/32/784_2.png) [@nick](https://discourse.codecombat.com/u/nick)\
**Post date:** [November 15, 2014, 2:17am UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329/14 "2014-11-15T02:17:45Z")

</div>

Are you sure the wooden glasses are restricted? It should be that the crude glasses are restricted, because you need the wooden ones–so it should be trying to get you to wear the wooden ones. Trying to get to the bottom of the unlocks not working…

---

<div class="post-metadata">

**Author:** ![Enya](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/enya/32/1621_2.png) [@Enya](https://discourse.codecombat.com/u/Enya)\
**Post date:** [November 15, 2014, 4:10pm UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329/15 "2014-11-15T16:10:42Z")

</div>

Please see the pictures I uploaded.  
 ![](https://sea2.discourse-cdn.com/flex016/uploads/codecombat/1600/b8f98576d67312d6.PNG) ![](https://sea2.discourse-cdn.com/flex016/uploads/codecombat/1601/f4e23a7e0157659d.PNG)

---

<div class="post-metadata">

**Author:** ![DollarAkshay](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@DollarAkshay](https://discourse.codecombat.com/u/DollarAkshay)\
**Post date:** [November 15, 2014, 7:25pm UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329/16 "2014-11-15T19:25:30Z")

</div>

@Enya Yes the Crude Glasses(Brown one) are restricted for me too.But I remember in one of the previous levels you unlock the Wooden Glasses(Blue One)

![](https://sea2.discourse-cdn.com/flex016/uploads/codecombat/1602/78eea3abe0b768e5.png)

To unlcok the Wooden Glasses(the one in the above picture) you need to complete one of the previous levels,not sure which one though

---

<div class="post-metadata">

**Author:** ![fjutshaye](https://avatars.discourse-cdn.com/v4/letter/f/ee7513/32.png) [@fjutshaye](https://discourse.codecombat.com/u/fjutshaye)\
**Post date:** [November 16, 2014, 11:59am UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329/17 "2014-11-16T11:59:55Z")

</div>

I confirmed I’ve completed all levels , but it’s useless.The Wooden Glasses is still can’t be equiped .

---

<div class="post-metadata">

**Author:** ![fjutshaye](https://avatars.discourse-cdn.com/v4/letter/f/ee7513/32.png) [@fjutshaye](https://discourse.codecombat.com/u/fjutshaye)\
**Post date:** [November 16, 2014, 12:08pm UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329/18 "2014-11-16T12:08:08Z")

</div>

The Wooden Glasses should have been unlocked after the level “Sheild Rush”,but in the Peasant Protection it’s still in the “LOCKED” list.  
I looked for the Wooden Galsses in Item Shop and I can’t find it.Will that is the problem.  
Picture is uploaded. ![](https://sea2.discourse-cdn.com/flex016/uploads/codecombat/1603/03cbe93e5c262624.png)  
Hope this is helpful.

---

<div class="post-metadata">

**Author:** ![maxyi2013](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@maxyi2013](https://discourse.codecombat.com/u/maxyi2013)\
**Post date:** [November 16, 2014, 12:19pm UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329/19 "2014-11-16T12:19:02Z")

</div>

Hi, have you solved this? I have the same problem. and cannot go ahead.

---

<div class="post-metadata">

**Author:** ![fjutshaye](https://avatars.discourse-cdn.com/v4/letter/f/ee7513/32.png) [@fjutshaye](https://discourse.codecombat.com/u/fjutshaye)\
**Post date:** [November 17, 2014, 4:55am UTC](https://discourse.codecombat.com/t/level-peasant-protection/1329/20 "2014-11-17T04:55:59Z")

</div>

This problem has been sovled !

[Next page](https://discourse.codecombat.com/t/level-peasant-protection/1329.md?page=2)
