I need help on my code for kithgard brawl 2


#1

here is my code

loop:
enemy = self.findNearestEnemy()
item = self.findNearestItem()
if item:
pos = item.pos
x = pos.x
y = pos.y
self.moveXY(x, y)
if enemy:
if self.isReady(“cleave”):
self.cleave(self.findNearestEnemy())
if self.isReady(“bash”):
self.bash(self.findNearestEnemy())
else:
self.attack(enemy)
self.attack(enemy)
self.attack(enemy)
self.attack(enemy)


#2

Hello dean, Can you format your code properly as in FAQ.
Thank you.

What are the problems I can only see one in else: yet I don’t know how to fix it yet but you can try to get around codes without or find out what is messing with else okay.


#3

This isn’t really a coding error, but you don’t need the self.findNearestEnemy() in the cleave and bash lines.

What do you need help with? You say you need help, but you don’t tell us what with.


#4

sorry i figured it out thx anyways


#5

my code is this:

loop: 
    enemy = self.findNearestEnemy()
    item = self.findNearestItem()
    if item:
        pos = item.pos
        x = pos.x
        y = pos.y
        self.moveXY(x, y)
    if enemy:
        self.attack(enemy)

    else:
        self.shield()

my hero just keeps dying in the first 30 seconds


#6

Hello, lazerA, and welcome. Please read the FAQ before you post again. It is essential that you learn how to properly format your code. I’ve done it for you this time, but do so yourself in the future.

As this is Kithgard Brawl, there is no “official” solution to it. Unfortunately, all I can suggest is to progress further in the game before returning to this level.


#7

I’m already on sarvern shepherd.
I have 3762 gems


#8

Oh yeah, my hero dies in the first few seconds in sarven shepherd


#9

I just got sword of the forgoton. I solved sarven shepherd.


#10

This topic is about Kithgard Brawl. There is no place here for talking about Sarven Shepherd.


#11

It might be a bug or it can be your health :smile:


#12

XD
You ask for help, then say you got over it? this makes me laugh.
Talking to the Dean person.


#13

I need the code for the kitgard brawl