Generally speaking if you want to control multiple characters in UE4 with a free Camera (like IIRC was in BG).
You make a "GOD" player controller - that will have its own
Pawn let's say some sphere with an arm and camera attached to it.
Then Process the input inside your player controller - and delegate the commands to your characters.
EDIT per DMGregory's request
I will not get in to too much code here - as it will take quite a lot but I will try to expand on UE4's specific and a general controls:
1) A "GOD" PlayerController (PC for short):
In this scenario a PC will not be possessing any
ACharacter directly, it will have it's free
APawn let's call it a CP (for camera pawn).
The CP will be anything than just a simple setup for a free RTS like camera lets try to describe it and its functionalities.
We will use the
SpringArmComponent to handle Zoom in/out if needed.
ACameraPawn will be the PlayerPawn a pawn that is possessed by the PC
And the PC will move it around as a whole
AActor for the in SceneCamera navigation.
Now we will build a base class for our characters that we will be controlling them from our PC - we will define some basic functionality:
//Remark the code to be threated more like a pseudo code I am no where around UE4 and have no any compilers handy here.
class ABaseCharacter public ACharacter, IAttackable //... whatever interfaces are needed...
//... C'tor ... D'tor omitted...
bool MoveToWorldLocation(FVector worldLocation);
bool AttackTarget(IAttackable* target);
These are more or less a minimal needed methods for our
So we will be able to send it some basic orders.
Now the PC itself (I will not go into code details here, but will describe a general approach) Note: the player pawn is set in the UE4s settings so no code needed for the setup.
Our PC will consume all Player inputs Keyboard (WSAD) and mouse (left right clicks, scroll whatever else).
So the WSAD will be processed inside the PC itself and all it will do is just set its controlled pawn's world location and rotations - Scroll-wheel will set the length of pawns
The PC will hold your
TArray (not really matters if they were placed in world all spawned dynamically.
Now on mouse input (for instance Goto World Location) it will iterate the
TArray and dispatch its
MoveToWorldLocation method - of-course then the
AAIController will execute the
MoveTo task or whatever implementation based there.
So this is how we defined a "GOD" PC in RTS like style that can control multiple characters.