[SOLVED] Lurkers level help (python)

(it didnt work at all.)

Try to put the enemies variable inside the loop.

ok (i hate 20 char rule)

its still not working

yknow what im too tired to keep doing this

ill just continue this tmr

Just delete line 8 and it will work fine :slightly_smiling_face:

2 Likes

this code is perfectly fine, apart from the fact that you need to indent line 15 and make the plus be before the equals, because ‘UAdd’ is ‘=+’ and it’s not a real operator

1 Like

deleting line 8 didnt work

it helped but didnt solve the “type” problem

First,
you need to make sure there is a enemy at all. try this:

if enemy:
    if enemy.type == "shaman":
        #put whatever here
1 Like

Also, you could cheat and kill everyone :smirk: (just make sure you have enough health, your runesword should be good enough)

1 Like

Oh, yeah, you need to put enemy and before the type part so that it checks if an enemy exists

# findEnemies returns a list of all your enemies.
# Only attack shamans. Don't attack yaks!
enemyIndex = 0

# Wrap this section in a while loop to iterate all enemies.
# While the enemyIndex is less than the length of enemies
while enemyIndex < len("enemies"):
    enemies = hero.findEnemies()
    enemy = enemies[enemyIndex]
    if enemy:
        if enemy.type == "shaman":
            while enemy.health > 0:
                hero.attack(enemy)
    # Remember to increment enemyIndex
    enemyIndex += 1
    

this is my code, i tried killing all the enmies and stuff bu tit didnt work

i found the problem, thank alll of you for helping me

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.