Kithgard brawl problem please

while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        if hero.isReady("cleave"):
            hero.cleave(enemy)
        else:
            hero.attack(enemy)
    else:
        if hero.findNearestItem():
            hero.attack(hero.findNearestItem())
        else:
            hero.say("message")

Hello, can someone explain me why does my hero stop attacking after finding health pot?

Please learn to post your code correctly. The way it is now, we can’t see the structure. Help us help you. It’s very easy to do and just takes a tiny bit of effort. Please read this topic and format your code again correctly

actually i was wondering, how the heck would someone read my “copy/paste” code and concluded “ah ok i am beginner they possibly are code-reading machines” :wink:

You can’t attack items. Try moving to the item’s position instead.

but i actually get this health pot but after getting it, it stops

am i right that after getting to health pot position, my hero tries to attack it and thats why he stops?

I don’t understand how you’re hero could move to the coin. Like Munkey said, you can’t attack an item. You should get a big red cross error around your hero and not be able to do anything else.
Is this (the code you posted) still your current code?
:lion: :lion: :lion:

I can quarantee hero will move to Item position. Try it. Is this some kind of bug?

It’s a previously reported bug. Can I ask why you’re trying to attack an item?

Cause i am beginner and i instinctevely thougt its ok. I havent discovered item.pos. commands.