How can I make my custom event be called and/or executed?

Can someone explaine or give a small example of this.

I cant figure out, do I have to first make in my RTSPawnController subclass at EventBeginPlay possess the pawn? Or is it possessed by defult.

I cant seam to make my Player Controller (Myth_Player_Controller) communicate with Mort_AI_Controller ( a sub class of Myth_Controller, which is subclass to AI_Controller, just as mentioned in another post “Create an AIController subclass (let’s call it RTSPawnController), and create RTSPawnController subclasses for each of your different pawns” this taking from Controlling multiple pawns RTS - Blueprint - Epic Developer Community Forums).

By the way mort is a name of the pawn(unit), which is a character class BP. And Myth_Player is just a empty capsule component with camera setup with its controls to navigate the world.

Mort_Pawn is allready placed in the wold…

Im sure ive messed up with “get player controller”, “get pawn controller”…or somewhere in between.

I would really appreciate any help !

I’m not sure I fully understand what’s your problem :), so lets start with this: all you have to do to have an AIController possess a pawn is to set AIControllerClass property in Pawn-derived blueprint’s default properties, and then either have these pawns dragged-and-dropped into your level or spawned with SpawnAIFromClass.


Thank you for youre repley, my end goad is to make my PlayerController give orders to my AIPawnController, which for various reasons doesnt happen.

Ive checked my Mort_Pawn and in its AIControllerClass there is my custom Mort_AI_SubClass_Controller.

Mort_Pawn has a parent class - Character. And its placed in the world.

Mort_AI_SubClass_Controller has a parent class - Myth_AI_Controller.

Myth_AI_Controller has a parent class - AIController.

Myth_Player_Controller - player controller.

Myth_Player(Player) has a section AIControllerClass and it was by default. AIController, I’ll swich that to Myth_AI_Controller.

I wasnt sure wether or not my Mort_Pawn was allready possessed by the Mort_AI_SubClass_controller in which i am creating logics. But now I think it is. You can correct me on this.

So my problem right now is i cant seem to make the my custom event in the Mort_AI_SubClass_Controller be called and/or executed by my Myth_Player_Controller

Ive created this short example, but it doesnt work. Please help!

I suggest you set up some breakpoints and see if everything is called as you expect. Also, when a BP is paused by a breakpoint you can read pins’ values by mousing-over them.

However, after another look at your setup I can see what’s your problem. You call GetPlayerPawn which retrieves (in this case) first player controlled pawn, and as such doesn’t have an AI controller. That’s why casting to Mort_AI_Subclass_Controller fails (which is easily discover-able by observing BP’s flow at runtime).

What you need to do here is to call GetAllActorOfClass using your AI pawn class as a parameter, and iterate on the array you get as a result.

Ok thank you for a quick repley i will research how to use the breakpoint and I will return with my result.

Hello, ive used the GetALLActorsOfClass node and it worked, all the existing in the level pawns of my Custome AI class were responding to the click to move to location.
But now that ive started making the next step, checking what im tracing and adding that actor to an actor array and using that array as a selection of pawns, it seems to not work for some reason. For some reason it does a Cast Fail.
Heres my images:
First image is with GetALLActorsOfClass node which works.
Second is the how it ended up and fails to cast to custome AI controller to move pawns to location.

Now that im more familiar with debugging (sort off) i figured out that theres some array type issue, becouse
Left Mouse Click operation works, the result of the trace is put into the actor array. But the Right Mouse Click operation doesnt work with that array.
But if i make Left Mouse Click call all GetALLActorsOfClass Node and “set” actor array than the Right Mouse Click does work :open_mouth:

heres some more image:

I cant figure out why my actor array is different than the GetALLActorsOfClass, its as if trace produces a different result than the GetALLActorsOfClass .Please help!