Hi, you need to first say, while hero’s gold is less then the cost of a soldier. And then just do hero.summon(“soldier”). Then have this soldiers = hero.findFriends() and soldierIndex = 0
Have *figure out yourself* = soldier[soldierIndex] followed by the usual soldierIndex += 1. I passed the level by moving before I summoned anything. So that was at the top of my code.
oh sorry here is my code:
# Summon some soldiers, then direct them to your base.
# Each soldier costs 20 gold.
while hero.gold > hero.costOf("soldier"):
hero.summon("soldier")
soldiers = hero.findFriends()
soldierIndex = 0
# Add a while loop to command all the soldiers.
while True:
soldier = soldiers[soldierIndex]
hero.command(soldier, "move", {"x": 50, "y": 40})
hero.moveXY(51, 41)