Are we allowed to summon units in Cloudrip Treasure?

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
def summonSoldier():
    if self.gold >= 20:
        self.summon("soldier")

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… :smile:

@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.

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 :confounded:

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

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 :smile:


@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.

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).

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?