[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);
    }
}
1 Like

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.

1 Like

Hi Wolftein,

What level was?

edit:

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

1 Like

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.

2 Likes

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).

1 Like

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.

2 Likes

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

1 Like

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

1 Like

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

1 Like

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").

1 Like

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)
1 Like

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

1 Like
else:
      if enemy:
             if self.isReady("cleave"):
                   self.cleave(enemy)
             else:
                  self.attack(enemy)
2 Likes

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

1 Like

thank you,Or a failure

1 Like

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

1 Like

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

1 Like

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

1 Like

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!

1 Like

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

1 Like