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?
@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")
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…
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
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)
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.