Forest Miners: Is this a bug?


#1

Hi guys so I was just playing the level Forest Miners and I not sure if this is a bug or not but when my hero say Clear after that an ogre spawn and started to attack me and my peasant.:confused:
Just in case here is my code

# Check if the mines are safe for the workers.
def checkEnemyOrSafe(target):
    # If target (the parameter) exists:
    if target:
        # Then attack target.
        hero.attack(target)
    # Otherwise:
    else:
        # Use say() to call the peasants.
        hero.say("Clear!!!!!")
    pass
while True:
    # Move to, and check the top right X mark.
    hero.moveXY(64, 54)
    enemy = hero.findNearestEnemy()
    checkEnemyOrSafe(enemy)
    # Move to the bottom left X mark.
    hero.moveXY(16, 14)
    # Save the result of findNearestEnemy() in a variable.
    enemy = hero.findNearestEnemy()
    # Call checkEnemyOrSafe(), and pass the
    # result of findNearestEnemy as the argument.
    checkEnemyOrSafe(enemy)

#2

Maybe just a timing issue? Try experimenting with different types of boots. Different boots have different speeds and can get you there faster (or slower in the case of the Defensive Boots) depending on what you want. If you are a subscriber, try testing with different classes of heroes (warrior, ranger, wizard).


#3

Twilight Glasses or Enchanted Lenses?


#4

Enchanted Lenses and also should I change it to a fast hero?


#5

I am using Boots of Leaping. Is that good enough?


#6

After one second.


#7

Hm, it’s weird. The speed should be fixed here. Could you say your CodeCombat nickname? I will try to research that problem.


#8

Thanks, I think my nickname is Minh2007 but I’m not sure.


#9

Thanks. I suppose I know where a problem is. I’ll fix it ASAP. you can try your code with a warrior with Long Sword for example.


#10

Thank you so much. :smile::sweat_smile::smile:


#11

Hi, i have the same problem here.

I’ve try without pet, without infinity lenses, different boots, but can’t come to “synchronisation” with the orcs.

My Pseudo is Mr_Tea! Thx


#12

Post your code so we can judge whether or not it’s a timing issue. Try not to revive dead threads if you can.


#13

The issue is exactly the same as Minh.

I’ve try several version of code and some copy-paste (like the one of Minh), always same result, the same as Minh.

Check if the mines are safe for the workers.

def checkEnemyOrSafe(target):
if target:
hero.attack(target)
else:
hero.say(“Quick !”)
pass

while True:
# Move to, and check the top right X mark.
hero.moveXY(64, 54)
enemy1 = hero.findNearestEnemy()
checkEnemyOrSafe(enemy1)

# Move to the bottom left X mark.
hero.moveXY(16, 14)
# Save the result of findNearestEnemy() in a variable.
enemy2 = hero.findNearestEnemy();
# Call checkEnemyOrSafe, and pass the
# result of findNearestEnemy as the argument.
checkEnemyOrSafe(enemy2)

#14

Please format your code according to the FAQ by using ctrl + shift + c so it is easier to read
argh this is a subscription level. Can’t help you on this one :frowning: ask Chaboi_3000 or one of the subscribed helpers for help instead.


#15

I haven’t seen the format problem, i’ve tried to correct it, but failed.
I try again tomorrow. Thx