Sarven brawl hep


#1
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(enemy)
        if self.isReady("bash"):
            self.bash(enemy)
        else:
            self.attack(enemy)

This is my code for the 2 brawl levels before this and It works fine. This works on sarven brawl most of the time, but after a while it targets the yaks. how should I fix this?


#2

Use the function .type
In example:

loop:
    enemy = self.findNearestEnemy()
    if enemy.type != "sand-yak":
         attack(enemy)

!= means not equal


#3
loop: 
    enemy = self.findNearestEnemy()
    item = self.findNearestItem()
    if item:
        pos = item.pos
        x = pos.x
        y = pos.y
        self.moveXY(x, y)
    while enemy.type != "sand-yak":
        if enemy:
            if self.isReady("cleave"):
                self.cleave(enemy)
            if self.isReady("bash"):
                self.bash(enemy)
            else:
                self.attack(enemy)

I changed my code to this and now it says ‘enemy’ was null on line 9.


#4

Change the order of your “while enemy.type” and “if enemy” statements
Your while enemy.type line has not verified that the variable “enemy” is pointing to anything (it might be null) so do the “if enemy” check first.

    while enemy:
        if enemy.type != "sand-yak":
            if self.isReady("cleave"):
                self.cleave(enemy)
            if self.isReady("bash"):
                self.bash(enemy)
            else:
                self.attack(enemy)

#5

It because it’s scanning for the type when there are no enemies.
Make it:

if enemy:
    if enemy.type != "sand-yak":  
          #attack or whatever

#6
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 enemy.type != "sand-yak":
            if self.isReady("cleave"):
                self.cleave(enemy)
            if self.isReady("bash"):
                self.bash(enemy)
            else:
                self.attack(enemy)

Now I have this. It works fine, but I don’t have enough health. I can almost get the Enameled Dragonplate though


#7

OMG Shannon NOOOOO Don’t get the enammled! It is far overpriced for the health it gives. Get the red chestplate or obsidian please.


#8

Oops… too late, I bought it before I saw your post.


#9

Ehhhh :stuck_out_tongue: You just wasted some gems but eh.


#10

Should I get the sword of the forge or the sword of the temple?


#11

idk they are both quite slow.


#12

Actually, the Sword of the Temple Guard has a cooldown of 0.26 seconds, which means you will have nearly four attacks per second with it at 53.58 damage per attack–more damage, of course, if you are using Tharin or Ayna. The Sword of the Forgotten, as @Wiilli pointed out, though it has a slightly higher DPS, is very slow, at about two attacks per second. I’d definitely save up for the Sword of the Temple Guard, even though it does cost another thousand gems.


#13

The Black sword is pretty good. Darksteel Blade.


#14

Of course, it costs 2000 gems, while you can buy the Kithsteel Blade for less, as well as getting more DPS and higher range.


#15

The sword of the temple guard is boss if you go ham on the munchkins