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

Can't Read Start of Undefined [Help Wanted]


I’ve been working on Sarven Brawl 1, and realised that I’ve been losing because I would use cleave and accidently hit a sand-yack. I then decided to see if I could find a way to detect if a sand yack was within cleave distance (10) by looking for all sand-yacks, getting their distance and getting the distance of the closest one. Here is the error I’m now getting if anybody could help me out :

For those who can’t look at pictures, here is my code :

while True:
    enemy = hero.findNearestEnemy()
    sand-yacks = hero.findByType("sand-yak")
    yackIndex = 0
    closeDistance = 9999
    while yackIndex < len(sand-yacks):
        distance = hero.distanceTo(yack)
        if distance < smallDistance:
            smallDistance = distance
        yackIndex += 1
    if enemy and enemy.type != "sand-yak":
        if hero.isReady("cleave") and closeDistance > 10:
        elif hero.isReady("bash"):
        elif hero.isReady("chain-lightning") and hero.canCast("chain-lightning", enemy):
            hero.cast("chain-lightning", enemy)
    if > hero.costOf("soldier"):
        soldier = hero.findNearest(hero.findFriends())
        enemy2 = soldier.findNearestEnemy()
        if enemy2 and enemy2.type != "sand-yak":
            hero.command(soldier, "attack", enemy2)


Did you mean to put !..
Unless that is necessary in the code that may be the reason why your code isn’t working


yes I did mean to put it there. Is it not supposed to be there? I was checking to make sure that it WASN’T a sand-yak, == checks if it is, and != checks if it isn’t right?


I’m not entirely sure. I’ll invite @nick


just buy a good sword without cleave