It was what I said
1 Like
No, it’s OK, it’s just funny.
1 Like
Try to write
if hero.isReady("cleave"):
hero.cleave(target)
else:
hero.atack(target)
Instead of:
if (hero.isReady("cleave")):
hero.cleave(enemy)
else:
hero.attack(enemy)
It still does not work.
Try to write
if hero.isReady("cleave"):
hero.cleave(target)
hero.atack(target)
else:
hero.attack(target)
It still does not work. Maybe it’s a bug or something
Do you dying or what?
No it’s saying defeat the ogres is incomplete when there is none.
Can you send your program?
def cleaveWhenClose(target):
if hero.distanceTo(target) < 5:
pass
# Put your attack code here
# If cleave is ready, then cleave target
if hero.isReady("cleave"):
hero.cleave(target)
hero.attack(target)
# else, just attack `target`!
else:
hero.attack(target)
#hero.shield
# This code is not part of the function.
while True:
enemy = hero.findNearestEnemy()
if enemy:
# Note that inside cleaveWhenClose, we refer to the `enemy` as `target.
cleaveWhenClose(enemy)
You wrote hero.attack(target) in if hero.isReady, you don’t have to do that. You have to write:
if hero.isReady("cleave"):
hero.cleave(target)
hero.attack(target)
It still doesn’t work?
Noooooooooo does not work.
I put a bunch of o’s because I did not know what else to put and it was not 20 characters.
Try to remove double attack in else.
It still says defeat the ogres but there are none.
Maybe you can’t see some?
What do I need to do then.