Kelvintaph Defiler Step Variable Help

Hi! My code doesn’t seem to do anything at all. I’m getting the X underneath my hero, but the duck doesn’t say why. The duck isn’t even there at all. Can someone check and see if something is wrong?

# The ogres are trapping you with their dark rituals!
# Your hero can't do anything besides command and move without angering the warlocks.
# Beware ice, robots, traps, antigravity fields, and other dark magic.
# Somehow, you'll need to defeat Nalfar and save your paladin.
# The great treasure of Kelvintaph awaits your victory.
hero.moveXY(34, 15)
hero.moveXY(34, 7)
def commandSoldiers():
    soldiers = hero.findByType("soldiers")
    for soldier in soldiers:
        enemy = soldier.findNearestEnemy()
        hero.command(archer, "move", {'x': 75, 'y': 73})
        necro = hero.findNearest(hero.findByType("necromancer"))
        if necro:
            hero.command(soldier, "attack", necro)
        elif enemy:
            hero.command(soldier, "attack", enemy)
def commandArchers():
    archers = hero.findByType("archer")
    for archer in archers:
        hero.command(archer, "move", {'x': 75, 'y': 73})
        enemy = hero.findNearest(hero.findByType("necromancer"))
        if necro:
            hero.command(archer, "attack", necro)
        elif enemy:
            hero.command(archer, "attack", enemy)
def commandPaladins():
    paladin = hero.findFriends()
    enemy = hero.findByType("necromancer")
    if enemy and paladin:
        hero.command(paladin, "shield")
        if <= 400:
            hero.command(paladin, "heal", paladin)
while True:

i think that maybe the necro and enemy variables for necromancers are clashing?

but the different variables in different functions don’t overlap, I already forgot that and had to re-add them in each function

wait I have an error in the archers function haha

Think it’s cuz you’re defining the necro variable in a diff function. happened to me before maybe define necro before all functions as well? or define it in archer function?

ok now that i fixed that, i’m getting an error on line 31, or hero.command(paladin, "shield"). It says I need something to command? and is it a bug that the duck appears half on the screen and half off?

YOu need a target to shield upon. Ex:

hero.command(paladin,"shield",#target whatever it is)

hmmm, couldn’t I just write hero.command(paladin, "shield", paladin)?

eggsactly that is what you should do if you wanna it to shield itself

i just wrote that, but then I still get the same error?

and you shouldn’t do that paladin is find friends, cuz that includes the archers

Don’t think the archers can shield

oopsie didn’t add hero.findByType("paladin") inside

1 Like

yup, forgot to mention that too :man_facepalming:

1 Like

Aha! but, i can’t heal my paladin???

1 Like

OK, now that I have most of this sorted, my paladin is finally shielding. But, the paladin can’t kill Nalfar, right? So I need my troops to go over there, but they have fear spells and antigravity spells and fling spells being casted on them. How do i get rid of that?

The paladin isn’t supposed to. Just stall time i guess. keep healing herself as nalfar does his thing

So she stays alive while you’re doing your own thing

but I don’t think that i can heal and shield and stay alive. Even so, how do I get my troops out of the shamans’ spells?

i don’t think you’re supposed to heal and shield at the same time.