While ogres were sleeping need help

This is my code but its not working, any ideas?

while pointIndex < len(points):
    point = points[pointIndex];
    hero.moveXY(point["x"], point["y"])
    enemy = hero.findNearestEnemy()
    coin = hero.findNearestItem()
    # Attack only if the enemy.team is "ogres"
    # AND the enemy's health is less than 10
    if enemy.team == "ogres" and enemy.health < 10:
    # Collect a coin if coin.value is less than 5
    # AND its distance is less than 7
    if coin.value < 5 and hero.distanceTo(coin) < 7:
        hero.moveXY(coin.pos.x, coin.pos.y)
    # Attack only if the enemy.health is less than 10
    # AND the enemy's type is "skeleton".
    if enemy and enemy.team == "skeleton" and enemy.health < 10:
    pointIndex += 1
1 Like

my hero doesn’t kill a skeleton when he should

1 Like

Please read While ogres were sleeping. This will most likely help you for your case.

“Skeleton” isn’t a team. You missed typed enemy.type == “skeleton” as enemy.team == “skeleton”