Help with Operation Killdeer [PYTHON] {SOLVED}

Here is my code…

while True:
    enemy = hero.findNearestEnemy()
    def shouldRun():
        if hero.health < hero.maxHealth / 2:
            return True
        else:
            return False
while True:
    if shouldRun():
        hero.moveXY(75, 37)
    else:
        hero.attack(enemy)

@moonwatcher348 @enPointe77 can i have some help, ANYONE!!!

You don’t need while True here. You should put the function (def) outside it.

Also, here,

who is the enemy you are trying to attack? You should determine it.

1 Like

I don’t think there is any enemy to attack. So that’s why it probably, I’m assuming, didn’t work.

That is one of two mistakes. Check my message above.

I know. I saw that message, I just wanted to kinda “summarize” it. :smile:

2 Likes

thx evryone, i finally figrd it out, thx again

2 Likes