this happens
use this code. this code should not give your the error
def lowestHealthPaladin():
lowestHealth = 99999
lowestFriend = None
friends = hero.findFriends()
for friend in friends:
if friend.type != "paladin":
continue
if friend.health < lowestHealth and friend.health < friend.maxHealth:
lowestHealth = friend.health
lowestFriend = friend
return lowestFriend
def commandPaladin(paladin):
paladins = hero.findFriends()
for paladin in paladins:
if paladin.canCast("heal"):
target = lowestHealthPaladin()
if target:
hero.command(paladin, "cast", "heal", target)
else:
enemy = paladin.findNearestEnemy()
if target:
hero.command(paladin, "attack", enemy)
while True:
commandPaladin()
paladins = []
enemies = hero.findNearestEnemy()
greenFlag = hero.findFlag("green")
blackFlag = hero.findFlag("black")
violetFlag = hero.findFlag("violet")
if violetFlag:
friends = hero.findFriends()
if friends:
for friend in friends:
if friend:
hero.command(friend, "move", violetFlag.pos)
if greenFlag:
hero.pickUpFlag(greenFlag)
if blackFlag:
hero.pickUpFlag(blackFlag)
hero.attackDamage
if hero.canCast("invisibility", hero):
hero.cast("invisibility", hero)
friends = hero.findFriends()
for enemy in hero.findEnemies():
friends = hero.findFriends()
for friend in friends:
e = friend.findNearestEnemy()
if e:
hero.command(friend, "attack", e)
fire = hero.findNearestEnemy()
if fire:
if enemy.type == "catapult":
hero.backstab(enemy)
while fire.health > 0:
if hero.canCast("invisibility", hero):
hero.cast("invisibility", hero)
hero.attack(fire)
hero.attack(enemy)
if enemy.type == "skelleton":
hero.attack(enemy)
if hero.health < 3000:
commandPaladin()
its still the same 
Try the new updated code(I edited the post above
it may be a bug or something
There is no bug it is your code.
it can do that but who are you targeting. do something like this
if paladin.canCast("heal", paladin):
it still doesnt work it says cause it says the whole time that the paladin cant heal
show me your new code now
def lowestHealthPaladin():
lowestHealth = 99999
lowestFriend = None
friends = hero.findFriends()
for friend in friends:
if friend.type != "paladin":
continue
if friend.health < lowestHealth and friend.health < friend.maxHealth:
lowestHealth = friend.health
lowestFriend = friend
return lowestFriend
def commandPaladin(paladin):
paladins = hero.findFriends()
for paladin in paladins:
if paladin.canCast("heal", paladin):
target = lowestHealthPaladin()
if target:
hero.command(paladin, "cast", "heal", target)
else:
enemy = paladin.findNearestEnemy()
if target:
hero.command(paladin, "attack", enemy)
while True:
commandPaladin()
paladins = []
enemies = hero.findNearestEnemy()
greenFlag = hero.findFlag("green")
blackFlag = hero.findFlag("black")
violetFlag = hero.findFlag("violet")
if violetFlag:
friends = hero.findFriends()
if friends:
for friend in friends:
if friend:
hero.command(friend, "move", violetFlag.pos)
if greenFlag:
hero.pickUpFlag(greenFlag)
if blackFlag:
hero.pickUpFlag(blackFlag)
hero.attackDamage
if hero.canCast("invisibility", hero):
hero.cast("invisibility", hero)
friends = hero.findFriends()
for enemy in hero.findEnemies():
friends = hero.findFriends()
for friend in friends:
e = friend.findNearestEnemy()
if e:
hero.command(friend, "attack", e)
fire = hero.findNearestEnemy()
if fire:
if enemy.type == "catapult":
hero.backstab(enemy)
while fire.health > 0:
if hero.canCast("invisibility", hero):
hero.cast("invisibility", hero)
hero.attack(fire)
hero.attack(enemy)
if enemy.type == "skelleton":
hero.attack(enemy)
if hero.health < 3000:
commandPaladin()
now?
Maybe it’s because you didn’t write
if friend and friend.type == "paladin":
Because you command all friends, and only paladins can cast heal.
@PeterPalov by using if friend and friend.type == "paladin": it worked
but now at the beam towers ritic is attacking the door and after that he is attacking the beam towers so my new question is how do i make ritic attack the beamtowers first?
Use the type thing, as with friend. But here with enemy.
Wait, which hero are you using??
first i was using Tharin but now i’m using ritic
make him find the nearest enemy around here:

you mean that i nead to use Tharin?
no you can use ritic if you want but find the nearest enemy around this point

