Sarven Brawl scanning for enemies


#1

The level has neutral yaks on it, which can take you out easily and (I assume) are mean’t to be ignored.

Issue is — as far as I can remember up until this point in levels only findNearestEnemy() was introduced. So if yak is nearest and you are not attacking it then loop locks up and ranged enemies take you out.

It would be a good level to introduce and/or require glasses and concept of looking for enemies which aren’t nearest.


#2

Great. now I completed it and it got stuck on saving progress… shows as completed, no reward, no new levels. :frowning:

I am slightly confused between regular and adventurer preview levels, but is this last one at the moment? I got like two emails in inbox announcing levels I am still not seeing.


#3

You should have access to 5 new levels, all can be accessed directly from the email, or from the map. One is on the Forest level and is unlocked when you complete Munchkin Swarm (unfortunately, you have to beat the level again for now to show it. The other levels are on the desert map in different locations:

Again, you may need to complete levels again in order for them to show up on the map.

As for sarven brawl, if you reload the map, you should be on a more difficult edition that will earn more gems and XP, it does lock up a bit on first completion.


#4

I see none of the levels in your screenshot above Yakstraction. :frowning: Will try to reply some later today.


#5

Try resubmitting Yakstraction, that should open them up. Or just click the link from the email to get them.


#6

Resubmitted Yakstraction, didn’t open them… Will chase down links in email later.


#7

Ok, I pieced missing levels together from emails. I guess that’s were “missing” introduction to scanning for enemies and skipping yaks was too.


#8

Interesting post about when players learn your method. I am a newbie programmer (almost all of what I know I learned here. I assumed that I needed to use enemy.type to determine what was a Yak and what was not. I picked that method up in the forest levels.

so I used:

target=self.findNearest(self.findEnemies())
    if target:
        if target.type is not "sand-yak":
            enemy=target
    if enemy:
        blah blah blah

#9

be very careful about using AOE (area of effect) skills / spells on this level. those will hit the yaks as well and it get nasty rather quickly.

cleave, lightning stick, shockwave, etc


#10

That is correct, but doesn’t handle the problem I opened with. If you only have “nearest” concept to work with than you cannot express “nearest enemy that isn’t yak”. You can only check “if nearest enemy is yak or not”.

So if you have yak 5m away and thrower 10m away then character is happily doing nothing, staring at yak, while thrower keeps shooting.


#11

It’s recommended to have the mahogany glasses or better so you can iterate over the enemies array. I guess we actually just started introducing that in the latest Adventurer levels, like Lurkers.

I’m running an achievement recalculation thing now; hopefully it will correct a lot of the missing level links that weren’t hooked up the first time players beat these levels. It’ll take a few hours. Let me know if any levels magically show up that didn’t before.


#12

My hero starts off targeting the Yak first, even walking by an enemy to do so. I’ve tried with all the AOE deleted, but the result was the same.

Why the Yak obsession? Especially when I coded to ignore sand-yak?

// Stay alive for one minute.
// If you win, it gets harder (and more rewarding).
// If you lose, you must wait a day before you can resubmit.
// Remember, each submission gets a new random seed.
loop {
    var enemy = this.findNearest(this.findEnemies());
    var flag = this.findFlag();
    
    if (flag) {
        var flagPosition = flag.pos;
        fx = flagPosition.x;
        fy = flagPosition.y;
        this.pickUpFlag(flag);
    }
    if (enemy) {
        if (enemy != "sand-yak") {
            if (enemy && this.isReady("electrocute") && this.distanceTo(enemy) < 20){
                this.electrocute(enemy);
            }
            else if (enemy && this.isReady("bash") && this.distanceTo(enemy) < 3) {
                this.bash(enemy);
            }
            else {
                this.attack(enemy);
            }
        }   
    else {
        this.shield();
    }
}
}

#13

I’m pretty sure you check the enemy’s type by adding .type to it. Try if (enemy.type != "sand-yak")


#14

Thanks @ChronistGilver I missed the

.type

#15

While I was adding “improvements” I broke my code somehow. Now my hero no longer attacks but sits there and gets clobbered. Can anyone point out what I’m blind to see?

// Stay alive for one minute.
// If you win, it gets harder (and more rewarding).
// If you lose, you must wait a day before you can resubmit.
// Remember, each submission gets a new random seed.
loop {
    var flag = this.findFlag();
    var enemies = this.findEnemies();
    var enemyIndex = 0;
    while (enemyIndex < enemies.length) {
        var enemy = enemies[enemyIndex];
        enemyIndex++; 

        if (flag) {
            var flagPosition = flag.pos;
            fx = flagPosition.x;
            fy = flagPosition.y;
            this.pickUpFlag(flag);
        }
// ... but only attack 'thrower' or 'shaman' type enemies.
// And don't forget to use your special abilities!
        else if (enemy && enemy.type != "sand-yak"){
            
            if (enemy.type == "thrower" || enemy.type == "shaman") {
                if (this.isReady("electrocute") && this.canElectrocute(enemy) && this.distanceTo(enemy) < 21) {
                    this.electrocute(enemy);
                }else{
                    this.attack(enemy);
                }
            }
        }
    }
// Then loop through all the enemies again...
loop {
enemy = this.findEnemies();
enemyIndex = 0;
    while (enemyIndex < enemies.length) {
        enemy = enemies[enemyIndex];
        enemyIndex++; 

// ... and take out everyone who's still standing.
    if (enemy && enemy.type != "sand-yak") {
        if (this.isReady("electrocute") && this.canElectrocute(enemy) && this.distanceTo(enemy) < 21) {
            this.electrocute(enemy);
            }else if (this.isReady("bash") && this.distanceTo(enemy) < 4) {
            this.bash(enemy);
            }else{
            this.attack(enemy);
            }
        }
    }
}
}

#16

It’s possible that a Sand Yak is your closest enemy. Perhaps add a condition about what happens if this is so?