I’ve hit a problem and I’m not sure if it’s me or a bug.
On the Lurkers level, you are able to use the following code snipped to dispatch the baddies:
while enemy.health > 0:
After you kill each shaman, the while loop stops and the script moves you onto the next target.
Experimenting with similiar code on the Sarven Brawl level, I tried using the following snippet (similiar to the one used on the Lurkers level):
loop: drop = self.findNearest(self.findItems()) enemy = self.findNearest(self.findEnemies()) if enemy: while enemy.health > 0: self.say(enemy.health) self.say(enemy.type) self.attack(enemy) else: self.moveXY(drop.pos.x, drop.pos.y)
What happens is not what I expected. When my hero goes after the Ogre whose near where you start, he says “120” (the enemy health) and starts to attack. However, despite hitting and eventually killing the Ogre, my hero keeps repeating “120” and just stands over the corpse, stuck in that while loop.
I’ve checked and there’s no other active Ogre on the screen. At first, I thought this might be because the health attibute(?) doesn’t automatically update. However, I went back and checked on Lurkers, using the exact same loop, and it’s clear that the health attribute of each Shaman is dynamically updating in that level.