Help please with code


Help please - why its dont work?
How was parallel command?
If palladin heal - hero dont attack…

[spoiler] def commhero():
e = hero.findNearest(hero.findEnemies())
if e:
if hero.isReady(“bash”):

def commpal(p,fri):
    for i in range(len(p)):
        if p[i].canCast("heal"):
                hero.command(p[i], "cast","heal", hero)
                hero.command(p[i], "defend", hero)
            for j in range(len(fri)):
                if fri[j]!=p[i]:
                    if fri[j].health<fri[j].maxHealth/2 and fri[j].health!=0:
                        hero.command(p[i], "cast","heal", fri[j])

while True:
    s = hero.findByType("soldier")
    a = hero.findByType("archer")
    p = hero.findByType("paladin")
    g = hero.findByType("griffin-rider")
    fri = hero.findFriends()    
    f = hero.findFlag()


Please format your code, Now it’s not readable :frowning:


@GAIGAL Use the “Formatted Text” button on the forum editor to allow your code to appear as it does in the Code Combat editor. As Python requires proper tab spacing as part of its formatting, we cannot tell if your code is correct or not unless the tab spacing is preserved.

For example:

if e:
if hero.isReady(“bash”):


if e: 
	if hero.isReady("bash"): 

Also which campaign and level is this for?


Its mountain, summits gate… i try with flag, but i think this wrong way…


I cannot get the issue to recreate itself.

I can tell you this though. Summits Gate was the first level I found challenging. I actually choreographed the entire assault. And I had to load up on premium gear to be able to complete the level.

If you get passed this level consider it an accomplishment.


But can you tell me - really finished this level without flag or not?
Sorry i teach english and not very well understand and write…)


Using the placement of a flag would be up to you to control things.

I used a time based, pathing system where the troops changed actions based on what time it was. So like actors in a play, they did their part on cue. I finished it without using the flag. However if used wisely the flag system might aid you.

There should be more than one way to complete the level.


yes! I do it! =) Thanks =)