Kelvintaph Crusader Need Help


#1

I can’t get the archers or anything to move after the queen. Also, I cant get through the catapults. Help?

def chooseTarget():
    witches = self.findByType("witch")
    skeletons = self.findByType("skeleton")
    ogres = self.findByType("ogre")
    if len(witches) > 0:
        return self.findNearest(witches)
    elif len(ogres) > 0:
        return self.findNearest(ogres)
    elif len(skeletons) > 0:
        return self.findNearest(skeletons)
loop:
    friends = self.findFriends()
    friendEnemy = chooseTarget()
    for friend in friends:
        if friendEnemy:
            self.command(friend, "attack", friendEnemy)
    friendEnemy = chooseTarget()
    for friend in friends:
        if friendEnemy:
            self.command(friend, "attack", friendEnemy)
    friendEnemy = chooseTarget()
    for friend in friends:
        if friendEnemy:
            self.command(friend, "attack", friendEnemy)
    self.moveXY(69,15)
    self.say("Hi!")
    self.say("Hi!")
    self.moveXY(37,16)
    self.say("Bye!")
    self.moveXY(37,16)
    self.moveXY(78, 14)

#2

Can you use a self.say(friendEnemy.id) to determine what target are you finding. If you do not have see through wall glasses you will not find the witch.

To kill the catapults you must run towards them and run back. The brawlers will come after you and they will be killed by the catapult fire when you run back.

Try to fix this part first, because if your hero dies you can’t test the code for your troops.

Also do not use moveXY - it makes your code wait. until your hero actually reaches the given point.
During this time you cannot do anything else, you cannot command your troops => your troops will die.

Use instead move - it instruct the hero to move towards a point, put it does not wait.

Check the thread:


#3

my friends will not go to the exit after all the enemies are killed, what is wrong with my code?
(I am using omarn with speed ring and boots of leaping and burl staff and 1000 HP)

exit = Vector(78, 40)
def commandFriends():
    friends = self.findFriends()
    enemies = self.findEnemies()
    greatestEnemyHealth = 0
    enemy = None
    for Lenemy in enemies:
        if Lenemy.health > greatestEnemyHealth and Lenemy.type != "witch" and Lenemy.pos.y > 35:
            greatestEnemyHealth = Lenemy.health
            enemy = Lenemy
    for friend in friends:
        witch = friend.findNearest(self.findByType("witch"))
        if friend.type = "paladin":
            if witch:
                self.command(friend, "attack", witch)
            elif enemy:
                self.command(friend, "attack", enemy)
        elif enemy:
            self.command(friend, "attack", enemy)
        else:
            self.command(friend, "move", exit)
def helpFriends():
    ogre = self.findNearest(self.findByType("ogre"))
    self.moveXY(25, 22)
    if ogre:
        self.attack(ogre)
commandFriends()
self.moveXY(48, 15)
self.cast("drain-life", self.findNearest(self.findEnemies()))
commandFriends()
helpFriends()
commandFriends()
while self.findNearest(self.findByType("catapult")):
    self.moveXY(69, 16)
    commandFriends()
    helpFriends()
    commandFriends()
self.moveXY(78, 14)
loop:
    commandFriends()

#4

and twilight glasses (see through walls)


#5

NVM I won a different way