Paladins are better than grffin riders
Ok. I hereby declare that I shall summon paladins! (Donald Trump voice)
also command them to heal your hero
how would you do that?
paladin=hero.findByType("paladin")
if paladin.canCast("heal"):
hero.command(paladin[0],"cast","heal",hero)
That actually doesnât work!
Code:
while True:
friend = hero.findFriends()
enemy = hero.findNearestEnemy()
if hero.gold >= hero.costOf("paladin"):
hero.summon("paladin")
for friend in friend:
hero.command(friend, "attack", enemy)
if hero.health < 500:
pallain = hero.findByType("paladin")
if pally.canCast("heal"):
hero.command(palladin[0], "cast", "heal", hero)
if enemy and enemy.type != "brawler":
if hero.canCast("invisibility", hero):
hero.cast("invisibility", hero)
else:
hero.attack(enemy)
Problem:
I used @riticmaster9087âs technique, but my paladins wonât heal me! Please help @Eric_Tang
If you reply, I will only see it tomorrow, the day after tomorrow, or on Monday.
You defined paladin as pallain but you said it as pally
because my mom says I have to leave my chromebook for the night
try my edited version
You can summon both (20 chars have to ruin this long message up too?)
The problem youâve been having with this for the whole time is because youâre not changing the enemy variable. What I mean by that is, if your closest enemy (thatâs what you define as enemy) is a âbrawlerâ or a âsand-yakâ (in your previous code), then your code is going to freeze isnât it? Why? Because your code canât do anything. The code will run this line:
The condition will be false, and it will not run the code inside the if statement.
If you want to exclude sand-yaks and brawlers properly, you need to write a function with a for or while loop to make an array of non-sandyaks/brawlers.
Oh dear⊠Youâve used quite a few variables here:
friend
pallain
pally
palladin[0]
You should only be using friend.
If youâre inside a for loop you shouldnât find another person to command, you should use friend. To check if friend is a paladin, why not use: if friend.type == âpaladinâ.
Also putting hero.command without a conditional statement (like if or else) means that it will always run.
Why not put the attack command in an else statement behind the if friend.type == âpaladinâ.
Danny
P.S. how do you have BS IV? I doubt youâve done kelvintaph defilerâŠ
he has it its just that he doesnt know how to use it.
Again, a giant topic in which one have to answer simple questions asked by a person who, according to the levels he has passed, should be a help to others.
If he understands the code he has passed levels Summit Gate, Kelvintaph Crusader, Burgler, Defiler and others he would not ask such questions.
Dude, I actually got a LOT of help from my friend. And hereâs a screenshot proving that I finished all the levels:
use consecrate to heal your friends and deal damage to skeletons