Targeting in an order

Sup people. I will start saying that as english is not my first language, I don’t know other way to search for this, and that i’m sorry if this is confusing.

Now, i’m trying to make the player target multiple enemies and then attack each one in the order with some kind of flying attack, I already manage to make the target and attack (Only one actor) with line trace, however, i don’t know how to do something like a sequence targeting neither how to repeat the attacking action until there are no more targets.

Edit: I belive that there is a way to “mark” each actor or something similar, but couldn’t find out how.

Also, i have only a basic understanding of blueprints and programing logic.

II don’t know on what system you working on so i can give general hints that may push you forward

Break up the issue to smaller problems, targeting and attacking are 2 separate things. Concentrate on Targeting first figure how you want player to select multiple targets. You can keep multiple targets in array, if you gonna add actors in to array in order of player selecting the actor in array will ordered in that way, remeber to keep selection state (some bool) in target actor so you can avoid double targeting.

Then doing attack will be just attacking in order of array, make a intiger which will keep index of actor in array that player currently attacking, when attack is done increase integer by one and attack next actor in array, integer should point index of next actor after you increased it. When integer = size of array then stop attack as we know all targets been attacked.

But if you want all targets to be attacked on single frame you can just use ForEach node to apply attack to all targets in array.

After attack is done, set target bool in actors to false (you can do so with ForEach) and then clear the array, or else you want player to keep targeting same enemies.

Thanks :smiley: Your tips really helped. I manage to make it work. Once I have it working a little better now I’ll post it here, in case someone find it usefull.