level uses hero.findNearest(hero.findEnemies()) method but it targets artillery 1 and it wont attack enemies just trying to reach artillery 1 that behind fences and run out of time or dies from non brawler mobs, rest of the code working.
Here’s code from that level:
Those artillerymen don’t understand you.
Your pet should translate commands.
This is an event handler for the pet’s “hear” event.
def translate(event):
# Get the message that was heard.
message = event.message
# If the message is “North”:
if message == “North”:
# The pet says “Htron”.
pet.say(“Htron”)
pass
# If the message is “South”:
if message == “South”:
# The pet says “Htuos”.
pet.say(“Htuos”)
pass
# If the message is “East”:
if message == “East”:
# The pet says “Tsae”.
pet.say(“Tsae”)
pass
Assign the event handler.
pet.on(“hear”, translate)
while True:
enemy = hero.findNearest(hero.findEnemies())
# Don’t attack Brawlers.
if enemy and enemy.type != “brawler”:
hero.attack(enemy)