so right now i’m stuck at Kelvintaph Defiler, when i command my 2 soldiers to attack the necromancer, they go to his position to attack him, but by that time my paladin is already killed.
here is my 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.
var safe = false;
while (true) {
var killedshaman = hero.findFlag("green");
if (!safe) {
hero.move({
x: 35,
y: 9
});
}
var allymove = hero.findFlag("black");
var remove = hero.findFlag("violet");
if (remove) {
hero.removeFlag(remove);
safe = true;
hero.removeFlag(allymove);
}
var paladin = hero.findByType("paladin", hero.findFriends())[0];
hero.command(paladin, "cast", "heal", paladin);
var friends = hero.findFriends();
for (var i = 0; i < friends.length; i++) {
var friend = friends[i];
var enemy = "Gror";
if (hero.time > 1.65 + i * 0.525) {
if (!killedshaman) {
if (friend.type != "paladin") {
hero.command(friend, "attack", enemy);
} else {
hero.command(friend, "shield");
}
} else {
enemy = "Nalfar";
if (enemy) {
if (friend.type != "paladin") {
hero.command(friend, "attack", enemy);
} else {
hero.command(friend, "shield");
}
}
}
}
if (allymove&&friend.type!="paladin") {
hero.command(friend, "move", allymove.pos);
}
}
}
any suggestions guys??