[SOLVED] Kelvintaph crusader help!

my code doesn’t work, I survive but my friends don’t

exit = Vector(78, 40)
ogre = self.findNearest(self.findByType("ogre"))
self.canCast("chain-lightning", ogre)
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.cast("chain-lightning", ogre)
        
commandFriends()
self.moveXY(48, 15)
commandFriends()
helpFriends()
commandFriends()
while self.findNearest(self.findByType("catapult")):
    self.moveXY(69, 16)
    commandFriends()
    helpFriends()
    commandFriends()
self.moveXY(78, 14)
loop:
    ogre = self.findNearest(self.findByType("ogre"))
    commandFriends()
    self.canCast("chain-lightning", ogre)

This does nothing. Look at the playback. You didn’t cast a lightning bolt.

use

if ogre and self.cancast("chain-lightning", ogre):
    self.cast("chainlightning", ogre) 

In general, this is a very messy piece of code. I suggest you clean it up a bit.
Also, here’s a fun fact: you don’t have to kill all the ogres.
Just kill the witch, open the gate, manage not to have all your allies die, and walk out.
Also create an array tracking the missiles the catapults are throwing, as well as their positions.
Then you should move away ONLY after the catapults have fired, so they can kill themselves.

1 Like

I beat the level 20 seconds later when I was posting that.

1 Like

Can someone help me beat this level, I just unlocked it and have no idea how to beat it. :frowning:

What is your code so far?

I have absolutely no code and have no idea how to start. The hints aren’t telling me anything. :frowning:

I’m not sure if you’ve already completed this level, but start by attacking the enemies in your corridor. After you’ve defeated all of them, command your hero to stand on the white X.

Next, you need to command your soldiers in the upper corridor to defeat their enemies, then move them to their white X.

Hope this helps :upside_down_face:

someone please help me in this level my code is

MOD edit: solution removed

i survive but my allies don’t

your code works fine in mine

1 Like

hmm its not working for me

my allies die but i don’t and I lose a bit of health

@destroyer5023 my gear is the following

Uploading: image.png(1)… Uploading: image.png(2)… Uploading: image.png(3)… Uploading: image.png(4)… Uploading: image.png(5)…

Edit: ignore the other picture

you need to buy the glasses that can see through walls

1 Like

They are useful, but not required.

Andrei

1 Like

ohhh thank you so much

but if you buy them you can complete the level

1 Like

ok thank you your the best

ok bye(20 char)

Can you show us your recent code?

Andrei

1 Like

Is this a working code? If so, can you delete it so others won’t be able to copy it?

Andrei

1 Like