This.findEnemyMissiles doesn't work


#1

Every time I try to return an array, hero never does anything. For example, I tried

if(this.findNearest(this.findEnemyMissiles())) {
   this.cast("windstorm", this);
}

#3

It works for me

loop:
       missiles = self.findEnemyMissiles()
       missile = self.findNearest(missiles) 
       if missile:
         if self.distanceTo(missile) < 14:
            self.cast("windstorm", self)

#4

Yeah but I need help of why it is like that; the findEnemyMissiles function doesn’t work…


#5

I don’t have anyone with “windstorm” so:

this.moveXY(20,25);
loop{
    if(this.findNearest(this.findEnemyMissiles())) {
        this.say("windstorm");
        //this.cast("windstorm", this);
    }
}

but that works perfectly fine, for me.

(There is no loop in your code snippet, so are there really missles when it runs?)
Is windstorm ready to cast?
Stick a say in there before the windstorm (Like I have.) to know for sure that it is or isn’t going in.


#6

The method works fine. You are doing something wrong. post your full code or nobody can help you.