How to target doppelganger?


#1

I know how to target types: if (enemy.type == "sand-yak") ..., but I don’t know how to target a particular enemy, like my doppelganger. What is their enemy.type? Or can I select them by name? I did try if (enemy == "amara") ... as an example, but it doesn’t seem to work.

Any hints?

Thanks!


#2

You could use if (enemy.id == "Amara") {, but I don’t think that works.

As an alternative, you could use if (enemy.type == this.type) {. That should work better.


#3

Ahh, I haven’t been introduced to id yet. It did not work.

The second method did work! So, how does it work? I’m assuming the Doppelganger as the same type as my hero?

Thanks again, Chronist!


#4

Depending on the level, it might not be a doppelganger! Remember that. They should have the same name, however. You can always find out their name by using cycling through the enemies with:

enemies = self.findEnemies()
    for enemy in enemies:
    self.say(enemy.id)

On the multiplayer levels it’s often something like “Hero Placeholder” or “Hero Placeholder 1”.


#5

I know this is “solved” but another thread had some good related information Easiest way to select the enemy hero