Desert Combat - What am I missing?

What are the say-able commands to the troops for this level?

It would be nice to have those listed in the comments.

All I see so far is:

// while-loops repeat until the condition is false.
// Always take an action inside a while loop, or it'll go infinite!
var ordersGiven = 0;
while (ordersGiven < 5) {
    // Move and order each of your allies into battle.
    this.say("Move!");
    
    
    
}
// When you're done giving orders, join the attack.

I’m at the same lvl , i killed the ogre but get killed too and i don’t want to buy new items lol ,gona find a solution , anyway a while loop isn’t like if loop, while loop gona stop if condition is false

now tell your allies to attack , each time you tell one of your solider to attack make ordergiven as +1 , it’s the same as the previous lvls like coins and decoy , once your order given = 5 , join the raid ( attack with allies )

I can’t even get the ogre to appear. I know what I need to do overall, but I don’t know what commands I can give the soldiers to make them move. What are you telling the troops to get them to move to the “x”'s?

It’s " Attack" by default Oo , don’t forget the zoom , use the middle button of your mouse to zoom ( the scroller )

Uh…I just keep yelling attack and my soldier’s just sit there. LOL.

Sorry i typed " attack" instead of “Attack!”

The zoom out did help. But my soldier’s…I still don’t know how to command them. =P

I guess the reload button would help alot lol xD

Ahh…gotta go do real life stuff. =P

Just saw: Commanding your troops - Will see if they will take those commands when I get home.

Thanks!

1 Like

Move yourself to the x spot, then tell them to attack.

2 Likes

LOL when i saw he’s post ,

"I can't even get the ogre to appear. I know what I need to do overall, but I don't know what commands I can give the soldiers to make them move. What are you telling the troops to get them to move to the "x"'s?
"

i tough he already moved to the X , didn’t focused on the last words

Thanks. I never would have thought of that. A general orders the attack by shouting…not moving and then ordering. LOL

What’s wrong with my while-loop here?

ordersGiven = 0
while ordersGiven < 5:
    # Move and order each of your allies into battle.
    x = self.pos.x
    y = self.pos.y - 10
    self.moveXY(x, y)
    self.say("Attack!")
    ordersGiven = ordersGiven + 1

My hero moves to the first soldier and tells him to attack, and then thinks that ordersGiven > 5 and decides to attack (and promptly die). The issue seems to be with the line ordersGiven = ordersGiven + 1, but that’s the same structure I used in Decoy Drill, and it worked there. Any help would be greatly appreciated!

That looks good to me… could you post the rest of your code?

When I have the code like this:

# while-loops repeat until the condition is false.
# Always take an action inside a while loop, or it'll go infinite!
ordersGiven = 0
while ordersGiven < 5:
    # Move and order each of your allies into battle.
    x = self.pos.x
    y = self.pos.y - 10
    self.moveXY(x, y)
    self.say("Attack!")
    ordersGiven = ordersGiven + 1
    
# When you're done giving orders, join the attack.
    enemy = self.findNearestEnemy()
    loop:
        if enemy:
            if self.isReady("cleave"):
                self.cleave(enemy)
            else:
                self.attack(enemy)
        else:
            pass

my hero decides to command my soldier and then go attack the ogre. When I move the enemy = self.findNearestEnemy() to before the while loop (from in the middle) my hero commands the one soldier and stays where he is (the following code).

# Always take an action inside a while loop, or it'll go infinite!
ordersGiven = 0
enemy = self.findNearestEnemy()
while ordersGiven < 5:
    # Move and order each of your allies into battle.
    x = self.pos.x
    y = self.pos.y - 10
    self.moveXY(x, y)
    self.say("Attack!")
    ordersGiven = ordersGiven + 1
    
# When you're done giving orders, join the attack.
    
    loop:
        if enemy:
            if self.isReady("cleave"):
                self.cleave(enemy)
            else:
                self.attack(enemy)
        else:
            pass

Aha… when you are finished with the while loop, move your indenting back to the same level as the while loop: example:

ordersGiven = 0
while ordersGiven < 5:
    # Move and order each of your allies into battle.
    x = self.pos.x
    y = self.pos.y - 10
    self.moveXY(x, y)
    self.say("Attack!")
    ordersGiven = ordersGiven + 1
self.say("I am ready to run more code!")

The code on the same indent level will run once the while loop is complete.

Well, that fixed one problem! Now my hero commands the soldiers, and then decides to stand there and die. How powerful must your hero be to finish the level?

He shouldn’t be just sitting there… repost new code for me?

It was because of the enemy = self.findNearestEnemy() was only after if enemy, so my hero would never attack.I still die because my hero isn’t strong enough, though.

Well… better equipment of course, or maybe you could add flags and retreat a bit so your allies do more of the fighting. Perhaps you could try using a new tactic (shield perhaps).