# Are we allowed to summon units in Cloudrip Treasure?

**URL:** https://discourse.codecombat.com/t/are-we-allowed-to-summon-units-in-cloudrip-treasure/3807
**Category:** Uncategorized
**Created:** [May 7, 2015, 9:00pm UTC](https://discourse.codecombat.com/t/are-we-allowed-to-summon-units-in-cloudrip-treasure/3807 "2015-05-07T21:00:36Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![ChronistGilver](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chronistgilver/32/3778_2.png) [@ChronistGilver](https://discourse.codecombat.com/u/ChronistGilver)
#### Post date: [May 7, 2015, 9:00pm UTC](https://discourse.codecombat.com/t/are-we-allowed-to-summon-units-in-cloudrip-treasure/3807/1 "2015-05-07T21:00:36Z")

</div>

Whenever I try to summon a soldier in Cloudrip Treasure, my hero acts as if I told her to summon a unit when she didn’t have enough gold, even though I specifically put `if self.gold >= 20`. Is this intentional, a bug, or my code?

> **My Code**
>
> ```python
> def summonSoldier():
> if self.gold >= 20:
> self.summon("soldier")
> 
> ```

---

<div class="post-metadata">

### Author: ![Vlevo](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/vlevo/32/2074_2.png) [@Vlevo](https://discourse.codecombat.com/u/Vlevo)
#### Post date: [May 7, 2015, 9:09pm UTC](https://discourse.codecombat.com/t/are-we-allowed-to-summon-units-in-cloudrip-treasure/3807/2 "2015-05-07T21:09:33Z")

</div>

Well, really you should be using “costOf”.

But I haven’t played that level yet. so I’m not sure about the general summon question.

[edit:]  
OK, I just ran the level, and used “self.say(self.gold)” which you should have done… 😄

@Catsync the level doesn’t wipe the hero’s gold . . . it said “60” which is correct for Boss Star III and not zero . . . so “I” see 60 gold and therefore try to summon but “coco” sees less gold and so no soldier appears. I submitted a patch that also wipes the hero’s gold so they don’t think they have gold they don’t have.  
[edit-edit] Patch only worked for me, after it saved then it didn’t even work for me … Still working on it. for now work around would be to self.wait(0.00000000001) or make sure you take some other action is taken before you summon.

---

<div class="post-metadata">

### Author: ![Catsync](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/catsync/32/6431_2.png) [@Catsync](https://discourse.codecombat.com/u/Catsync)
#### Post date: [May 8, 2015, 2:59am UTC](https://discourse.codecombat.com/t/are-we-allowed-to-summon-units-in-cloudrip-treasure/3807/3 "2015-05-08T02:59:13Z")

</div>

Was talking to Vlevo about this earlier, the fix doesn’t fix all cases - it’s weird.

I think the easiest workaround for now is to stick something like: `self.wait(0.001)` at the top of your code, until we figure out something better 😖

---

<div class="post-metadata">

### Author: ![Feinty](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/feinty/32/1869_2.png) [@Feinty](https://discourse.codecombat.com/u/Feinty)
#### Post date: [May 9, 2015, 3:17am UTC](https://discourse.codecombat.com/t/are-we-allowed-to-summon-units-in-cloudrip-treasure/3807/4 "2015-05-09T03:17:08Z")

</div>

Shouldn’t all boss stars be banned for the treasure levels

---

<div class="post-metadata">

### Author: ![VincentMaths](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/vincentmaths/32/2418_2.png) [@VincentMaths](https://discourse.codecombat.com/u/VincentMaths)
#### Post date: [May 20, 2015, 2:14pm UTC](https://discourse.codecombat.com/t/are-we-allowed-to-summon-units-in-cloudrip-treasure/3807/5 "2015-05-20T14:14:29Z")

</div>

Just a quick feedback on CloudRip treasure. I ran the code on my wife’s account that didn’t have Twilight glasses and the findItems() or findByType(“coin”) can’t see through mountains. Took me a while to understand why my peasants were not behaving as I expeted them to.

I think players should be warned or the twilight glasses should be a requiered equipment for the level.

I didn’t try

```
peasant.findItems()

```

because it doesn’t fit my coding style. Maybe that works though. I eventually bought the damn glasses 😄

* * *

@Feinty : the idea in CloudRip treasure is to command peasants to loot coins. Can’t do that without bossStars.

* * *

Another little feedback : decoy don’t bounce on the walls in this level. I don’t use decoys very often, but the several times I did, they bounced on the wall. Here they get stuck in corners, which decreases their value because their aggro range isn’t infinite. Also, intended or not, Decoys collect coins.

---

<div class="post-metadata">

### Author: ![Vlevo](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/vlevo/32/2074_2.png) [@Vlevo](https://discourse.codecombat.com/u/Vlevo)
#### Post date: [May 20, 2015, 8:05pm UTC](https://discourse.codecombat.com/t/are-we-allowed-to-summon-units-in-cloudrip-treasure/3807/7 "2015-05-20T20:05:09Z")

</div>

Yes, this is a case where the peasants should be doing the looking for themselves, they know how to:  
findNearest, distanceTo, findItems, and findNearestItem (other things to, but those don’t matter here).

---

<div class="post-metadata">

### Author: ![Burnsides](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/burnsides/32/3548_2.png) [@Burnsides](https://discourse.codecombat.com/u/Burnsides)
#### Post date: [December 28, 2015, 8:20pm UTC](https://discourse.codecombat.com/t/are-we-allowed-to-summon-units-in-cloudrip-treasure/3807/8 "2015-12-28T20:20:15Z")

</div>

Interesting. I was totally stuck because the peasants were responding strangely and ended up all in a clump running into each other. I was using:

`var coin = friend.findNearest(friend.findItems());`

When @Vlevo mentioned available methods, I tried:

`var coin = friend.findNearestItem();`

And it works perfectly. Aren’t these statements supposed to be the same thing? Why didn’t the first one work? IS there a bug? Or are they supposed to work differently?
