Sarven Brawl 4 help! {Python}

As @Lydia_Song has said you need to check if there is an enemy first like this

while True:
   enemy = hero.findNearestEnemy()
   #if enemy
       #type the rest of your code here

try shielding and bash and try going to 87,71

guys!!! I already checked if there is an enemy using enemy = hero.findNearestEnemy()!!! See:

while True:
    enemy = hero.findNearestEnemy()
    if enemy.type != "sand-yak":
        hero.attack(enemy)
    else:
        pass

See!!!

No you didnā€™t you need to Wright if enemy

what does that mean @Eric_Tang? Oh and hi! :sunglasses:

on that line add: and enemy

ok I am trying @Eric_Tangā€¦

it doesnā€™t work @Eric_Tang! Here is the code:

while True:
    enemy = hero.findNearestEnemy()
    if enemy and enemy.type != "sand-yak":
        hero.attack(enemy)
    else:
        pass

I keep dying. Please help @Eric_Tang!

Delete the else pass I donā€™t think you need it

ok. Iā€™ll tryā€¦ brbā€¦

Itā€™s still not working! Same result. Hereā€™s the code:

while True:
    enemy = hero.findNearestEnemy()
    if enemy and enemy.type != "sand-yak":
        hero.attack(enemy)

Is your hero attacking the sand yakes?

no. I think the problem is the Brawlers.

Use the precious 20 chars

ok, then. I will. I will send you the results and the code after I am doneā€¦brbā€¦

actually same results. Hereā€™s the code:

while True:
    enemy = hero.findNearestEnemy()
    if enemy and enemy.type != "sand-yak":
        if hero.canCast("invisibility", hero):
            hero.cast("invisibility", enemy)
        else:
            hero.attack(enemy)

Did your hero use it? if he did make him move somewhere to avoid the brawlers

ok @Eric_Tang! I will tell you after I am done with my code and the results.

And I see you have boss star 4 so you could summon some troops.

I do have Boss Star IV, but I have no idea how to use it!