# Summon some soldiers, then direct them to your base.
# Each soldier costs 20 gold.
while hero.gold > hero.costOf("soldier"):
hero.summon("soldier")
while True:
soldiers = hero.findFriends()
soldierIndex = 0
# Add a while loop to command all the soldiers.
soldier = soldiers[soldierIndex]
hero.command(soldier, "move", {"x": 51, "y": 41})
# Go join your comrades!
hero.moveXY(51, 41)
place this in the while loop
soldiers = hero.findFriends()
soldierIndex = 0
after that make a if soldier: loop after the soldier = soldiers[soldierIndex]
place the soldier move inside the if
then place a else then place a break in the else loop
lastly don’t put your hero moving inside any loop
Hope this helps