it sounds like what you’re trying to do is a mechanic similar to what a Bard character would do if I’m not mistaken?
ANSWER PART 1 - I think the best way to handle this would be to use string variable that will record a sequence of button presses.
This way, the player can press a button, the number of that button is appended to the string. This process repeats until the player has reached the maximum combo length (in your example this was at 6). Once the string’s length is equal to 6, you can pass the string through a switch statement that will identify the string as a key for what action that you want to happen.
Instead of a max combo length you could make a key for the player to enter that would indicate to the game that the combo is over. For example: if the last three characters in the string are equal to “2,1,3”, cast the spell base on the previously entered numbers. You could also just make “7” the cast key which is simpler.
ANSWER PART 2 - Now to handle the casting to an actor that is 10 meters from it. I think the best way to handle this would be to create a sphere collision that has a radii of 10m with the player character at the center. Whenever the string in answer part 1 is casted, you can run this code to get all actors inside the collision sphere at that time, then apply the damage to all of them.
What this code does is it gets every single actor that is inside the player character’s sphere hitbox, the uses a for each loop to iterate through each of the pawns inside. It is an overlap detection algorithm. In this specific case is applies damage to the other pawns but you can change that to be whatever set of code you want.
Since you said destroying a barrier or waking a portal, I’d say you should do is add your switch statement logic that I mentioned earlier in part 1 to figure out what spell was used. Then use a cast node that is relative to the given spell.
In this example, when a spell of “1,2,3” is read, the program will try to cast to each actor in the sphere, but it will only succeed when the actors are of type BP_BaseEnemyAi (which is one of my pawn names). If a different spell is passed, it will run the other corresponding node. This way you will only run the code that is relevant to your spell, and apply it to all the actors of specified type in range.
One thing to remember is that casts act like if statements, so if the input object is of that type, the cast will succeed. If it is not, it will run the cast failed node. So you can also use this to try a cast to a different pawn with the same spell.
Another thing that might help with casting is using inheritance with child blueprints. This way when you cast to the parent blueprint it will work for all different child blueprints. It will also make your code more efficient. (If you aren’t familiar with inheritance I’d google it since this post is getting long and it shouldn’t be hard to figure out since it exists in all Object Oriented Programming languages)
Hopefully this helped, if there’s anything else that you’re still not sure enough feel more than free to ask and I will try to clarify as best I can
Happy programming!