[SOLVED] [Summit's Gate] Checked team but level still shows code error

I’m having a bit of trouble with Summit’s Gate (I’m pretty sure many people are). I’m on the Inner Sanctum bit where all the warlocks are. Here is my code for the Inner Sanctum warlock bit:

def innerSanctumTwo():
    hero.moveXY(276, 34)
    enemy = hero.findNearestEnemy()
    if enemy:
        if hero.isReady("bash"):
            hero.bash(enemy)
        else:
            hero.attack(enemy)
    friends = hero.findFriends()
    for friend in friends:
        if friend.team == hero.team:
            if enemy:
                if enemy.type == "warlock":
                    hero.command(friend, "attack", enemy)

And then of course I include it in the loop (not shown).

Level always says that hero placeholder on team humans cannot command so-and-so on team ogres even though I use

if friend.team == hero.team:

to check.

Can anyone help me please? Any effort to help will be rewarded, thank you :slight_smile:

1 Like

send me full code in PM
if the problem is still actual

innerSanctumTwo() looks fine

1 Like

Here is my full code so far:

# Fight your way into the Inner Sanctum of the ogre chieftain, and defeat her.
def outerGate():
    soldier = hero.findByType("soldier")
    for i in range(len(soldier)):
        if i < 2:
            if i == 0:
                hero.command(soldier[0], "move", {"x": 92, "y": 60})
            if i == 1:
                hero.command(soldier[1], "move", {"x": 92, "y": 7})
        else:
            hero.command(soldier[i], "defend", hero)
    friends = hero.findFriends()
    for friend in friends:
        if friend.type != "soldier":
            hero.command(friend, "defend", hero)

def doorOne():
    hero.moveXY(98, 33)
    enemy = hero.findNearestEnemy()
    if enemy:
        if enemy.health > 0:
            hero.attack(enemy)
        if enemy.health <= 0:
            hero.moveXY(7, 41)

def defenseStrat():
    friends = hero.findFriends()
    enemy = hero.findNearestEnemy()
    for friend in friends:
        if friend.type == "paladin":
            if friend.canCast("heal", friend) and friend.health < friend.maxHealth:
                hero.command(friend, "cast", "heal", friend)
        else:
            if enemy:
                if enemy.type == "thrower":
                    if friend.type == "archer":
                        hero.command(friend, "attack", enemy)
                else:
                    hero.command(friend, "defend", hero)

def innerGate():
    hero.moveXY(129, 59)
    paladins = hero.findByType("paladin")
    for paladin in paladins:
        hero.command(paladin, "move", {"x": 91, "y": 54})
        if paladin.canCast("heal", hero):
            hero.command(paladin, "cast", "heal", hero)
        if paladin.health < paladin.maxHealth / 3 * 2 and paladin.canCast("heal", paladin):
            hero.command(paladin, "cast", "heal", paladin)
    friends = hero.findFriends()
    towers = hero.findByType("tower")
    tower1 = towers[0]
    tower2 = towers[1]
    if hero.gold >= hero.costOf("archer"):
        hero.summon("archer")
    if tower2 and tower2.health > 0:
        while tower2.health > 0:
            for friend in friends:
                if friend.type != "paladin":
                    hero.command(friend, "attack", tower2)
            if hero.isReady("bash"):
                hero.bash(tower2)
            else:
                hero.attack(tower2)
    hero.moveXY(129, 10)
    if tower1 and tower1.health > 0:
        while tower1.health > 0:
            for friend in friends:
                if friend.type != "paladin":
                    hero.command(friend, "attack", tower1)
            if hero.isReady("bash"):
                hero.bash(tower1)
            else:
                hero.attack(tower1)

def doorTwo():
    hero.moveXY(154, 33)
    enemy = hero.findNearestEnemy()
    if enemy:
        if enemy.health > 0:
            hero.attack(enemy)

def innerSanctumOne():
    friends = hero.findFriends()
    for friend in friends:
        hero.command(friend, "defend", hero)
    if hero.gold >= hero.costOf("archer"):
        hero.summon("archer")
    hero.moveXY(241, 14)
    if hero.time > 166:
        hero.moveXY(240, 53)

def innerSanctumTwo():
    hero.moveXY(276, 54)
    enemy = hero.findNearestEnemy()
    vax = "Vax"
    vyrr = "Vyrryx"
    friends = hero.findFriends()
    if vax and vax.health > 0:
        while vax.health > 0:
            for friend in friends:
                if friend.team == hero.team:
                    if friend.type != "paladin":
                        hero.command(friend, "attack", vax)
    if vyrr and vyrr.health > 0:
        while vyrr.health > 0:
            for friend in friends:
                if friend.team == hero.team:
                    if friend.type != "paladin":
                        hero.command(friend, "attack", vyrr)
    if enemy:
        hero.attack(enemy)
    if hero.gold > hero.costOf("soldier"):
        hero.summon("soldier")

while True:
    outerGate()
    if hero.time > 45 and hero.time < 60:
        doorOne()
    if hero.time > 60 and hero.time < 77:
        defenseStrat()
    if hero.time > 77 and hero.time < 120:
        innerGate()
    if hero.time > 120 and hero.time < 138:
        doorTwo()
    if hero.time > 138 and hero.time < 177:
        innerSanctumOne()
    if hero.time > 177:
        innerSanctumTwo()
1 Like

add

if soldier[ i ].team == "humans":

or use

soldier = hero.findByType("soldier", hero.findFriends() )

in outerGate()


soldier = hero.findByType("soldier")

return array of units with type soldier
not matter they are in humans or ogres team

1 Like