Targeting system needs fix

I set up this targeting system following a tutorial online. It triggers with tab however, every time I press tab it targets the closest enemy. I want it to target the closest enemy only the first time and then target the second closest and so on every time I riclick tab. There’s a target list set up and instead of always picking the closest I’d like it to pick the next one.
Below the BPs



Maybe try getting last indexed and add +1 the index integer to set the next target. I’m only saying this conceptually here…

Hey there @TheSceriffo! So it looks like you need to process the array and sort it. One way would be to take the array of actors, put them through a function to sort them into order, then after they are sorted in order you can choose which step you’d like. A good example with a but of redundancy in it would be this one:

However at the end you would still need to choose which you wanted to target afterwards.

Hope this helps!

1 Like