I’ve gotten to cloudrip Commander and got a boss star and I do what it says to do but then when he commands the first one he goes off to the X and just stays there help
# 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})
soilderIndex = soldierIndex + 1
# Go join your comrades!
hero.moveXY(51, 41)
i tried doing putting it in the while true loop it gets an error saying undefined of undefined and I delete the soldier index and then it says soldier is not defined which then I knew that was not going to work I out it back and replaced the while true loop with a if soldier and it does not work it does not command anyone so I dono what to do
# 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 soldierIndex < len(soldiers):
soldier = soldiers[soldierIndex]
hero.command(soldier, "move", {"x": 50, "y": 40})
soldierIndex + 1
# Go join your comrades!
hero.moveXY(51, 41)