# How to build a decoy - Decoy Drill

**URL:** <https://discourse.codecombat.com/t/how-to-build-a-decoy-decoy-drill/2078>\
**Category:** Level Help\
**Created:** [December 25, 2014, 2:11am UTC](https://discourse.codecombat.com/t/how-to-build-a-decoy-decoy-drill/2078 "2014-12-25T02:11:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![stachick](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@stachick](https://discourse.codecombat.com/u/stachick)\
**Post date:** [December 25, 2014, 2:11am UTC](https://discourse.codecombat.com/t/how-to-build-a-decoy-decoy-drill/2078/1 "2014-12-25T02:11:12Z")

</div>

A little embarrasing, but how do I actually build a decoy… I don’t know the command to build the decoy. Right now I have…

```
# We are field testing a new battle unit: the decoy.
# Build 4 decoys, then report the total to Naria.
# Each decoy costs 25 gold. Use the Quartz Sense Stone
# to know when you have more than 25 gold with
# Keep a count of decoys you built as you go along.
# Break out of the loop when you have built 4.
decoysBuilt = 0
loop:
    item = self.findNearestItem()
    x = item.pos.x
    y = item.pos.y
    self.moveXY(x, y)
    if self.gold >= 100:
        self.moveXY(14, 36)
        break
        
self.say("Done building decoys!")
# Go to Naria and say how many decoys you built.
self.say("I've built "+decoysBuilt+" decoys")
```

---

<div class="post-metadata">

**Author:** ![stachick](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@stachick](https://discourse.codecombat.com/u/stachick)\
**Post date:** [December 25, 2014, 2:24am UTC](https://discourse.codecombat.com/t/how-to-build-a-decoy-decoy-drill/2078/2 "2014-12-25T02:24:17Z")

</div>

Nevermind, I’m an idiot. I thought I had the required hammer, but I didn’t.

---

<div class="post-metadata">

**Author:** ![funianwuxin](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@funianwuxin](https://discourse.codecombat.com/u/funianwuxin)\
**Post date:** [December 27, 2014, 9:07pm UTC](https://discourse.codecombat.com/t/how-to-build-a-decoy-decoy-drill/2078/3 "2014-12-27T21:07:36Z")

</div>

in fact,i pass this ievel with 1 day… you are right ,you need hammer ,where is hammer ?  
 ![](https://sea2.discourse-cdn.com/flex016/uploads/codecombat/1824/287109e4d958ed6d.png)

can you see ?

and your code has some problems.

my English is so bad , i hope to help you …

---

<div class="post-metadata">

**Author:** ![Xuan](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/xuan/32/10545_2.png) [@Xuan](https://discourse.codecombat.com/u/Xuan)\
**Post date:** [July 12, 2019, 2:08am UTC](https://discourse.codecombat.com/t/how-to-build-a-decoy-decoy-drill/2078/4 "2019-07-12T02:08:22Z")

</div>

I have a problem. Every time I try, it doesn’t stop. This is my code:

```python
decoysBuilt = 0
while True:
    coin = hero.findNearestItem()
    
    if coin:
        # Collect the coin!
        hero.moveXY(coin.pos.x, coin.pos.y);
        pass
    # Each decoy costs 25 gold.
    # If hero.gold is greater than or equal to 25:
    if hero.gold >= 25:
        # buildXY a "decoy"
        hero.buildXY("decoy", 36, 30)
        hero.wait(4)
        # Add 1 to the decoysBuilt count.
        decoysBuilt == decoysBuilt + 1
        if decoysBuilt == 4:
            # Break out of the loop when you have built 4.
            break
            pass
    
hero.say("Done building decoys!")
hero.moveXY(14, 36)
# Say how many decoys you built.
hero.say("I built 4 decoys")

```

PLEASE HELP ME !!!

---

<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 12, 2019, 8:43am UTC](https://discourse.codecombat.com/t/how-to-build-a-decoy-decoy-drill/2078/5 "2019-07-12T08:43:26Z")

</div>

Hi Xuan, please don’t ask for help in multiple places, it doesn’t get you help any faster and it clutters up the forum.  
(note; he has solved the level, so no-one needs to reply here.)  
🦁 🦁 🦁
