Sarven Brawl 4 help! {Python}

but the enemy variable is equal to hero.findNearestEnemy()! --> hero <-- !!!

Just try to make them focus on the same enemy

ok. wait. I am working on my code…

Ok, @Eric_Tang, here’s my updated code:

while True:
    friend = hero.findByType("griffin-rider")
    enemy = hero.findEnemies() and friend.findEnemies()
    if hero.gold >= hero.costOf("griffin-rider"):
        hero.summon("griffin-rider")
    for friend in friends:
        hero.command(friend, "attack", enemy)

It says that…oh I won’t explain it here! Here’s a screenshot of the problem:

delete the friends.findEnemies and you should probably add your old code aswell

Code:

while True:
    friend = hero.findFriends()
    enemy = hero.findEnemies()
    if hero.gold >= hero.costOf("griffin-rider"):
        hero.summon("griffin-rider")
    for friend in friend:
        hero.command(friend, "attack", enemy)

Problem:

change that to enemy = hero.findNearestEnemy()

I know how to do it. Four isn’t too hard. But one question, how did you get boss star 4 when don’t even know how to use it? You should definitely know how to use it or else how did you pass earlier levels? @The_Master_Coder

Code:

while True:
    friend = hero.findFriends()
    enemy = hero.findNearestEnemy()
    if hero.gold >= hero.costOf("griffin-rider"):
        hero.summon("griffin-rider")
    for friend in friend:
        hero.command(friend, "attack", enemy)

        

Problem:
I still die and griffin-riders are not strong enough. Please help, @Eric_Tang

As I told you before add your old code you can’t rely on your soldiers

Code:

while True:
    friend = hero.findFriends()
    enemy = hero.findNearestEnemy()
    if hero.gold >= hero.costOf("griffin-rider"):
        hero.summon("griffin-rider")
    for friend in friend:
        hero.command(friend, "attack", enemy)
    if enemy:
        hero.attack(enemy)
        

I still die. I men my hero still dies.

Like I mean with the invisibility and brawler code

oh, ok. Trying code…

Code:

while True:
    friend = hero.findFriends()
    enemy = hero.findNearestEnemy()
    if hero.gold >= hero.costOf("griffin-rider"):
        hero.summon("griffin-rider")
    for friend in friend:
        hero.command(friend, "attack", enemy)
    if enemy and enemy.type != "brawler" and enemy.type != "sand-yaks":
        if hero.canCast("invisibility", hero):
            hero.cast("invisibility", hero)
        else:
            hero.attack(enemy)
        
        

Problem:
My hero STILL dies.

delete

20 characters

Several tips:

  1. go to the corner
  2. switch to a faster sword (Sword of the temple guard or Sword of the forgotten. better to use the temple guard though since the powerup will be very useful)
  3. target the shamans or witches (if there are any) first with your troops
  4. don’t need invisibility
  5. try summoning griffins and paladins. they are the best. (heal + damage and knockback)

And how did you get boss star 4?

Code:

while True:
    friend = hero.findFriends()
    enemy = hero.findNearestEnemy()
    if hero.gold >= hero.costOf("griffin-rider"):
        hero.summon("griffin-rider")
    for friend in friend:
        hero.command(friend, "attack", enemy)
    if enemy and enemy.type != "brawler":
        if hero.canCast("invisibility", hero):
            hero.cast("invisibility", hero)
        else:
            hero.attack(enemy)
        
        

Problem:
My hero still dies

Listen to @Code_Master he has good tips

@Code_Master, I got Boss Star IV by finishing a level in Kelvintaph Glacier and by finishing all the levels

ok @Eric_Tang!!!