Kelvintaph Burgler helpp[SOLVED]

Ok, let me test your code now.Give me a couple of seconds.

1 Like

i try send full code





def lowHp():
    friends = hero.findFriends()
    for friend in friends:
        if friend.health <= friend.maxHealth / 2:
            pass


def comPal(paladin):
    lH = lowHp()
    friends = hero.findFriends()[0]
    enemy = paladin.findNearestEnemy()
    for friend in friends:
        if friend.health <= lH:
            if paladin.canCast("heal", friend):
                hero.command(paladin, "cast", "heal", friend)
            elif enemy.health > 0:
                hero.command(paladin, "attack", enemy)

def comGriff():
    if hero.gold >= hero.costOf("griffin-rider"):
        # lesgoo command giffin-rider
        hero.summon("griffin-rider")
        friends = hero.findFriends()
        enemy = hero.findNearestEnemy()
    for friend in friends:
        if enemy.health > 0:
            hero.command(friend, "attack", enemy)

while True:
    flag = hero.findFlag("green")
    friends = hero.findFriends()
    enemy = hero.findNearestEnemy()
    if flag:
        hero.move(flag.pos)
        
    for friend in friends:
        if friend.type == "griffin-rider":
            if enemy.type == "robot-walker":
                comGriff()
        elif friend.type == "paladin":
            comPal()
        elif friend.type == "archer" and friend.type == "soldier":
            if enemy.type == "chieftain":
                hero.command(friend, "attack", enemy)
        
    hero.command(friend, "move", {'x': 32, 'y': 57})
    hero.command(friend, "move", {'x': 26, 'y': 57})
    hero.command(friend, "move", {'x': 30, 'y': 52})
    hero.command(friend, "move", {'x': 54, 'y': 59})
    hero.command(friend, "move", {'x': 76, 'y': 57})
    hero.command(friend, "move", {'x': 78, 'y': 40})
    if enemy.type == "robot-walker" and enemy.health == 0:
        hero.moveXY(76, 14)
    
    
        


1 Like

aha, so your main problem is line 13.

LH = lowHp()??

no,

enemy = paladin.findNearestEnemy()

Gotcha!I found the mistake!

1 Like

whatt ?? 20ccharssssss

Your function comPal() has an argument.When you use the function, you must specify the argument.

Same thing with comGriff

oooohhhhhhh 2000charss

Okay, so now your code is without mistakes, I think, but you should still figure out how to win it!Good luck!

2 Likes

Please, mark the post, that helped you the most, as solved, if you don’t have any other questions.

wait i will put solved 20charss

finnaly working thankyou s much for helping @Anonym @Aya

2 Likes

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.