Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Medical Attention


Hey Guys! On CodeCombat, I’m currently stuck on this level. I need help!
This is my code:

// Ask the healer for help when you're under half health.
// Buy the Polished Sense Stone for health documentation.
loop {
    var enemy = this.findNearestEnemy();

    currentHealth =;

    healingThreshold = this.maxHealth / 2;

    this.moveXY(66, 46);

    this.say("heal me!");

    // If your current health is less than the threshold,

    // move to the healing point and say, "heal me"
    // Otherwise, just attack enemies.

    this.moveXY(55, 35);



There’s a lot of stuff wrong with that at first glance.

You aren’t checking your health anywhere.

You need it setup something like

If currentHealth < healingThreshold then move to coord and say heal me
else if enemy then attack enemy