How to get location of closest enemy pawn?

you need to make an array that contains all the actors in your radius. there are many ways to accomplish this such as overlaps or get all of class for example. next you need to run a test on each enemy to get its distance from the player. as you do this you also record the closest one as you go along and replace it as needed. by the time you done comparing them all you will have the closest.

below is an example of how this is done. basically you begin with an array of the enemies. then you set the first index as the closest so you have something to compare to later. then you use a for each loop to compare the distance to each enemy and if that enemy is closer than the current closest enemy you set the one being tested as the current closest.

ok now for your last question, on the get node the number you put in represents the index that you want to get from the array. basically if you have a list of things and you number each entry the index is that number. also you mentioned that you have a purple color, that means you are getting a class and not a reference which is something you dont want in this case. for what your looking to do you need a reference to the actors that exist in the scene so your variable should be of type actor reference which will be blue.

2 Likes