So I’ve gotten to the level “Long-Range Division”, and there is a problem. One of the level’s goals is that the hostage must survive, but whatever I do, the ogres kill him. According to other threads, my code is correct, but when I approach the two ogres, they immediately kill the hostage before I can fight them. Any ideas on what to do?
It might be a bug, but it might also be an issue in your code. Could you post your code (formatting instructions at [Essentials] How To Post/Format Your Code Correctly), and we can try to run it… We can then give you help if it’s a code issue, or give more information to CoCo if it’s a bug.
var enemy = hero.findNearestEnemy();
var distanceToEnemy = hero.distanceTo(enemy);
// Say first Range: distanceToEnemy divided by 3
distanceToEnemy / 3;
hero.say(distanceToEnemy / 3);
// Say second range: distanceToEnemy divided by 1.5
distanceToEnemy / 1.5;
hero.say(distanceToEnemy / 1.5);
// Say these things for motivation. Really. Trust us.
hero.say("Woo hoo!");
hero.say("Here we go!");
hero.say("Charge!!");
// Now, use a while-true loop to attack the enemies.
while (true) {
if (enemy) {
hero.attack(enemy);
}
}
Also Tried to put name of the Enemy as an argument, but still cant attack second ogre.