Kelvintaph Defiler - Help!

If I get him right he suggests you to do some kind of hack\trick.

I suggest you to to as required for the first run.
This level is artificially hard.
It is more about game mechanics than programming

All you need to know for beat this level

  1. archers can place some hits on shamans before they cast fling\fear on them.
  2. soldiers and archers can attack while in the air.
  3. paladin shield mitigates spells
2 Likes

i know how to code this thing, but i want to figure out how to do it without doing 200 loc
im trying to see if thereā€™s simpler solutions, so i dont spend 24 hours beating this level
btw why is the discourse so slo today

I created this code so my soldiers in Kelvintaph defiler can free the archer so they can free the paladin together

def findEnemy(name, friend):
    enemies = friend.findEnemies()
    id = name
    i = 0
    for i in range(len(enemies)):
        enemy = enemies[i]
        if id == enemy.id:
            return i
        else:
            i += 1

Iā€™m inputting ā€œDrunā€ for name and the soldierā€™s variable for friend.
But when i run my full code, it wonā€™t attack its enemyā€¦ Why?

def CommandSoldier(soldier):
    if step < 4:
        target = findEnemy("Drun", soldier)
        if "Drun".health > 0:
            hero.command(soldier, "attack", "Drun")
        elif soldier.pos.x < 74:
            moveStep = 0
            if moveStep == 0:
                hero.command(soldier, "move", {"x": 6, "y": 74})
                moveStep += 1
                target = findEnemy("Drun", soldier)
                if target:
                    while target.health > 0:
                        hero.command(soldier, "attack", target)
            if moveStep == 1:
                hero.command(soldier, "move", {"x": 22, "y": 67})
                moveStep += 1
                target = findEnemy("Drun", soldier)
                if target:
                    while target.health > 0:
                        hero.command(soldier, "attack", target)
            if moveStep == 2:
                hero.command(soldier, "move", {"x": 39, "y": 62})
                moveStep += 1
                target = findEnemy("Drun", soldier)
                if target:
                    while target.health > 0:
                        hero.command(soldier, "attack", target)
        else:
            enemy = soldier.findNearestEnemy()
            if enemy:
                hero.command(soldier, "attack", enemy)

thatā€™s the code for commanding my soldier.

Never mindā€¦
I finally beated the level!! :slight_smile:
but i canā€™t figure out how to keep my entire squad aliveā€¦
itā€™s weird!!
i can finish the level if i sacrifice my soldiers to the yeti, but i cant if i dont sacrifice themā€¦

If you are talking about the moment when Nalfar flees from you.
It is relatively easy.
Just think where is the yeti came from and what you can do about it beforehand.

1 Like

basically, i get my archers freed so they can free the soldiers.
Before Nalfar even got close to fleeing, i have to sacrafice my soldiersā€¦
so likeā€¦ when the soldiers get freed, i sacrifice them to the yeti, then i get my 2 archers to nalfar, and get him to swap.
and that = success.
But if i get my soldiers to stay at a specific point without sacrificing them for nothing, the level fails.

i have to command them to attack the yeti, or the level fails.
thatā€™s what i mean.

Interesting
I just take care of the yeti beforehand.
So no one hurt.

Could you please send that version of your code:
ā€œBut if i get my soldiers to stay at a specific point without sacrificing them for nothing, the level fails.ā€

It is interesting to see what is going on.

1 Like

nah itā€™s okay
i figured it out
i changed it so that instead of 2 archers fighting the necromancer, i send the 2 soldiers to attack him with the paladin helping.
the archers basically just sit there and do nothing :stuck_out_tongue:

woo!
i finally beated everything in glacier! :slight_smile: yay