New Level: Grim Determination

Dear all,
i find that this level is very interesting, but…
After having defined lowH=lowestHealthPaladin(), checked that it is not None and that the current paladin.canCast("heal"), i use

self.command(paladin, "cast", "heal", lowH)

as suggested in the comments and no-one is healed. I am sure the previous points are correct, since target is actually the lowest health paladin, but simply the cast does not work.
Is there a bug? Does someone else have the same problem?

Give us your entire code; maybe there’s something in there that blocks it.

@steog88 please give us the entire block of code. You might have a issue in your code that is causing your code to not heal you.
Thanks,
DonutsHaveEggs

Thank you in advance!
I used say to check if the code enters the if, and it does, so the conditions are verified. However, the cast still doesn’t work.

Code
def commandPaladin(paladin):
    lowH=lowestHealthPaladin()
    if lowH is not None:
        if paladin.canCast("heal"):
            #self.say("heal"+lowH)
            self.command(paladin, "cast", "heal", lowH)
    self.command(paladin, "shield")

First, you don’t need to check to see if lowH is None, just ask if lowH:

Second, your problem is the shield command. The shield, for some reason, is overriding all other commands, so your paladins won’t heal, only shield.

Thank you @ChronistGilver, in fact else: before the shield command solved the issue.

@Catsync Is it my imagination or is the reward backwards?

[Edit: The upper “view” “continue” links work not the bottom ones…for this “image”]

Wow glitch huge glitch, I think it is imagination…

Hmm, Glitch may be right on.

It still shows “Loading” so I hit “esc”, it removed the bottom half of the image (the part with scores) leaving the top “0” portion and seems stuck now (nothing responds, links, more “Esc”, etc). Next I “back” buttoned, got the Moutain Map with the Victory display over it still…

…Welcome to the Twilight Zone…

does it happen with other levels?

[merged double post]

det twightlight zone :sunglasses:

Yup, must have been a Twilight Zone Glitch

Although, I am wondering why I have the same total gems? (since I didn’t succeed at the bonus, previously . . . the first image was my first success at submitting and this image is my second.) @Catsync

Yes, that happened to me as well. I got the bonus without fulfilling the requirements.

  # Your goal is to protect Reynaldo

# Find the paladin with the lowest health.
def lowestHealthPaladin():
    lowestHealth = 99999
    lowestFriend = None
    friends = self.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):
    # Heal the paladin with the lowest health using lowestHealthPaladin() 
    if paladin:
        lowPaladin = lowestHealthPaladin()
        if lowPaladin:
            self.command(paladin, "cast", "heal", lowPaladin)
            lowPaladin.say("paladin healed")
    # You can use paladin.canCast("heal") and command(paladin, "cast", "heal", target)
    # Paladins can also shield: command(paladin, "shield")
        else:
            self.command(paladin, "shield")

def commandFriends():
    # Command your friends.
    friends = self.findFriends()
    for friend in friends:
        if friend.type == "peasant":
            commandPeasant(friend)
        elif friend.type == "griffin-rider":
            commandGriffin(friend)
        elif friend.type == "paladin":
            commandPaladin(friend)
def commandGriffin(griffin):
    enemy = griffin.findNearest(griffin.findEnemies())
    self.command(griffin, "attack", enemy)
    
def commandPeasant(peasant):
    coin = peasant.findNearest(peasant.findItems())
    peasant.move(coin)
    
loop:
    commandFriends()
    # Summon griffin riders!
    self.summon("griffin-rider")

whenever i run the code
I get the message:
Line 45: tmp384[tmp385] is not a function
What does this mean and how can I fix my code?

Hello, arkustrew, and welcome.

Line 45 is peasant.move(coin). Peasants do not take commands in this way. Command them using your Boss Star.

self.command(friend, "move" place_you_want_your_friend_to_move)

Also, you should tell your peasants to move to the coin’s position, not the coin itself.

def commandGriffin(griffinrider):
enemies = self.findEnemies()
enemy = None
for enemy in enemies:
self.say(enemy.type)
if enemy.type == “warlock”:

        self.command(griffinrider, "attack", enemy)
        break;
if enemy:        
    enemy = self.findNearest(self.findEnemies())
    if enemy:
        self.command(griffinrider, "attack", enemy)

Your goal is to protect Reynaldo

def commandPeasant(peasant):
item = self.findNearest(self.findItems())
if item:
if peasant:
self.command(peasant, “move”, item.pos)

def lowestHealthPaladin():
lowestHealth = 99999
lowestFriend = None
friends = self.findFriends()
for friend in friends:
if friend.type != “paladin”:
continue
if friend.health < lowestHealth and friend.health < friend.maxHealth:
lowestHealth = friend.health
lowestFriend = friend
if lowestHealth >150:
lowestFriend = None;

return lowestFriend

def commandPaladin(paladin):
lowestFriend = lowestHealthPaladin()
if paladin.canCast(“heal”) and lowestFriend:
self.command(paladin, “cast”, “heal”, lowestFriend)
# Heal the paladin with the lowest health using lowestHealthPaladin()
# You can use paladin.canCast(“heal”) and command(paladin, “cast”, “heal”, target)
# Paladins can also shield: command(paladin, “shield”)
#self.command(paladin, “shield”)
enemies = self.findEnemies()
enemy = None
for enemy in enemies:
if enemy.type == “warlock”:
self.command(paladin, “attack”, enemy)
break;
if enemy:
enemy = self.findNearest(self.findEnemies())
if enemy:
self.command(paladin, “attack”, enemy)

def commandFriends():
# Command your friends.
friends = self.findFriends()
for friend in friends:
if friend.type == “peasant”:
commandPeasant(friend)
pass
elif friend.type == “griffin-rider”:
commandGriffin(friend)
pass
elif friend.type == “paladin”:
commandPaladin(friend)

loop:
commandFriends()
# Summon griffin riders!
if self.costOf(“griffin-rider”) < self.gold:
self.summon(“griffin-rider”)

I need help a lot. Please help me. I did indent.

Please format your code according to the FAQ, as everyone should to before posting even once.

Phrases like “I need help!” or “This code isn’t working!” are not helpful to us, or to you, in any way possible. Give us more information, e.g your code (properly formatted), the error (if any), and perhaps a screenshot of what happens when you run it.

my code isn’t working out so good, there arent any errors, but everything isnt executed

def lowestHealthPaladin():
lowestHealth = 99999
lowestFriend = None
friends = self.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):
    # Heal the paladin with the lowest health using lowestHealthPaladin() 
    if paladin:
        lowPaladin = lowestHealthPaladin()
        if lowPaladin:
            self.command(paladin, "cast", "heal", lowPaladin)
            lowPaladin.say("paladin healed")
    # You can use paladin.canCast("heal") and command(paladin, "cast", "heal", target)
    # Paladins can also shield: command(paladin, "shield")
        else:
            self.command(paladin, "shield")

def commandFriends():
    # Command your friends.
    friends = self.findFriends()
    for friend in friends:
        if friend.type == "peasant":
            pass
        elif friend.type == "griffin-rider":
            commandGriffin(friend)
        elif friend.type == "paladin":
            commandPaladin(friend)
def commandGriffin(griffin):
    enemy = griffin.findNearest(griffin.findEnemies())
    self.command(griffin, "attack", enemy)
    
    
loop:
    commandFriends()
    # Summon griffin riders!
    self.summon("griffin-rider")

You first have to check if the paladin can cast "heal" in the first place. Otherwise, it won’t work. Also, paladins can’t speak.

my griffins arent doing anything…