Summit's gate help pls pls!

This is my code:

def summonTroops():
    if > hero.costOf("soldier"):
    if > hero.costOf("archer"):
    if > hero.costOf("griffin-rider"):
def commandSoldier():
    soldiers = hero.findByType("soldier")
    for soldier in soldiers:
        Senemies = soldier.findEnemies()
        for Senemy in Senemies:
            if Senemy and soldier:
                hero.command(soldier, "attack", Senemy)
def commandArcher():
    archers = hero.findByType("archer")
    for archer in archers:
        Aenemies = archer.findEnemies()
        for Aenemy in Aenemies:
            if Aenemy and archer:
                hero.command(archer, "attack", Aenemy)
def commandPaladin():
    paladins = hero.findByType("paladin")
    for paladin in paladins:
        Penemies = paladin.findEnemies()
        Pfriend = paladin.findNearest(hero.findFriends())
        for Penemy in Penemies:
            if Penemy and paladin:
                hero.command(paladin, "attack", Penemy)
                if paladin.canCast("heal, Pfriend"):
                    hero.command(paladin, "cast, heal", Pfriend)
def heroAttack():
    enemies = hero.findEnemies()
    for enemy in enemies:
        if enemy:
            if hero.isReady("chain-lightning"):
                hero.cast("chain-lightning", enemy)
def pickUpFlags():
    flag = hero.findFlag()
    if flag:
while True:

My inventory(hero is Usara Master Wizard):

Please help me to optimize the code for her and make it work
For her means using RaiseDead, summonUndead, summonBurl, summonYeti, and, maybe summonRobobomb

Please tell us what is the problem and if you are able to pass the level.

I am unable to pass because my troops are not attacking anyone. And I want to optimize this for Usara Master Wizard.

First mistake I found, you do not have the emperor’s gloves, so you cannot do chain-lightning. Your soldiers probably are not attacking anyone because you are trying to cast chain-lightning when you do not have the spell, causing an error. Second mistake lies in summonTroops function. Your hero will only summon the soldier and a few archer and griffin riders due to the default 60 gold and the gems in the warlock area because the soldier is the cheapest. Your hero will spend gold on soldier before you are able to boot up for the rest. Unless this is what you meant, try to use an array like the one in Ace of Coders.

To optimize, you can add the summom burl, undead, yeti, and raise-dead to the heroAttack function. Also, you can make a function like commandUndeadAndYeti to command them to your will. Summon robobomb is not really useful unless you know this trick… Hint: Pair it with magnet field and your bear’s freezing spell( I am also a Usara user :grin:)


Help me please how could i do it(i never used freeze and magnet field)

And do you use unholy tome V?

Tell me please how to use Robobombs(every time when I try to use them, they explode half of my allies)
And I do not know, how to command Yeti

I use Unholy tome V(20 chars)

(Post deleted by author)

You can command yeti and skeletons just like normal troops.

just 1 suspicion. Did u copy some code from this github page?

1 Like

it is very hard

i you did, please don’t. codecombat isn’t a speedruning rpg game. its for learning. Whats the use if u dont understand the code, and copy from someone else to make you look smart?

1 Like

I doubt they copied anything, I see almost 0 similarities, also, WHY DO PEOPLE KEEP USING

if > hero.costOf(unitName):

like, brooo, use >=, it literally makes the result different in some levels

1 Like

key word lol
i saw 1 command function look exactly the same

1 Like

Meh, it is still copied. Search this code in the Discourse and you will find absolutely the same code in a topic which was made before.

Continuing the discussion from Summit's Gate (Python)[SOLVED]:

yea look at this reply rom WaWa_Yang. code is entirely the same

the only thing u changed is casting for usara, which didn’t exist back in 2020