This has happened in a few levels, the enemy is dead and the code stops. Sometimes I get the “but it’s dead” notice but not always. I tried modifying my pet process to filter by the enemy health but no change.
def petBattle():
while True:
pet.moveXY(hero.pos.x -1,hero.pos.y)
if enemy:
if distance < 10 and pet.isReady("cold-blast"):
pet.coldBlast(enemy)
pet.on("spawn", petBattle)
while True:
enemy = hero.findNearestEnemy()
if enemy and enemy.health > 0:
distance = hero.distanceTo(enemy)
if hero.isReady("flash") and distance < 10:
hero.flash(enemy)
if hero.canCast("chain-lightning"):
hero.cast("chain-lightning",enemy)
else:
hero.attack(enemy)
if enemy and enemy.health < 0:
enemy = hero.findNearestEnemy()
flag = hero.findFlag("green")
if flag:
hero.pickUpFlag(flag)