I need to learn how to group all player characters from all enemies

The game is a open world like beat 'em up where you are able to switch out your character during battle. Right now I’m starting to build a battle system by beginning to work on a lock on system, and I need to make sure the player is locking on a enemy type as well the enemies when the player switch character.

Just letting you know, I’m a noob and I’m learning as I go and I need to know what direction I need to take this. In Gamemaker Studio there was a thing called a list variable that stores values, I believe they use it to store items and I imagine characters as well, if I know how to do something like that I can make multiple characters and switch them out by hitting a button. I’m not really good explaining so I can get the proper help but if you got questions please ask and I’ll try my best.