[SOLVED] Cloudrip Commander help please [python]

# 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})

# Go join your comrades!
hero.moveXY(51, 41)

my guy sends one soldier to the home then stops

Yeah this is what you writed so soldier its doing everything ok.
If you want to beat this level you should remember that soldierIndex = 0

So you are telling your soldier[0] to move
Meanwhile you want to tell every single one them to move so you shouldnt tell the command only to the soldier[0].
You should tell soldier[1],soldier[2] etc. aswell to move

Remember that soldier[1] = soldier[soldierIndex] but when the soldierIndex its set to 1
So basicly you should add +1 to soldierIndex at the end of the Loop so it will change the value of soldierIndex.

I hope i explained it right. If you have any question feel free to ask.

Use another while loop:
while soldierIndex< len(soldiers) and don`t forget to increment soldierIndex.

thank you i will try that @Jaaneek

@Jaaneek its still not working for me

while soldierIndex< len(soldiers) and don`t forget to increment soldierIndex.

You have to limit it to number of your soldiers either you gonna give infinite number of orders and your hero will never move on. You can use example from @juraj_pechac

can you tell me what im doing wrong now

Im on phone right now, and i cant zoom it. But i think you have while true somewhere which loops it and doesnt let proceed the code. Look for while true.
When you find it just delete it

Just delete the while True:
And instead of hero.move you can use hero.moveXY.
Tell me when you done that if it works.

i beat it by moving to 50, 40 then summoning soldiers

1 Like

That its pretty smart honestly xD
But i dont think that was the purpose of this level. You should done that the tradition way so you will understand in next levels how to operate arrays

friends = self.findFriends()
friend = self.findNearest(self.findFriends())
friendpos = friend.pos

loop:
    fx = friendpos.x
    fy = friendpos.y
    if self.now() < 6:
        self.move({'x': fx, 'y': 42})
    if self.now() < 14 and self.now() > 6:
        self.move({'x': fx, 'y': fy + 6})
    if self.now() > 14 and self.now() < 17:
        self.move({'x': fx, 'y': fy + 6}) 

could you help me with the level Dance-Off
it wont stay with the partner

Well i would love too but unfortunately i didnt bought yet the premium content so im not the right person to help you with that Level. If you have problem with that you can always skip it and comeback to it later.

darn man you were really helping me with this stuff wow though i would’ve thought you had premium lol your really good

1 Like

Well im only like 1 week ahead of you(60 levels ahead). Just try to do every level by yourself and you will catch up. And remember to dont give up :slight_smile: Also i recommend watching https://www.twitch.tv/communities/GameDevelopment The people in chats answer every question that you might have (Not about codecombat just about coding at all).

1 Like

You said you needed help with Dance-Off? I can try to assist you.

@Luke10 i dont need help with that but with alpine rally

what ever i do its always wrong

Ok…please post your code…

what item gives the hero haste?

while True:
    hero.cast("haste", hero)
    hero.moveXY(100, 37)     
    hero.manaBlast()
    

be back at 6:00 if your in ohio if not like 2 hours from now so bbl