Sarven Treasure 4

I need help on Sarven treasure 4, can anyone help me?

What is your code? Can you post it?

ok wait

while True:
    item = hero.findNearest(items)
    enemy = hero.findNearest(enemys)
    if (enemy and hero.distanceTo(enemy) < 15):
        hero.attack(enemy)
    elif (item):
        if (hero.isReady('jump')):
            hero.jumpTo(item.pos)
        else:
            hero.move(item.pos)

thats the code @AnSeDra

why didn’t u just use hero.findNearestEnemy()

if theres always an enemy, u will never collect items

where do i put the find nearest thing

please answer me @EpicCoder999

Is there an error or can you just not beat the level?
Danny

So this code has worked for 1, 2 and 3 of sarven treasure but sarven treasure 4 is a swarm of ogres and i dont know if it is because of the ogres or code that i die

sarven treasure is extremely hard - a big gap between, i even died with over 9000 hp!

@Jeremy_Yu Can you at lest once post your own code. This code is again stolen from the same place:
sarven-tresure
You and @EpicCoder999 are only spamming and bragging.

1 Like

what place is that?(20chars)

while(true) {
var item = hero.findNearestItem();
var enemy = hero.findNearestEnemy();
if(enemy && hero.distanceTo(enemy) < 15) {
hero.attack(enemy);
} else (item) {
if(hero.isReady("jump")) {
hero.jumpTo(item.pos);
} else {
hero.move(item.pos);
}
}
}

why double brackets???

github, dont u even know?

Don’t pretend it’s a concidence, you must have got if from somewhere. Most native english speakers wouldn’t have written “enemys”, and I think the person who wrote that code is Russian (all the comments on his code are in russian.
Danny

OK @Deadpool198/ danny

Well i solved it(sarven treasure 4) with a different code so ya

i relly need help with sarven tresure 2. I cant do it

i cant even do sarven tresure 2