Cloudrip Commander


#1
while self.gold > self.costOf("soldier"):
    self.summon("soldier")
friends = self.findFriends()
friendIndex = 0
friend = friends[friendIndex]
while friendIndex < len(friends):
    # Do stuff
# Add a while loop to command all the soldiers.
    soldiers = self.findFriends()
    soldierIndex = 0
    soldier = soldiers[soldierIndex]
    self.command(soldier, "move", {"x": 50, "y": 40})
    friendIndex += 1

please help i’m really stuck


#2

dont worry i fixed it


#3
while self.gold > self.costOf("soldier"):
    self.summon("soldier")
friends = self.findFriends()
friendIndex = 0
friend = friends[friendIndex]
while friendIndex < len(friends):
    # Do stuff
# Add a while loop to command all the soldiers.
    soldiers = self.findFriends()
    soldierIndex = 0
    soldier = soldiers[soldierIndex]
    self.command(soldier, "move", {"x": 50, "y": 40})
    self.moveXY(50, 40)

I only command 1 Soldier. PLEASE HELP


#4

You need to increment your friendIndex after each command. You should also move your self.moveXY out of the while loop.


#5

What do you mean? How to increment? My code moves 2 soldiers, but still…


#6

Just move to the X first, before you summon your soldiers