Chain of Command Help Needed


Below is my code, every time this seems to be exactly what’s needed, yet always one ogre gets by and I’m unable to find a way to stop him. I am not allowed to build in this level either or I’d block him into the flames.

Only your pet can wake the wizard up.

def onHear(event):
# “hear” events set the event.speaker property.
# Check if the pet has heard the hero:
if event.speaker == hero:

Assign the event handler for “hear” event.

pet.on(“hear”, onHear)

while True:
enemy = hero.findNearestEnemy()
# If there is an enemy:
if enemy:
# Use hero.say() to alert your pet
hero.say(“Wake Him Up!”)
# Move to the X in the camp.
hero.moveXY(30, 33)
# Then return to the X outside the camp.
hero.moveXY(30, 15)


Please make sure that ALL of your code is pasted in between the triple back ticks or only some of it will be formatted properly.