New Level: Shrapnel

Check it out here. Not only do rangers have daggers, they can also fling charges. We designed this level to introduce AoE attacks and the concept of ranged weapon’s effectiveness against groups of enemies. After this level, it’s back to the main campaign trunk.

Something is missing and I can’t equip my hero with what is needed. The arrow to show what’s missing is at the bottom of the screen. We’ve already seen this bug in another level, an item was not ready to be taken.
Maybe it’s because I can’t do swift-dagger ?

You need to do Swift Dagger first. I just saved a change to it; if you try again, does it work?

No changes on my side, still the arrow in the bottom of the screen.

Interesting level. Shows some different stuff.
I went through and put in the code as directed, but the first two times I ran it I didn’t quite make it through. In both those cases a group of ogres would come in, but would be from behind a tree or rock, which would then split up the group, and so things would go a bit off from there. Third time it worked. Was this intentional?

I’ve made some of those doodads uncollidable, so they shouldn’t interfere with the random spawning clustering any more.

As I can do the previous level, now it works ok.

I’m having issues too. When I do the level, when a group of three comes, the frontmost munchkin will get blown up, but i have not enough time to shoot the other two.

What’s your username? I’ll check it out to see if there are any further issues with the random seeds in this level.

I can’t add the swift dagger. i can only use the bow. Also once I get hit, my hero will no longer shoot her bow. I can’t figure out the issue. I get through the first couple of waves. But the third wave one of the people get close enough to hit me and I stop shooting.

// Use charges to soften up packs of ogres.
// Then pick them off with your bow.

loop {
    var enemy = this.findNearestEnemy();
   if (enemy) {
        
       var distance = this.distanceTo(enemy);
        if (this.isReady("throw")) {
           if (15 < distance) {
            // Throw your dagger at the enemy.
           this.throw(enemy);
           }
            // Only throw if the ogres are more than 15m away.
            // Use "if" to compare distance to 15.
            
            // Use "else" to attack if you're not throwing.
            
        }
       else {
            
            this.attack(enemy);
            
        }
    }
}

You need to to use else to trigger this.attack(enemy) for either when the enemy is closer than 15m, or when "throw"is not ready. So add another else { this.throw(enemy); } after the if (15 < distance) if-statement, and you’ll also attack when they’re getting close to you.

Hope this helps!

This is my code. I combined some elements from the previous level with this one. There are no error messages and both the throw and shooting arrows works. The level still says, “Blow up the ogres: X. Level: Failing”. I’m not dying and the ogres are. Any ideas? Here is my code:

// Use charges to soften up packs of ogres.
// Then pick them off with your bow.

loop {
var enemy = this.findNearestEnemy();
if (enemy) {
    if (this.isReady("throw")) {
        var distance = this.distanceTo(enemy);
        // Only throw if the ogres are more than 15m away.
               if (distance > 15) {
        // Use "if" to compare distance to 15.
            this.throw(enemy);
    }
        // Use "else" to attack if you're not throwing.
        
    }
    else {
        this.attack(enemy);
    }
}
}

Hey clare12345, I just checked it out. I think you do end up dying on the later waves. The problem, actually, is the same as in the previous post: you use else to attack when throw isn’t ready, but you don’t use else to attack when the enemy is closer than 15m, so you end up just standing there getting sworded.

1 Like

thanks. that worked.

Here’s what I’ve got. Everything works fine. You need to add only two lines of code and an extra “}” at the end to close the loop.

// Use charges to soften up packs of ogres.
// Then pick them off with your bow.

loop {
    var enemy = this.findNearest(this.findEnemies());
    if (enemy) {
        if (this.isReady("throw")) {
            var distance = this.distanceTo(enemy);
            // Only throw if the ogres are more than 15m away.
            // Use "if" to compare distance to 15.
            if (distance > 15) {
                this.throw(enemy);
            // Use "else" to attack if you are not throwing.
        }
        else {
            this.attack(enemy);
            }
        }
    }
}

I am having the same issue as Da_dude. My username is DORRITO.

Code running fine, but the bomb only kills the first group, might aoe damage the others, but only will kill 1 from each group after the first, then I die right near the end.

If i buy more armor i’d be ok! But didn’t think for a character introduction level that i’d need to.

Tried reading through previous post, and I must be missing something small. Heres my code just in case:


loop {
    var enemy = this.findNearestEnemy();
    if (enemy) {
        if (this.isReady("throw")) {
            var distance = this.distanceTo(enemy); 
     if (distance > 15) 
        {this.throw(enemy); }       // Only throw if the ogres are more than 15m away.
        
     else {this.attack(enemy);}
       
                                      }
            }
}

Hmm; how much health do you have? My tests with that code have me taking only around 7 damage across four seeds I just tried.

13! Last test I took 4 damage on each wave after the 1st.

1st wave bomb kills both, after that, bomb kills one from each wave, aoe damages others, and i take a little damage after they get to me before my character kills them.

edit well that was weird. Did a final test and survived with 1 hit point. So complete.

** edits edit ** did once more to make sure, and didn’t survive. hmm.

Ah, I see. I formatted your code better and noticed that you only attack if throw is ready. Instead, you need to also attack if throw is not ready, or you will just be standing there.

loop {
    var enemy = this.findNearestEnemy();
    if (enemy) {
        if (this.isReady("throw")) {
            var distance = this.distanceTo(enemy);
            if (distance > 15) {
                this.throw(enemy);
            } // Only throw if the ogres are more than 15m away.
            else {
                this.attack(enemy);
            }
        }
        // Attack here, too, using another else.
    }
}

I really appreciate your time and assistance!

I Didnt understand right away why my current else didn’t do that, but then I figured it out. Thanks for the formatting help as well. You’re awesome!

1 Like