I’ve been attempting to make an RTS using pure Blueprint, and I read on AnswerHub that the best approach to create an unit would be to create an AIController, in my example named RTSPawnController, assign this as the AI Controller for my Character (or Unit. I use the Character class for different units like Warrior, Archer, Mage, etc.), and then control these AI controllers with a global PlayerController.
First of all I’d like to know if this is the correct approach. Should I use characters for units? Should I use AI Controllers for units? Should I manage these AI controllers from a PlayerController?
Second of all, how would I get the AI Controller off of a character? I have created a function in my AI Controller called AI_MoveToPoint, and I would like to call this function for all the selected characters from my PlayerController Blueprint.
NOTE: This question is now solved. The answer is found in the comments of the accepted question.
First of all, I get all actors that have my BaseUnit class. Then I For Each through them, and cast each one to my BaseUnit class. From that point I can do a ‘GetController’, and cast the controller to my controller class. BP_RTSPawnController. At this point the cast was successful and I can call my controller’s move function.