It gives me this error for no reason
When i take out the sacrifice it works perfectly fine
Even when i put
if nearest and nearest.type == "soldier" and hero.isReady("sacrifice"):
hero.cast("sacrifice", friend, hero)
(2nd one)When you place that line, it would check for the nearest’s type, even when nearest does not exist.
(3rd one) For every line which is for the cooldown to attack the enemy or against the enemy, place elif
after the first cooldown for which is against the enemy, as it will then start from the beginning and check if the enemy exists.
In the first one, you didn’t check if nearest exists.
In short, you had flaws on every single one of them.
So what would i put?
I put this but it still is not working
if friend:
if friend.type == "soldier" and hero.isReady("sacrifice"):
hero.cast("sacrifice", friend, hero)
you don’t need the if friends:
line. And it is better if you don’t put it in the if enemy:
line. And, you don’t need to check if friend
exists when you put in a for loop in hero.findFriends()
.