Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Leave It To The Cleaver PLS HELP PLS

my code is # The function defines a parameter called target
def cleaveWhenClose(target):
if hero.distanceTo(target) < 5:
pass
# Put your attack code here
# If cleave is ready, then cleave target
hero.cleave(enemy)
# else, just attack target!
if enemy:
enemy = hero.findNearestEnemy()
hero.attack(enemy)

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)
if enemy:
hero.attack(enemy)
and i have been on this for a few weeks i am very confused with what i go incorrect pls someone help me(preferably post the answer) Thank you.

pls someone answer :face_with_monocle: :face_with_monocle: :face_with_monocle: :face_with_monocle: :face_with_monocle: :face_with_monocle: :face_with_monocle: :face_with_monocle: :face_with_monocle: :face_with_monocle: :face_with_monocle: :face_with_monocle: :face_with_monocle: :face_with_monocle: :face_with_monocle: :face_with_monocle: :face_with_monocle: :face_with_monocle:

Hi Musa…welcome to the forum!

First, please understand that we have members from all around the world, but we aren’t always on the forum. It is possible that someone may not get to your question for as much as 24 hours, or longer. Please be patient.

Second, you need to properly format your code when posted. With out the this formatting, we won’t be able to properly troubleshoot your code. You can learn how to do this here: [Essentials] How To Post/Format Your Code Correctly

Third, we will not simply provide a solution. However, we will help, guide, answer questions, etc.

Please repost your code, in the proper format, and we’ll work with you from there.