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”
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?