How to identify and target headhunter?

I thought this would work:

hh = self.findByType("headhunter")

But it didn’t work for targetting the headhunter. Like, while hh.health > 0 and all that jazz. I had to do this, then it worked fine:

for enemy in self.findEnemies():
    if enemy.type == "headhunter":
        hh = enemy

Is there a bug with findByType or am I not doing it right?

Oops, it was my mistake. There is only one headhunter (at least on the level I’m on) so I was thinking it would return an object but of course it just returns an array with one member.

I just needed:

hh  = self.findNearest( self.findByType("headhunter") )

Or anything that returns an object from a list. Sorry, I would delete the original post but doesn’t look like that is possible.

if you know there is only one then

hh  = self.findByType("headhunter")[0]

should do the trick. (with no function overhead, not that that matters so much on this level)

Thanks vlevo, that’s a good way.

A little bit of a tangent but while experimenting on this level I also noticed that the lightning stick has the nice feature that it seems to go through things in a way that arrows don’t. You can hit the headhunter with lightning even when he’s behind all the ogres and stuff, but not with arrows because they get blocked by ogres.

I hope I can remember that tidbit when I get to mages/rangers. :smiley:

You can bookmark it to find it faster. Left to the Reply-Button you can find a reading-sign. That’s the bookmark-button.

Hmm, bookmarks the thread, to bad I couldn’t bookmark post #3.

Ah! there is a little “bookmark” under each individual post (in the almost completely faded out controls) at first I only saw the ones at the bottom.

Thanks!