Help: Levels in Glacier

You have

  yak = hero.findNearest(hero.findEnemies())

instead you need

 yak = hero.findNearestEnemy()

and

instead of doing this

  vector = Vector.subtract(yak.pos, hero.pos)
       
        vector = Vector.normalize(vector)

        vector = Vector.multiply(vector, 10)

Use this instead for each vector

yak_vector =

I didn’t want to say that but everything that you defined as vector has to be turned into

yak_vector

because vector isn’t looking for the yak which means when you scanned for the yak there was no use for it in the second part because you did not include a code to search for yak

When you use yak_vector it should make it to where it now is looking for yak

I could be wrong but i’m pretty sure that would be it is that you used vector for the second part which is actually supposed to be yak_vector

um, @Archipelago-Gold, are you even in the glacier?

Yes i fininshed the game why?

i didnt come to this forum until i only had two levels left

but anyways back on topic does it work?

I think he is loosing faith in you @Archipelago-Gold

@Dragonlouis, the vector here should be goal. If you want you could replace every variable vector with another variable. Otherwise, keep you code as it is.

You know what to many have their own opinions because a program can be written many different ways so here just take a look at this topic maybe it can help you because Chaboi_3000 explains some things in here maybe this can help instead of confusing you.

Its Windows key + shift + s
Lydia

image
that’s what’s happening and it didn’t work.


is my code(thanks a lot for the screenshot tip)

I said you need to yak_vector or yakvector to replace your vector =

Turn everything that you define as vector turn it into yak_vector

not working, my code is. But, really, all I did was change what the variable was called, right?

goalPoint = Vector(78, 34)

while True:
    # This creates a vector that will move you 10 meters toward the goalPoint
    # First, create a vector from your hero to the goal point.
    goal = Vector.subtract(goalPoint, hero.pos)
    # Then, normalize it into a 1m distance vector
    goal = Vector.normalize(goal)
    # Finally, multiply the 1m vector by 10, to get a 10m long vector.
    goal = Vector.multiply(goal, 10)
    
    # To avoid the yaks, if you get within 10 meters of a yak, you should vector away from it.
    yak = hero.findNearest(hero.findEnemies())
    distance = hero.distanceTo(yak)
    if distance < 10:
        # First, make a Vector from the yak to you
        yak_vector = Vector.subtract(yak.pos, hero.pos)
        # Now use Vector.normalize and Vector.multiply to make it 10m long
        yak_vector = Vector.normalize(yak_vector)
        # Once you have the 10m vector away from the yak, use Vector.add to add it to your goal vector!
        yak_vector = Vector.multiply(yak_vector, 10)
        goal = Vector.add(yak_vector, goal)

    # Finally, determine where to move by adding your goal vector to your current position.
    moveToPos = Vector.add(hero.pos, yak_vector)
    hero.move(moveToPos)

look close what do you see that doesn’t belong here

 goal = Vector.add(yak_vector, goal)

try doing hero.pos instead of yak_vector here