TELLES0808, I have implemented something similar to what you described earlier, basing my events off of the wonderful —
However, I am having problems getting my arrays to actually fill out. Here's what happens in my events:
Each time a computer object is spawned (three spawn in my game), an instance of an array called enemyDistance is created. The UID of this array is then assigned to the arrayUID instance variable of the computer object. Since 3 computer objects are spawned, there are 3 instances of this array and each one is assigned to 1 computer object.
The enemyDistance array is set to have a height equal to the number of player objects on the board. The idea is to use pathfinding's find path to calculate the distance from the computer object to each player entity. After all the distances (the UIDs of the objects are also stored) are calculated, the game is supposed to pick the closest one (based on path and not actual distance, which is the whole point of this setup) and set it as its target.
However, right now the distances aren't being computed for some odd reason, so all the distances stored are equal to zero. Can someone take a look and help me out?
<img src="http://i.imgur.com/6eV7Vaq.png" border="0">
<img src="http://i.imgur.com/ZivGRqz.png" border="0">
<img src="http://i.imgur.com/ue0uqdG.png" border="0">