Download

Adding Actors to Array

Hello,

I’m having a tough time trying to figure this out.

I am trying to add my enemy actors to an array based on distance from the player. So the closest would be at index 0 and the next closest would be at 1 and so on.

Can someone show or explain to me how to do this? I am sure it’s something simple that I’m just not getting at the moment!

Thanks!

How often would you like it to be calculated ?

Every .5 seconds. I used that by default with timelines. I want fast paced battles so things should move pretty quick

Hello,
As Yun-Kun said frequency of check can be a trouble. Idea i would follow is first “get all actors” and use this array to set an array of integers with a check length between enemy and player. If array element is > than current length then set array integer same as checked one and add one to checked integer and all the ones after. When done get first array to set a new array with “set element” using array of integers as index. There are few tricks needed i suppose, like initial variable needed to be high and a bool to check if array as been set or if this is last element on completed (then it needs to be added)

this this gave the idea to create this new thread
http://goo.gl/oQ8xMG

Have you looked into using EQS? It performs exactly this function, giving a score to objects based on your criteria.