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")
I have a problem. Every time I try, it doesn’t stop. This is my code:
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")
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.)