Level: Leave it to Cleaver


#22

Nope the last 2 still live.


#23

The code is fine. Please respond with the hero you are using and post a screen shot of your equipment.


#24

How do you take screenshots on a google Chromebook.


#25

and Sir Tharin Thunderfist.


#26

Screenshots with Chromebook…http://bfy.tw/JsVW

`


#27


#28

I should have noticed this before. In your function, you don’t check to see if hero is ready to cleave. The code is getting stuck because it is constantly trying to cleave, even during the cleave cooldown period, which is 10 seconds.

def cleaveWhenClose(target):
    if hero.distanceTo(target) < 5:
        if hero.isReady("cleave"):
            hero.cleave(target)
        else:
            hero.attack(target)

or it can be combined on a single line:

def cleaveWhenClose(target):
    if hero.distanceTo(target) < 5 and hero.isReady("cleave"):
        hero.cleave(target)
    else:
        hero.attack(target)

#29

It work!!!