[SOLVED] Medical-Attention

It seems to always fail; my code is:

// Ask the healer for help when you're under half health.
// Buy the Polished Sense Stone for health documentation.
loop {
    currentHealth = this.health;
    healingThreshold = this.maxHealth / 2;
    // If your current health is less than the threshold,
    // move to the healing point and say, "heal me".
    // Otherwise, just attack enemies.
    if (currentHealth < healingThreshold)
    {
        this.moveXY(65, 46);
        this.say("heal me");
    }
    else
    {
        var x = this.findNearestEnemy();
        if (x !== null)
            this.attack(x);
    }
}

Enemies are being kill from one hit; and i’m not be able to complete the mission due to my humans die before killing the last ogre.

Hi Wolftein,

What level was?

edit:

I tested you code, and it works. So I do not know the cause of the problem.

I have it on my list to adjust this level to make it easier. Until then, you might want to try tanking more of the damage by waiting until maxHealth / 3, or trying a few random seeds to see if your soldiers can survive better.

I just kept slightly tweaking the amount of when i got healed (2.1, 2.2,1.9), and eventually it worked. I guess it would help if you bought additional health with gems (they don’t cost that much).

when you kill the first wave of enemy, your hero would stay idle for sometime. because findNearestEnemy=null. You need to move you hero to a better place to fight the second wave of enemy. So your chance of success will increase.

and health/3 is also needed, if you health is around 400.

instead of this.moveXY(65, 46), try (63,47) to avoid hero and humans collision.

Hello I would like help on this level also my code is not working here it is

// Ask the healer for help when you're under half health.
loop {
    this.warcry();
    
    var currentHealth = this.health;
    var healingThreshold = this.maxHealth / 2;
    if(currentHealth < healingThreshold){
        this.moveXY(65, 46);
        this.say("heal me");
    }
    else if (enemy){
    var enemy = this.findNearestEnemy();
    this.attack(enemy);
        
    }
    // If your current health is less than the threshold,
    // move to the healing point and say, "heal me".
    // Otherwise, attack. You'll need to fight hard!
    
}

All my code does is war cry and then nothing

You need to assign enemy before you check enemy, ideally at the start of your loop. Also you only want to warcry if this.isReady("warcry").

why? health 722
Sometimes succeed and sometimes fail!!!

  # Ask the healer for help when you're under half health.
    loop:
        currentHealth = self.health
        healingThreshold = self.maxHealth / 4
        # If your current health is less than the threshold,
        # move to the healing point and say, "heal me".
        # Otherwise, attack. You'll need to fight hard!
        enemy = self.findNearestEnemy()
        if currentHealth < healingThreshold:
            self.moveXY(65, 45) and self.say("heal me")
        else:
            if enemy:
                self.isReady("cleave") and self.cleave(enemy)
                self.attack(enemy)

楼上是我的代码,我的最大健康值是722
楼上的代码有时候成功,有时候会失败,一直没搞懂,

else:
      if enemy:
             if self.isReady("cleave"):
                   self.cleave(enemy)
             else:
                  self.attack(enemy)

The reason it is only working some times is because it was designed that way and I dont think anyone has found a strat that works all the time

thank you,Or a failure

设计成这样?
Designed to be like this?

kinda Im just guessing that because ive never seen anyone who finishes it 100% of the time

ok.thank you,原来如此!!!!

for the healer, I’ve found that saying “Heal me” 2 or 3 times helps to pop my hero back up to full health. Otherwise it only seems to heal a certain portion.

Also, I’ve found that a winning strat is to move your character to a mid-point between all 3 spawn spots when enemies are dead. And to make that spot be a point where your hero won’t have collisions with the ally NPC’s.

I think i’ll toss my current strat against the Submit button a number of times, and see what my win% is after about 10 mins.
edit fascinating. I have quite the skewed ratio! Some wins, and a bunch of losses. Peculliar!

As I said I have not found anyone who has finished it 100% of the time