I use the code
enemies = self.findEnemies()
if enemies:
self.attack(enemies)
but it says that it doesn’t work. may I have some help???
You are targeting multiple targets when you can only target one. You have to do it with a single enemy.
okay but why do the current glasses I have only target everyone when I want to target one?
What glasses do you have?
The Kithgard Workers Glasses
Then define enemy as self.findNearest(enemies)
after doing enemies = self.findEnemies()
. After that all you have to do is replace enemies with enemy in this: if enemies:
and self.attack(enemies)
No problem slamdunx.
Sorry for the extra question but how do I turn enemies into enemy exactly?
Does code type matter?
are you saying that instead of [quote=“Neel_Sharma, post:6, topic:7123”]
if enemies:
[/quote]
and[quote=“Neel_Sharma, post:6, topic:7123”]
self.attack(enemies)
[/quote]
I put enemy in those parentheses? Because if so the game says that enemy isn’t defined.
Have you played the level Lurkers? It explains how to use findEnemies()
. You can also use the documentation found in the spell pallete for findEnemies()
for more examples.
In short:
-
findEnemies()
returns an array/list of enemies. -
attack(enemy)
takes a single enemy argument. - You cannot
attack()
an array/list.
So you choose an enemy from the list of enemies. There are multiple different ways of choosing an enemy:
enemies = self.findEnemies()
nearestEnemy = self.findNearest(enemies) # choose nearest enemy with `self.findNearest()`
firstEnemy = enemies[0] # choose first enemy in list
# Make sure your enemy isn't null/None, then do whatever with it.
@trotod I actually haven’t played Lukers yet, I am currently on medical attention. thanks for the help though.
do self.attack(enemy);