@Deadpool198 : I despair when I see a code where “Strings” and all its derivatives are attacked , cast, taken distance to…
The above code will fail if Bernard or Chandra are killed. There is very good post how to find a minion by id (Name): Easiest way to select the enemy hero
You can use this method without advanced glasses or books. Simply remember the pattern. You can find this way id, type, team of the unit(s).
So for me the beginning of code will look like this:
while True:
friends = hero.findFriends()
Bernard = [friend for friend in friends if friend.id in ["Bernard"]][0]
Chandra = [friend for friend in friends if friend.id in ["Chandra"]][0]
if hero.canCast("regen"):
if Bernard:
bernardDistance = hero.distanceTo(Bernard)
if bernardDistance < 10:
hero.cast("regen", Bernard)
if Chandra:
chandradDistance = hero.distanceTo(Chandra)
if hero.distanceTo(Chandra) < 10:
hero.cast("regen", Chandra)
picture:
p.s.
the level is designed to pass even you completely comment the else clause…
but it’s really important to use properly if enemy, if friend clause and learn hero.attackRange()