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

Summit's gate pls help me (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

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)

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

@Deadpool198 i dont know what u wanna mean

im not new im this guy @stefan_grecu

Please post your new code.
Danny

1 Like
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 enemy:
                    hero.command(paladin, "attack", enemy)

def paladinHeal(paladin):
    for paladin in paladins:
        if paladin.canCast("heal"):
            hero.command(paladin, "cast", "heal", hero)
        else:
            commandPaladin()

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()
        if enemy:
            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)
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.attack(enemy)
        distance = hero.distanceTo(enemy)
        if distance < 10:
            hero.backstab(enemy)
        if enemy.type == "beam-tower":
            hero.attack(enemy)
            hero.shadowVortex(enemy.pos, {"x": enemy.pos.x, "y": enemy.pos.y})
    if hero.health < 3000:
        paladinHeal()

this is my new code @Deadpool198

I can’t test it in the exact same situation as you because I don’t have Ritic (:cry:), however, I have found some problems.

The type is “tower”, not “beam-tower”.
After you’ve changed that please could you give me more info about what Ritic is doing / not doing, so I can isolate any issues.

@stefan_grecu if you just backstab you dont do that much damage so you should probably phase-shift. Also, backstab may not be ready.

1 Like

backstab has no cooldown, phase shift does.

Whether it does or doesn’t it’s no good if your invisible then backstab.

@_Codemaster backstab has 26.2 sec cooldown

2 Likes