Summit's gate pls help me (python)

no just get rid of these () on this like

ok done
and what i wanna know is why does it say that the paladin cant heal

check if the paladin can cast that using

if friend.canCast("heal" target):

stil doesnt work
ill make a screen shot ok


this is what it says

define friend and put it in a for-loop

you mean like this?

def commandPaladin(paladin):
    for friend in friends:
        if paladin.canCast("heal"):
            target = lowestHealthPaladin()
    if target:
        hero.command(paladin, "cast", "heal", target)
    elif paladin.health < 200:
        hero.command(paladin, "shield")
    else:
        target = paladin.findNearestEnemy()
    if target:
        hero.command(paladin, "attack", target)

more like this

def commandPaladin(paladin):
    friends = hero.findFriends()
    for friend in friends:
        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)

still the same it may be a bug

do his and put all your code in the for-loop

friends = hero.findFriends()
    for friend in friends:

so i need to put all this in a for-loop?!

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):
    friends = hero.findFriends()
    for friend in friends:
        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()

and how to begin the for-loop for hero in heroes
like this?

im asking cause i never put a whole code in a for-loop

No don’t do that. What is the problem now

i dont know how i put a whole code in a for-loop :sweat_smile:

show me your new code

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):
    friends = hero.findFriends()
    for friend in friends:
        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()

What is the problem now

i asked how do i put my whole code in a for-loop

don’t do that. What is the problem when you run your code, does your hero die, you run out of time, and etc.