Summits gate rush

On summits gate, my soldiers are attacking, but not following my orders! This is my code:

# Fight your way into the Inner Sanctum of the ogre chieftain.

for i in range(2):
    self.command(soldier, "attack", catapult)

You have more than two soldiers. Find a way to split them into two groups

for soldier in soliders:
     self.command(solider,"attack", catapults[i])

If you just make i=0 then all of them will attack the same catapult.

Finally, make sure you are giving them only one order per main loop

i solved it without commanding just flags

I only want one soldier to attack each catapult and I don’t want anybody else to do anything.

well i just did nothing and the soldiers archers and the paladins automatically walked to the catapult while pushing enemies
and the catapult killed itself :slightly_smiling:

Then everyone dies! I want nobody to move unless I command them.

ya thats the whole point you want them to die so the paladins at the end dont go all the way to heal them

No, I want them to survive. How do I get them to attack the catapults?

  1. If your archers walk behind the soldiers they will be blown apart or killed easily. Command them to move near your hero

  2. If you soldiers stick around after attacking the catapult, the last catapult fireball will land on them. Command them to move in front of the gate if:

    • flag
    • OR catapult dead
    • or time

I want only one soldier to attack each catapult! My code should do that, but it doesn’t.


// Some more code here

if (catapults[0].health>0)

If allies[0] does not happen to be the solider you wanted, change 0 to another number, or use findByType and allies[i].pos to select the best soldier

I did that. It still doesn’t work! Here is my code:

# Fight your way into the Inner Sanctum of the ogre chieftain, and kill her.
for friend in self.findFriends():
    if friend:
        self.command(friend, "defend", friend.pos)
    for paladin in self.findByType("paladin"):
        self.command(paladin, "move", self.pos)
        if paladin.canCast("heal", self) and>100:
            self.command(paladin, "cast","heal", self)
    if catapults[0]:
    enemies = self.findEnemies()
    enemy = self.findNearest(enemies)
    if enemy and enemy.type != "door":

There are a few problems with your code:
1.It seems that allies[0] is a archer and it will get killed instantly
2. “defend” does not usually work. It instructs the ally to attack anyone that comes near its position. But when the solider attack, it changes position, so it will attack anyone near its new position and so on.
3. Sending only one soldier for the catapults will get him killed instantly send a group.

Here is a very simple code that works- in the sense that everyone dies :stuck_out_tongue:

You can improve it if

  • you split your soldiers into two group
  • you instruct them to run away if the catapult is dead or nearly dead (otherwise the last catapult shot will land on both the catapult itself and on your soldiers).

In the code some of the soldiers escaped the 1st catapult’s dying shot but it could have been better if they would have left a bit earlier

Dumb code
    for ally in allies:
    if catapults[0]:
        for soldier in soldiers: