[SOLVED] Kelvintaph defiler soldiers and archers keep freezing

In kelvintaph defiler, the soldiers and archers keep unexpectedly freezing when I’m trying to control them with the flag. They aren’t sliding. Is this a bug, or is this meant to happen? Here’s my code. I listed this topic under bugs, but it may be level help.

while True:
    enemy = self.findNearestEnemy()
    for friend in hero.findFriends():
        for enemy in friend.findEnemies():
            if friend.type == "paladin":
                self.command(friend, 'shield')
            if enemy.type != "yeti":
                self.command(friend, 'attack', enemy)
                
        blackFlag = self.findFlag("black")
        if blackFlag:
            self.command(friend, 'move', {"x": blackFlag.pos.x, "y": blackFlag.pos.y})
            if friend.pos.x == blackFlag.pos.x:
                if friend.pos.y == blackFlag.pos.y:
                    self.removeFlag(blackFlag)
        
            
    enemies = self.findEnemies()
    friends = self.findFriends()
    for enemy in enemies:
        for friend in hero.findFriends():
            if enemy.type == "Shaman":
                self.command(friend, 'attack', enemy)
    
    greenFlag = self.findFlag("green")
    if greenFlag:
        self.pickUpFlag(greenFlag)

It may have something to do with the zero friction? I’m not really sure. Also, does
self.findFlags() find flags through walls? (I’m guessing so but I just want to know for sure)

1 Like

It works for a couple of soldiers, but then after a while it stops working. I don’t think it’s zero friction because they’re just walking in place, but you never know.

Could you send us a screen shot of where they get stuck? I know the first section that they start in is impossible to move in except when they start up moving towards the X. If you interrupt that movement before they are flung to the other X’s, it is very difficult to get out of that area.

I was able to use the black flag on the Paladin when she was facing Nalfar. Until you defeat the shaman’s holding the soldier’s and archers in their spells, they can’t move. Below is a link to some posts that may give you some more insights for this level.
Kelvintaph%20Defiler

The first soldier was starting to be flung, but then I placed a flag, which then made him/her get out of the spell and start attacking the other shamans. Part of the problem was that the other soldiers and archers usually weren’t moving. Sometimes one of the archers could move, but at some point either they got stuck, or died because the other soldier and archer were killed by the bear traps or because they were stuck.


As you can see here I place a flag before the soldier lands, which makes her escape the spell. In this case, another soldier manages to escape the zero-friction and they kill the shamans, the munchkin, and the ogre. The archers even kill the first shaman. But after that all the units other than the soldiers are completely stuck. Not even sliding in the low friction. Sometimes the other soldier doesn’t get out of the low friction and gets killed by the bear trap which would be fine if the other units could move.

Also, is it possible you could please test my code? It might just be me having the problem. Thanks.

The paladin’s shield is what prevents the spells from working. If you time the shield just right, most of the team will be moved out the slick patch and one or two might be free to attack the other shamans. I was using your code above. I just adjusted some timing to see if the flag code was working and it does if you have someone free from the slick ice and shamans.

1 Like

So does that mean I can pass this level with the code I already have? Then it might just be me having the problem. My soldiers and archers still freeze unexpectedly. I tried copying my code and restarting the level. It didn’t work.

I’m trying to get the paladin to take down her shield after the first shaman gets killed. hero shield is still up. I think that’s what may be keeping the archers from moving. Here’s my new code:

while True:
    enemy = self.findNearestEnemy()
    for friend in hero.findFriends():
        for enemy in friend.findEnemies():
            if friend.type == "paladin":
                self.command(friend, 'shield')
                if "Uld'mak".health <= 0:
                    break
            if enemy.type != "yeti":
                self.command(friend, 'attack', enemy)
        violetFlag = self.findFlag("violet")
        if violetFlag:
            if friend.type != "soldier":
                self.command(friend, 'move', {"x": violetFlag.pos.x, "y": violetFlag.pos.y})
                if friend.pos.x == violetFlag.pos.x:
                    if friend.pos.y == violetFlag.pos.y:
                        self.removeFlag(violetFlag)
        blackFlag = self.findFlag("black")
        if blackFlag:
            if friend.type == "soldier":
                self.command(friend, 'move', {"x": blackFlag.pos.x, "y": blackFlag.pos.y})
                if friend.pos.x == blackFlag.pos.x:
                    if friend.pos.y == blackFlag.pos.y:
                        self.removeFlag(blackFlag)
        
            
    enemies = self.findEnemies()
    friends = self.findFriends()
    for enemy in enemies:
        for friend in hero.findFriends():
            if enemy.type == "shaman":
                self.command(friend, 'attack', enemy)
    
    greenFlag = self.findFlag("green")
    if greenFlag:
        self.pickUpFlag(greenFlag)

Nevermind. It’s not the first shaman dying.

If the archers are in that first section, they are stuck. You need to let them be flung out by the spell so they get clear of that first box with the slick ice. To do that, delay the paladin shield and attack commands for a few seconds until they are almost all clear. I found that timing is crucial on this piece. You may want to have one archer stay back to attack that first shaman and potentially the Yeti.

            if friend.type == "paladin": # you can add a time check here to delay the shield
                self.command(friend, 'shield')

Once you have a few friends free to help attack Nalfar, it thought it was pretty easy to clear the rest of the level.

2 Likes

The names don’t change in this level, so I’m trying to target the shaman by name, but then this message appears:


edit: oops sorry I didn’t mean to post 2 screenshots.

Two reasons that can potentially cause this error:

  1. eventually you will kill “Uld’Mak” so you get that message if you don’t check for the enemy first
  2. there is a chance that the specific friend assigned doesn’t have a line of sight on the target

The first one is the likely problem.

One extra thing, I see you have your enemy for loop before your friend for loop. Since your enemy for loop looks for friend.findEnemies() before you have a friend defined to find them, it won’t find any enemies. Currently you aren’t using the enemy variable in your loop so it is unnecessary.

1 Like

Ok. thanks. I also spotted another problem. at the beginning, I put, “enemy = self.findEnemies” instead of “enemies = self.findEnemies” I think that may be why the enemy.type wasn’t working.

It worked! Thanks. (20 chars) I still haven’t passed the level, but I think I can pass it now.
Edit: Friend.id isn’t working which is causing problems, but I don’t think I need help now. Thanks! this helped me out a lot.

To simplify the code, you could use one flag for attack so you don’t have to specify the enemies or friends specifically. If flag, for loop of friends (maybe not paladin until Nalfar is handled), attack nearest enemy. Then just guide them around to the enemies you need to attack. Just be careful not to go back on the slick ice.

1 Like

how did you keep your hero alive while the paladin shielded

You command the hero at the very beggining if the battle to get away from the projectiles (by exiting the hallway and then gping up a little) Then your main problem are the troops. After the paladin starts losing health command her to heal herself and shield.

Andrei

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.