Add instances of actor to array

I would probably have one array in the game mode or somewhere similar which tracks all flags, so as they are spawned they are added to that array.

For me, the array would probably be a type AFlag which inherits from AActor, or it could be a struct or a simple class. In either case you should track

  • Flag Instance (AActor or whatever your flag type is - This isn’t necessary if your array is of type AFlag, as the element is the flag instance)
  • Flag ‘Owner’ (Int, Enum or some other type which identifies the original owners such as Blue, Red)
  • Flag ‘Possession’ (Int, Enum as above, but this time it indicates who has possession now).

You could also use a TMap or a TSet depending on exactly what you want.

You can now perform simple loops through the list / set / map which will allow you to check how many flags exist and how many of them have been captured etc.