Is this solved? I presume not from your other post (Must have “missed” it, but…-the code for planting a flag in the first place)
If not please post your current code and I’ll see what I can do.
Thanks
Danny
self.moveXY(66, 57)
back = 0
while True:
enemys = self.findEnemies()
index = 0
closest_soldier = None
soldier_dist = 999
closest_archer = None
archer_dist = 999
closest = None
dist = 999
while(index<len(enemys)):
distance = self.distanceTo(enemys[index])
if(enemys[index].health>0 and enemys[index].type != "sand-yak" ):
if(enemys[index].type == 'archer' and distance<archer_dist):
archer_dist=distance
closest_archer = enemys[index]
if(enemys[index].type == 'soldier' and distance<soldier_dist):
soldier_dist=distance
closest_soldier = enemys[index]
if(distance<dist):
soldier_dist=dist
closest = enemys[index]
index +=1
if(closest_soldier and soldier_dist<10):
enemy = closest_soldier
elif(closest_archer and archer_dist<20):
enemy = closest_archer
else:
enemy = closest
if(enemy):
if(self.health<self.maxHealth/2.5 and back==0):
self.moveXY(40, 85)
back = 1
elif(self.health<self.maxHealth/5 and back==1):
self.moveXY(40, 85)
back = 2
elif(self.isReady("jump") and self.distanceTo>15):
self.jumpTo(enemy.pos)
elif(self.isReady("bash")):
self.bash(enemy)
elif(self.isReady("cleave")):
self.cleave(enemy)
else:
self.attack(enemy)
@Alexbrand No, I don’t have emperors gloves or viking helmet
Do you really need all thees extra brackets?
Try to remove like
if self.health<self.maxHealth/2.5 and back==0
What would I do to change that?
That isn’t my post…
Sorry, I’m meant your post at the bottom of that topic.
About the level.
You don’t need to change much of your code.
I won quite easily (using your equipment) when I changed two things:
- The sword. Runesword has high damage, but it’s really slow and archers only have 30 life anyway. I would strongly recommend the short sword for killing lots of little enemies quickly.
- The way you came towards the archers. Instead of going to the bottom of the archer line, why not go to the top? The ogres will then die on your soldiers and archers while you kill their archers from above.
You definitely still need to run away at the end using that code, though I did it when Tharin had barely any health.
Danny
The variable you want is dist and assign the distance. This leaves your soldier_distance variable set for the soldiers only.
if(distance<dist):
dist = distance
Sorry, I was busy IRL.
So, it takes me a couple of days to beat this level without all this stuff: emperors gloves, viking helmet, invisibility. Interesting, but pretty hard for me)
First, I tried to find health balance. If hero is weak, he can’t survive for the whole quest time. After all, I think the more health you have at the start, the more chances to pass the level you have. With 2850 hp at the start, hero has 160 hp in the end (actaully 12 hp for the first time as i forget to except "sand-yak"
from targets).
Then, you need tactics. I’d recommend to stop enemy hero, kill some archers, eleminate shaman, kill the rest of archers, retrieve back.
As for code (Python) I used len(archers)
as condition to determine target.
Tricks: “bash”+“bear-trap” to stop enemy hero.
These advices are hints, not the straight instructions. There are many ways to complete the level I think. Hope you’ll find your one.
Good luck!
@RiceRunner
One important thing about equipment - I changed copper ring to damage reflection circlet. My solution didn’t work without it.
And yes, as Deadpool198 said, there is no need in such powerful sword.
Frick me, I don’t know how to thank you!
Just that one change and BOOM I completed the level
I happily clicked solution and let out a HUGE sigh of relief
Thank you SO MUCH and keep on going…
@Deadly_Rice0769
P.S.
I shouted out “YEEEES” in my computing class and felt imediatly embarassed but, I didn’t care
P.P.S. Check out my other topics if u can
Hi)
Well, I’m glad that it helped) Thank you for feedback)
Someimes even one .
or any other symbol in code repairs or ruins the whole success) It happend many times to me. So do equipment things.
Wish you good luck) Try, try and don’t ever give up)