Sarven Brawl 4 help! {Python}

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?

I mean how would you command them to heal your hero, @riticmaster9087?

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


1 Like

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:

I bought the Order of the Paladin! So, how can I use it, @Eric_Tang? Or @Deadpool198?

use consecrate to heal your friends and deal damage to skeletons

ok, @riticmaster9087, but how do you make sure that consecrate is ready?