Help: Dueling Grounds

Ok, so my code is:

while True:
    hazards = hero.findHazards()
    hazardIndex = 0
    hazard = hazards[hazardIndex]
    if hazard and hazard.type == "bear-trap" and hero.distanceTo(hazard) < 10:
        while > hero.costOf("archer"):
        enemy = hero.findNearest(hero.findEnemies())
        if enemy and enemy.type != "sand-yak":
            soldiers = hero.findFriends()
            # Loop over all your soldiers and order them to attack.
            for soldier in soldiers:
                if soldier.type != "decoy":
                    hero.command(soldier, "attack", enemy)
            enemy = hero.findNearestEnemy()
            if hero.canCast("chain-lightning", enemy):
                hero.cast("chain-lightning", enemy)
        enemy = hero.findNearest(hero.findEnemies())
        hero.buildXY("bear-trap", enemy.pos.x, enemy.pos.y)

@Eric_Tang or @milton.jinich help please.

Okay can you explain a little bit of what happens and what is the arena


Yes as he mentioned we can’t really help unless we know what is happening with your code. A screenshot and brief description would help! Also thanks for formatting you code properly :slight_smile:

1 Like

Are you sure this is dueling grounds? I saw type sand yak in your code. Also a recomendation for when your near a bear trap try to summon a soldier they cost less than a archer. You didn’t update hazardIndex either.

yeah, it’s dueling, I copied Harrowland code

uhhhhhh Try to make it a little bit more fit for dueling grounds(I mean delete the sand yak part)

Why have you got most of your important code (commanding, summoning and attacking) behind this if statement? Surely you’d want to do the essential stuff even if there wasn’t a hazard near?

1 Like

Why is this error popping up?

1 Like

You need to do if enemy:

1 Like

also please post your most recent code.

1 Like