The Trials Need help!

I can’t figure it out. I need help please! I don’t have any code because I keep deleting it trying to make it work. Could anybody place some code in the comments???

As a regular policy, we don’t post the working code. It takes away the learning experience of the game. Phrases like “i can’t figure it out” or “i need help” don’t help us understand the issue. Please at least post what happens after you run your code. And if you write code and maybe it doesn`t work, please post it.

Cheers!

1 Like

Its saying tmp70[tmp71] is not a function on line 16


# This level is intended to be for advanced players. The solution should be pretty complex with a lot of moving parts. It might also be a bit of a gear check unless you use "creative" methods.
# You need to make your way to the first trial (Oasis of Marr) killing enemies along the way. When you reach it, pick all the mushrooms to trigger the trial to begin. If you survive the onslaught, make your way to the next Oasis for the second trial, then the Temple. When all trials are complete you will have to face the final boss. Good luck!
# HINT: Glasses with a high visual range help tremendously on this level so buy the best you can get.
# HINT: the unit 'type' for the oasis guardians is 'oasis-guardian'
loop:
    closestEnemy = None
    minDistance = 150
    enemyIndex = 0
    enemies = self.findEnemies()
    mushrooms = self.findItems()
    mushroom = self.findNearest(mushrooms)
    while enemyIndex < len(enemies):
        currentEnemy = enemies[enemyIndex]
        enemyIndex += 1
        currentDistance = self.distanceTo(currentEnemy)
    if  self.isPathClear(self.pos, currentEnemy.pos):
            minDistance = currentDistance
            closestEnemy = currentEnemy
        else:
            pass
    if closestEnemy:
        while closestEnemy.health > 0:
            if closestEnemy.health > 150:
                if self.isReady("power-up"):
                    self.powerUp()
                elif self.isReady("bash"):
                    self.bash(closestEnemy)
                else:
                    self.attack(closestEnemy)
            else:
                self.attack(closestEnemy)
    elif mushroom:
    self.move(mushroom.pos)
elif self.pos.y < 40:
    self.move({"x": 10, "y":10})
elif self.pos.y > 100:
    if self.pos.x > 90:
        self.move({"x": 75, "y":125})
    if self.pos.x < 40:
        self.moveXY(100, 125) 
    if self.pos.x > 50 and self.pos.x <= 90:
        newEnemy = self.findNearest(self.findEnemies())
        if not newEnemy:
            self.move({"x": 55, "y":115})
            self.moveXY(27, 121)
            self.moveXY(56, 122)
            self.moveXY(45, 96)
            self.move({"x": 45, "y":70})
            self.moveXY(80, 70)
        else:
            pass

Hmm, not sure about that. I’ll invite @nick

while enemyIndex < len(enemies):
    currentEnemy = enemies[enemyIndex]
    enemyIndex += 1
    currentDistance = self.distanceTo(currentEnemy)

You could note that this will simply measure the distance to each enemy without recording any but the last it considers. Try indenting the part that starts with if self.isPathClear to make it part of the while-loop. Also, you could remove the extra space between if and isPathClear.