Pet translator level bug


#1

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)


#2

Are you using “Twilight Glasses”?


#3

yes and I get it now, I must use glasses without see thrue wall )))


#4
# Your pet should translate commands.
 
def onHear(event):
    # The message the pet heard is in event.message
    message = event.message
    # If the message is "North":
    if message == "North":
        # The pet says "Htron".
        pet.say("Htron")
    # If the message is "South":
    if message == "South":
        # The pet says "Htuos".
        pet.say("Htous")
    # If the message is "East":
    if message == "East":
        pet.say("Tsae")
        # The pet says "Tsae".
        

# Assign the event handler.
pet.on("hear", onHear)

while True:
    enemy = hero.findNearestEnemy()
    # Don't attack Brawlers.
    if enemy and enemy.type != "brawler":
        hero.attack(enemy)
    else:
        hero.moveXY(31, 27)

Help, this does not work, when my griffin says “Htous”, the artillery man says “Erhew ot toohs?” Then, they do not attack the Brawlers.


#5

Htous != Htuos

20characters