Kelvintaph Defiler (JS)

Ok I need help now :grin:

Code
// 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.
function heal() {
    var paladin = hero.findNearest(hero.findByType("paladin"));
    if (paladin.canCast("heal", paladin)) {
        hero.command(paladin, "cast", "heal", paladin);
    }
}
function command() {
    var paladin = hero.findNearest(hero.findByType("paladin"));
    var friends = hero.findFriends();
        for (var friendIndex = 0; friendIndex < friends.length; friendIndex++) {
            var friend = friends[friendIndex];
            if (friend.type == "paladin") {
                var enemy = friend.findNearestEnemy();
                if (enemy) {
                    hero.command(friend, "shield", friend);
                }
                if (friend.health < 500) {
                    heal();
                }
            }
            if (friend.type == "soldier") {
                enemy = friend.findNearestEnemy();
                if (enemy) {
                    hero.command(friend, "attack", enemy);
                }
                if (!enemy) {
                    hero.command(friend, "move", {
                        "x": 82,
                        "y": 72
                    });
                }
            }
            if (friend.type == "archer") {
                enemy = friend.findNearestEnemy();
                if (enemy) {
                    hero.command(friend, "attack", enemy);
                }
                if (!enemy) {
                    hero.command(friend, "move", {
                        "x": 23,
                        "y": 40
                    });
                }
            }
        }
    }
hero.moveXY(33, 8);
while (true) {
    command();
}

Pictures


yeah, I know, right? it’s hard enough in python, in java… wow.

1 Like

Try to command your archer to move up after it kills the Yeti that should be enough to get nalfar out there and kill the warlocks then you need to kill the other ogres yourself.

1 Like

@abc told me to do that but the soldier walks so slow and the archers dont even move at all

1 Like

I did it and you didn’t kill the shaman in the back.

1 Like

yeah I know…

1 Like

Use the archer that got sent over there to kill that one

1 Like

but the a soldier goes thare and he just floats in the air and does nothing

1 Like

than command him to attack the shaman. I did it I bet you can. You are a great coder and I have faith in you.

1 Like

LOL not true for me :grin:

2 Likes

well I need to go now but ill be back later (I think) (maybe)

1 Like

Uh, @milton.jinich? I think the shamans cast antigravity and fear, so the soldier couldn’t attack if he wanted to.

yeah thats what happens to the soldier

oh I meant when the soldier got shot up in the air

Attacking the yeti doesn’t work unfortunately. If you make the archers attack too early they get stuck and can’t move. You have to let them get transported upwards a bit.
Here’s a key hint:
Don’t make the archers attack.
Make the paladins and soldiers attack when the y pos is greater than 60. That way one shaman will be killed, and the freed soldier can free the others. Remember, time is not really a problem.
Make sure in the early stages of the level you make sure just the soldier and paladin are attacking, and only when their y poss’ are above 60.
I would normally say you should experiment with it, but tbh, this level is a bit silly, and a bit of a waste of time slightly, so I think it’s fair to help you with the start. The rest of the level is hard enough as it is!

2 Likes

Thanks a lot for the tips deadpool :grin:
ill make sure to try them

I first went to the middle dodging the electric balls, then I used flags to command my troops. I just commanded the paladin to sheild and command my archers to free all my soldiers then go attack Nalfar.

1 Like

I think that is a good strategy. But your friends have to find the flags.

No they don’t, I just used

hero.command(friend, "move", flag.pos)

Yeah they do you do

flag = friend.findFlag("green")