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

Summit's gate pls help meh(python)

that is what i do
wanna see my code?

Try to use his abilities then.

Yeah, try to use shadow vortex, phase shift, blink and wall of darkness.

when and where?

You could use shadow vortex at the start on the ogres, then you could blink to the catapults and take them out.
You do have Ritic right?
You could also do it with Tharin though. Please could you post your code.
Thanks

3 Likes
def lowestHealthPaladin():
    lowestHealth = 99999
    lowestFriend = None
    friends = hero.findFriends()
    for friend in friends:
        if friend.type != "paladin":
            continue
        if friend.health < lowestHealth and friend.health < friend.maxHealth:
            lowestHealth = friend.health
            lowestFriend = friend

    return lowestFriend


def commandPaladin(paladin):
    if friend and friend.type == "paladin":
        for paladin in paladins:
            if paladin.canCast("heal", paladin):
                target = lowestHealthPaladin()
            if target:
                hero.command(paladin, "cast", "heal", target)
            else:
                enemy = paladin.findNearestEnemy()
                if target:
                    hero.command(paladin, "attack", enemy)

while True:
    commandPaladin()
    paladins = []
    enemies = hero.findNearestEnemy()
    greenFlag = hero.findFlag("green")
    blackFlag = hero.findFlag("black")
    violetFlag = hero.findFlag("violet")
    if hero.isReady("phase-shift"):
        hero.phaseShift()
    if violetFlag:
        friends = hero.findFriends()
        if friends:
            for friend in friends:
                if friend:
                    hero.command(friend, "move", violetFlag.pos)
    if greenFlag:
        hero.pickUpFlag(greenFlag)
    if blackFlag:
        hero.pickUpFlag(blackFlag)
        hero.findNearestEnemy()
        hero.backstab(enemy)
    friends = hero.findFriends()
    for enemy in hero.findEnemies():
        friends = hero.findFriends()
        for friend in friends:
            e = friend.findNearestEnemy()
            if e:
                hero.command(friend, "attack", e)
    fire = hero.findNearestEnemy()
    if fire:
        distance = hero.distanceTo(fire)
        if distance < 10:
            hero.backstab(fire)
        else:
            hero.attack(fire)
            if fire.type == "beam-tower" and hero.isReady("phase-shift"):
                hero.phaseShift()
                hero.backstab("beam-tower")
    if hero.health < 3000:
        commandPaladin()

i have a new problem when my hero needs to backstab he stops moving

do doors at this level have a name or can i give it a name?

You need to define enemy. You can’t just use hero.findNearestEnemy(). You need to do enemy = hero.findNearestEnemy() and to check if the enemy exists (if).
Danny

1 Like

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

which line?

Here:

See how you’ve used hero.findNearestEnemy() by itself. That doesn’t do anything. You need to store the value of that method inside a variable like enemy.
Like you’ve done here (but use enemy instead of fire):

Now that you have a variable called enemy, you can check if it exists (if enemy). If it does, you can use hero.backstab(enemy).
Danny

3 Likes

@Deadpool198 you mean like this?

if blackFlag:
        hero.pickUpFlag(blackFlag)
        hero.findNearestEnemy()
        if enemy:
            hero.backstab(enemy)

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

Almost. The if enemy and backstab bit are right. You just have to do this:
enemy = hero.findNearestEnemy()
instead of this:
hero.findNearestEnemy()

As I said above, you need to make variables to be able to use them.
You use hero.backstab() on enemy. Where will that enemy come from? You haven’t defined it since the start of the while true loop.
Just doing this:
hero.findNearestEnemy()
does Not refresh the enemy variable. In fact, it doesn’t do anything it all. You need to put it after a variable name and an equals sign = like:
enemy = hero.findNearestEnemy()
for it to work properly.
Danny