Sarven Treasure/ Python/ help/

My character is doing everything right but just doesn’t have the time to collect 150 coins

while True:
    enemy = hero.findNearestEnemy()
    items = hero.findItems()
    bestItem = None
    bestValue = 0
    itemsIndex = 0
    # Loop over the items array.
    # Find the item with the highest valueOverDistance()
    while itemsIndex < len(items):
        item = items[itemsIndex]
        if item.value / hero.distanceTo(item) > bestValue:
            bestItem = item
            bestValue = item.value / hero.distanceTo(item)
        itemsIndex += 1
    if enemy:
        if hero.isReady("cleave"):
            hero.cleave(enemy)
        elif hero.isReady("punch"):
            hero.punch(enemy)
        elif hero.isReady("bash"):
            hero.bash(enemy)
        else:
            hero.attack(enemy)
    if bestItem:
        hero.moveXY(bestItem.pos.x, bestItem.pos.y)
    else:
        pass

is there anyway i can speed them up?

Hi Some_Guy,

Maybe only attack the enemy if it’s really close to you…?

Jenny

try getting the emporers gloves, and use

elif hero.canCast("chain-lightning", enemy)
    hero.cast("chain-lightning", enemy)

instead of

elif hero.isReady("punch"):
    hero.punch(enemy)

also try using boots of jumping or leaping with this command OUTSIDE of if enemy as

  1. they are faster
  2. jumping to targets
if hero.isReady("jump")
    hero.jumpTo(bestItem)

Hi great suggestion but my charracter has stopped finding the enemy

enemy = hero.findNearestEnemy()
while True:
    items = hero.findItems()
    enemy = hero.findNearestEnemy()
    bestItem = None
    bestValue = 0
    itemsIndex = 0
    # Loop over the items array.
    # Find the item with the highest valueOverDistance()
    while itemsIndex < len(items):
        item = items[itemsIndex]
        if item.value / hero.distanceTo(item) > bestValue:
            bestItem = item
            bestValue = item.value / hero.distanceTo(item)
        itemsIndex += 1
    enemy = hero.findNearestEnemy()
    if bestItem:
        hero.jumpTo(bestItem)
    elif hero.distanceTo(enemy) <= 10:
        if hero.isReady("cleave"):
            hero.cleave(enemy)
        elif hero.isReady("punch"):
            hero.punch(enemy)
        elif hero.isReady("bash"):
            hero.bash(enemy)
        else:
            hero.attack(enemy)

Now they refuse to attack : (

I tried using Jump but they jump once and never they never Jump again nor move @Ashmit_Singh

enemy = hero.findNearestEnemy()
while True:
    items = hero.findItems()
    enemy = hero.findNearestEnemy()
    bestItem = None
    bestValue = 0
    itemsIndex = 0
    # Loop over the items array.
    # Find the item with the highest valueOverDistance()
    while itemsIndex < len(items):
        item = items[itemsIndex]
        if item.value / hero.distanceTo(item) > bestValue:
            bestItem = item
            bestValue = item.value / hero.distanceTo(item)
        itemsIndex += 1
    enemy = hero.findNearestEnemy()
    if enemy:
        Distance = hero.distanceTo(enemy)
    if Distance <= 10:
        if hero.isReady("cleave"):
            hero.cleave(enemy)
        elif hero.isReady("punch"):
            hero.punch(enemy)
        elif hero.isReady("bash"):
            hero.bash(enemy)
        else:
            hero.attack(enemy)    
    elif bestItem:
        hero.jumpTo(bestItem)
        hero.moveXY(bestItem.pos.x, bestItem.pos.y)

I found what was wrong @jka2706 but they are still to slow

wait i fixed it but now my character is killing all the enemies then stopping

while True:
    items = hero.findItems()
    enemy = hero.findNearestEnemy()
    bestItem = None
    bestValue = 0
    itemsIndex = 0
    # Loop over the items array.
    # Find the item with the highest valueOverDistance()
    while itemsIndex < len(items):
        item = items[itemsIndex]
        if item.value / hero.distanceTo(item) > bestValue:
            bestItem = item
            bestValue = item.value / hero.distanceTo(item)
        itemsIndex += 1
    
    if enemy:
        Distance = hero.distanceTo(enemy)
    
    if Distance <= 10:
        if hero.isReady("cleave"):
            hero.cleave(enemy)
        elif hero.isReady("punch"):
            hero.punch(enemy)
        elif hero.isReady("bash"):
            hero.bash(enemy)
        else:
            hero.attack(enemy)
    elif bestItem:
        if hero.isReady("jump"):
            hero.jumpTo(bestItem)
        else:
            hero.moveXY(bestItem.pos.x, bestItem.pos.y)

well… just tweak

if Distance <= 10:

to

if enemy and distance <= 10:

lowercase distance and note that you want to keeps both if enemy and the one i just said

Thank you that fixed the enemy issue but my character is still to slow

save up for the ring of speed maybe do a couple of brawls to get it so your character can run fast unless you already have it

Ok ill get back to you if i get it

boots of leaping are cheaper i think, i use those, they are 4x faster than regular boots

I am using boots of leaping

huh… you are using a starter hero right?

if you are a sub, get the fastest one, otherwise, just go for the ring…

The precious ring saves you time so you don’t need to attack enemies, and so does the order of the paladin, but mainly speed ring

Yeah the red head
I have

huh i have this…

have you tried using hero.jumpTo(target) yet?

Yeah but it was still to slow but helped me get closer

i dont know maybe alejandro or whatever is just slightly slower than the female starters or tharin, i didnt check the values… little difference

OH WAIT…
can you just like grind till mountain for boss star 2 or above and come back here pls…
it will make your life so much easier