New level : Bonemender

If I understand correctly, we need to buy a new hero (again).
Sorry, I don’t have enough gems. Maybe I spend too much on armor in a previous level. I don’t know we could be blocked because of a lack of gems.

And sorry again, but I’m not ready to pay real € just to buy gems and test levels.

Maybe with a possibility to sell uneeded items, I could reverse what I bought by mistake.

Selling is on our list, but it may take us a while. If you can’t snag the basic wizard now, you’ll probably be able to as soon as we release a few more levels, since the wizard only costs around ~4 levels’ worth of gems around the end of the forest campaign. We are currently targeting it such that you can keep playing the campaign and buying all the required gear without buying extra gems, but not necessarily being able to do all the side levels and get the extra heroes.

I’m at the same point. I beat the ranger and wizard level before they restricted the levels, so I got those gems. Haven’t unlocked either hero left, but with my earlier purchases I have 791 gems left, so I can get one but not the other. Maybe for the sake of early testing there could be a “reset purchases” button that removes all purchased items and returns the gems. Not sure if this is a simple process or not. With the new bash stats on shields I’m wishing I’d purchased a different shield, but even more, with the new heroes, I would love to be able to test them out.

2 Likes

I beat the level with the correct code for the first part, but I think I didn’t use the right code for the second part, and I still beat it. Here is a screenshot of the bottom/attack part of my code. Not sure if I’m passing by something I’m supposed to be learning.

… Now I’ve gone back and pressed Submit and it says I’m failing. Still need to write the bottom part of that code I think :smile:

I’ve added some code to find the enemies that are closer than 10 distance and attack them at the bottom, but it still says I’m failing. This part of my code is highlighted in red:

var enemy = this.findNearestEnemy
      if (this.attack(enemy)) {

Not sure what to do! Thank you ahead of time!! Here is my full code:

// Heal allied soldiers to survive the siege.
loop {
if (this.canCast("regen")) {
    var bernardDistance = this.distanceTo("Bernard");
    if (bernardDistance < 10) {
        // Bernard needs regeneration!
        this.cast("regen", "Bernard");
    }
    
    // Use "if" and "distanceTo" to regenerate "Chandra"
    if (this.canCast("regen")) {
     var chandraDistance = this.distanceTo("Chandra");
    // if she is closer than 10 meters away.
if (chandraDistance < 10) {
this.cast("regen", "Chandra");
}
    
}
else {
    // If you aren't casting "regen", use "if" and "distanceTo"
    // to attack enemies that are closer than this.attackRange.
    
    var enemy = this.findNearestEnemy();
      if (this.attack(enemy)) {
    var enemyDistance = this.distanceTo(enemy);
    if (enemyDistance < 10) {
        
    if (enemy) {
    this.attack(enemy);
    }
}
}
}
}
}

Almost got it! Just change if (this.attack(enemy)) to if (enemy) and you should be good to go.

Thanks. That did help that line (it’s now high-lighted in green), but now the line after it is high-lighted in red. It says I have to find the distance to a target unit:

 var enemyDistance = this.distanceTo(enemy);

Here is my code:

// Heal allied soldiers to survive the siege.
loop {
if (this.canCast("regen")) {
    var bernardDistance = this.distanceTo("Bernard");
    if (bernardDistance < 10) {
        // Bernard needs regeneration!
        this.cast("regen", "Bernard");
    }
    
    // Use "if" and "distanceTo" to regenerate "Chandra"
    if (this.canCast("regen")) {
     var chandraDistance = this.distanceTo("Chandra");
    // if she is closer than 10 meters away.
if (chandraDistance < 10) {
this.cast("regen", "Chandra");
 }
    
}
else {
    // If you aren't casting "regen", use "if" and "distanceTo"
    // to attack enemies that are closer than this.attackRange.
    
    var enemy = this.findNearestEnemy
      if (enemy) {
    var enemyDistance = this.distanceTo(enemy);
    if (enemyDistance < 10) {
        
    this.attack(enemy);
    
}
}
}
}
}

Oh, I see. this.findNearestEnemy needs parentheses: this.findNearestEnemy(). Otherwise it’s just referencing the function (which does exist and can pass the if check on the next line) instead of calling it to get an enemy result.

Here’s what I’ve got. I used everything that the instructions asked for and it works fine. I had to use two different “if” statements and define the variables in different places than what I had originally used for the attack portion of the code. It’s a bit bothersome that the code didn’t work the first way I had it. I guess I don’t understand the formatting of code fully.

// Heal allied soldiers to survive the siege.
loop {
    if (this.canCast("regen")) {
        var bernardDistance = this.distanceTo("Bernard");
        if (bernardDistance < 10) {
            // Bernard needs regeneration!
            this.cast("regen", "Bernard");
        }
    }    
        // Use "if" and "distanceTo" to regenerate "Chandra"
        // if she is closer than 10 meters away.
        if (this.canCast("regen")) {
            var chandraDis = this.distanceTo("Chandra");
            if (chandraDis <10) {
                this.cast("regen", "Chandra");
            }
        }
    else {
        // If you aren't casting "regen", use "if" and "distanceTo"
        // to attack enemies that are closer than this.attackRange.
        var enemy = this.findNearest(this.findEnemies());
        if (enemy) {
            var enemyDist = this.distanceTo(enemy);
            if (enemyDist <this.attackRange) {
            this.attack(enemy);
        }
    }
}
}

This is how you format your code.

// Heal allied soldiers to survive the siege.
loop {
    
    if (this.canCast("regen")) {
        var bernardDistance = this.distanceTo("Bernard");
        if (bernardDistance < 10) {
            // Bernard needs regeneration!
            this.cast("regen", "Bernard");
        }
    }
        
    // Use "if" and "distanceTo" to regenerate "Chandra"
    // if she is closer than 10 meters away.
    if (this.canCast("regen")) {
        var chandraDis = this.distanceTo("Chandra");
        if (chandraDis <10) {
            this.cast("regen", "Chandra");
        }
    } else {
        // If you aren't casting "regen", use "if" and "distanceTo"
        // to attack enemies that are closer than this.attackRange.
        var enemy = this.findNearest(this.findEnemies());
        if (enemy) {
            var enemyDist = this.distanceTo(enemy);
            if (enemyDist <this.attackRange) {
                this.attack(enemy);
            }
        }
    }
}

And here a little improvement for your casts.

// You just have to check once, if you can cast regen
if (this.canCast("regen")) {

    // If you are able to, heal Bernhard
    if (this.distanceTo("Bernard") < 10) {
        this.cast("regen", "Bernard");

    // Else heal Chandra
    } else if (this.distanceTo("Chandra") < 10) {
        this.cast("regen", "Chandra");
    }
}

Sorry to ask a silly question, but where is this level ? I can’t find it (and yes I know, I’m the one who created this topic :weary:). I supposed it’s near Arcane Ally, but I can’t find it anymore.

To answer another post, I was obliged to search all the worlds for a defined level. As the number of level increase, It’ll be time to propose a tool to find levels by names or to view a list for direct access.

Required levels:
Forest > Shield rush
Forest > Arcane Ally [Subscriber]
Forest > Touch of Death [Subscriber]

It’s over here in the forest:

Good point about it being hard to find levels. If you know the name of the level (ex.: “The Level Name”), you can type it in like this:

Ok thanks for the information. So I don’t have access. I did only Arcane Ally.
I suppose I did not try it because of the lack of gems to buy the hero (during the testing period), and now I can’t go there because I’m not a subscriber.

I finally get acces to it.

Funny : without changing the default code, It succeded ! One of soldier dies, but that’s not a problem because only the peasant should be alive at the end.

Ah! Let me make it so that the soldiers must survive. Was the ogre attacking you but didn’t have time to kill you, or…?

Edit: Actually, I can’t reproduce; level should end as soon as first human dies. When does first human die for you?

I’ll check again, but If I remember, only the lady dies.

Edit: You’re right, with the default code it fails.
So maybe I forgot one step : I should have just change the code to heal Chandra. And it works without the last part:

// Soignez les soldats alliés pour survivre au siège.
loop {
    if (this.canCast("regen")) {
        var bernardDistance = this.distanceTo("Bernard");
        if (bernardDistance < 10) {
            // Bernard a besoin d'être régénéré!
            this.cast("regen", "Bernard");
        }
        
        // Utilisez "if" et "distanceTo" pour régénérer "Chandra"
        // Si elle est à moins de 10 mètres.
                if ( this.distanceTo("Chandra") < 10) {
            // Bernard a besoin d'être régénéré!
            this.cast("regen", "Chandra");
        }
        
    }
    else {
        // Si vous ne lancez pas "regen", utilisez "if" et "distanceTo"
        // Pour attaquer les ennemis qui sont plus proches. this.attackRange.
        
        
    }
}

But I was near sure that one time it succeeded with Chandra dying.

Just a small “bug”: the goal says “save all peasants”. I saved them all, but I was still failing, as I was losing an archer in the fight… I only found out here that:

So it would be useful to change the goal to “save all humans” or “save all friends”.

I’ve updated that description, thanks!

1 Like

Bonememder can be solved without writing any line of code, just click run and you are successful.

Even worse, writing the code that heals your soldiers actually breaks the pattern and kills your soldiers.
Why this happens? When you heal a soldier, he will go back to the enemies immediately, so all the future events on the level change. Once he goes away he will tank the enemies and he will receive more damage that if he was not healed at all.

At some point, you will need to heal again, and this time both soldiers will need healing. Healing the wrong one will fail the level.

Shortly: you heal them, you kill them :slightly_smiling:

Solution:
change the heal distance check to <12, it changes the healing pattern and you can pass the level with the intended code.
Smarter, but more work: code the soldier to go close to you only if
- their health is under a threshold
- they have less health than their friend.
So you will automatically heal the correct solider while the other tanks.
Also, make the enemies wait a bit before charging, so they will not end up fighting your soldiers into the healing zone.