I need help on sarven treasure 7

pet.moveXY(12, 54)
def petCollect():
    pet.moveXY(12, 17)
    pet.moveXY(66, 14)
    pet.moveXY(71, 60)
    pet.moveXY(9, 60)
def defense():
    hero.buildXY("fence", 5, 57)
    hero.buildXY("fence", 9, 57)
    hero.buildXY("fence", 12, 59)
    hero.buildXY("fence", 12, 62)
hero.moveXY(9, 60)
while True:

here is my code so far. I am using the mimic to collect gold while I stay in the corner. I am wondering why my hero doesn’t pick up any gold.

I would recommend, at this level of sarven treasure, use Arryn or Ritic, and use teleporters, to dodge the wave of ogres.

1 Like

here is my new code. I am using Arrny and was testing to see if I could dodge the missiles. It says that t.copy is not a function even though i am not using any function called “t.copy.”

y = 0
x = 0
goals = hero.findItems()
def dodgeAndCollect():
    goalPoint = goals[y]
    goal = Vector.subtract(goalPoint, hero.pos)
    goal = Vector.normalize(goal)
    goal = Vector.multiply(goal, 10)
    yaks = hero.findEnemyMissiles()
    yak = yaks[x]
    distance = hero.distanceTo(yak)
    if distance < 1.5:
        # First, make a Vector from the yak to you
        vector = Vector.subtract(hero.pos, yak.pos)
        # Now use Vector.normalize and Vector.multiply to make it 10m long
        vector = Vector.normalize(vector)
        vector = Vector.multiply(vector, 10)
        # Once you have the 10m vector away from the yak, use Vector.add to add it to your goal vector!
        goal = Vector.add(vector, goal)
        y += 1
        x += 1
while True:
    # Finally, determine where to move by adding your goal vector to your current position.
    moveToPos = Vector.add(hero.pos, goal)

i am borrowing some code from the level skating away, which is why you will see my code refer to the missiles as “yak”

i think the problem is that x and y don’t reset after each time you use the function because they are defined outside of it. Put y = 0 and x = 0 at the beginning of the function and you should be fine.

1 Like

quick question. do teleporters have cooldown and if so, how can you see when the cooldown is ready

also how do you know when you are near the teleporter?

thanks! :slight_smile: (20 chars)