Hi guys, Im new to Unreal Engine i found a problem i cant make my turret cast to an AI controlled pawn which i duplicate the third person character blueprints and delete all events.
Did you try plugging the “Get AI Controller” node into the object pin of the “Cast To” node?
Im sorry for the late reply but can you tell me more specific? Because im still new
Thank you for your reply!
I found this but this said the BP_Enemy_Base itself doesnt inherit from the AI Controller. The reason maybe because i copy the third person character and i delete all event.
Sorry for my initial suggestion, I couldn’t understand the context correctly. I think this is inside your AI Controller blueprint, right? You can just get the “Get Controlled Pawn” node, leave it’s target pin empty (which will be set to self by default) and plug it’s return value into the object pin of your Cast To node
This is still in my BP_Turret. Im trying to get the pawn sensing to cast to my BP_Enemy_Base so it can shoot at my AI.
Oh right That’s not a custom event! Ok it makes sense now. In that case, the connections you showed in your first image should be correct! Does your cast fail? It shouldn’t I think.
I created the Pawn Sensing by add a sensing in my Pawn Sensing. However, i thought it was right in the beginning but it wont work. It said it’s failed to cast to my BP_Enemy_Base.
Here’s a quick way to cast to any blueprint under the same class which will work for sure. You can get the “Get All Actors of Class” node, select your enemy’s character blueprint from the dropdown menu inside that node, then drag out a “Get” node out of the “out actors” pin of the node and finally plug the output pin of the Get node into the object pin of your Cast To node.
You need to plug in the execution pins of the Get All Actors of Class node
The input execution pin to the On See event and the output execution pin to the Cast To node. Also just choose the enemy blueprint itself instead of the base one.
Thank you Vis Agilis i found the solution based on your suggestions. I just need to get a check and i use the wrong cast.