Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Help On Levels In Mountain

change griffins = hero.findNearest(“griffin”)
to grffins = hero.findByType(“grffins”)

Or you can do griffins = hero.findNearest(hero.findByType("griffin"))

P.S for python, hero.findNearest("griffin") is in the singular form

@Eric_Tang or @abc please help with the hunt begins (burls). Here is my code:

# Senick is trying to find the elusive Burleous Majoris!
# But he doesn't know how big a Burleous Majoris would be...
# Find the average size of this burl population to use as a baseline!

# This function returns average size of all the burls in an array.
def averageSize(burls):
    sum = sumSize(burls)
    # Remember the average is the sum of the parts divided by the amount!
    return sum / burls.length

# This function should return the sum of all the burls sizes.
def sumSize(burls):
    burls = hero.findByType("burl")
    # Create a variable and set it to 0 to start the sum.
    totalSize = 0
    # Initialize the loop index to 0
    burlIndex = 0
    # While enemyIndex is less than the length of enemies array
    while burlIndex < len(burls):
        burl = burls[burlIndex]
        # Add the current enemy's health to totalHealth
        totalSize += burl.size
        # Increment enemyIndex by 1.
        burlIndex += 1
    return totalSize

while True:
    # Find the average size of the burls by calling the 'averageSize' function.
    # Say the average size of the seen burls!
    burlSize = averageSize(burls)

try to rewrite this function instead of all those index’s do

sum = 0
    for burl in burls:
        sum = sum + burl.size
    return sum

the in your while true loop add a burls = hero.findByType(“burl”)

1 Like

help @Eric_Tang or @ZAX155, summits gate! My code:

while True:
    enemy = hero.findNearestEnemy()
    friends = hero.findFriends()
    if >= 30:
        if enemy:
            for friend in friends:
                if friend.type == "paladin" and friend.canCast("heal"):
                    hero.command(friend, "cast", "heal", hero)
                elif friend.type != "paladin" and enemy.type == "cheiftain":
                    hero.command(friend, "attack", enemy)
                elif friend.type != "paladin" or hero.pos.x > 100 or friend.type != "archer":
                    hero.command(friend, "defend", hero.pos)

help with defeating warlocks, that’s it.

@Falcons118? @abc? help

Okay, move to one of that warlocks and attack him, once one is dead, then attack the other one. Then attack the skeletons and finally breach the inner gate. Sorry I took a while to reply, I was eating lunch.

yeah, but I attack a warlock, then attack the other one. or, at least, I tried to. I managed to kill one, but not the other. I die.

You need high health, and focus only on warlocks. Move very close to the warlock.

you need a if statement.

he already has one :wink:

in this use all if as there is always going to be a paladin as long as its alive. So the other code wont run, Personally, I like using something like

def attack():
    enemy = hero.findNearestEnemy()
    if enemy:
def summon():
    if > hero.costOf("soldier"):
def command():
    friend = hero.findNearest(hero.findFriends())
    if friend:
        if friend.type == "paladin"
            hero.command(friend, "cast", "heal", friend)
        (other friend types)
while True: