Cast Failed to AI Blueprint

Hey, My cast to my Ai Blueprint keeps failing and i have no clue why.
I just need to have an input pressed and then minus health in the AI Blueprint.
,Thanks.

][1]

when you get player pawn 0, it mean you get pawn from your player controller 0, are you sure that a correct 1, also if you are in player controller blueprint just get the pawn from get Get Controlled Pawn

Yeah, i’ve tried get controlled pawn along with other ones this is the only cast that seems to give me problems.

You can only cast an object to a type if the object is actually of that type. What is the parent class of your AI blueprint? Also, in what blueprint is the event graph you posted located?

The graph is located in MyCharacter blueprint and my parent class is an Actor (I just copied the default MyCharacter and names it AI)

I don’t really follow your setup, but GetPlayerPawn will return whatever pawn is controlled by your player controller - I guess your default player pawn as configured in the game mode. Presumably this is not your AI character, as that wouldn’t make much sense.

If this graph is within your player-controlled character blueprint, and you want to reduce the health of your AI character, you need to get a reference to your AI from somewhere. Casting just makes an assumption about the type you are interacting with in your blueprint, it cannot actually find a reference.

I fixed it guys, Thanks for all the help.

This is also worked for finding a placed object to cast so the UMG would have a proper reference to cast to.

Hey Guys,

I got the same problem:
I’ve create a AI Blueprint with its own animation BP.
My task is to get a hit animation of my ai when it’s hitten by a blade (working with animation notifys).
For this i have to cast to my Ai Blueprint, out of the animation BP and got the same problem. (missing object)

Appending to the solution above: in my case it isn’t the best way to do it like that right? Because it would cast to every AI on the map. I just need the AI of the actuall Animation BP, but how do i get it?

Many many thanks

Why not use an overlap event for when the AI is hit with the blade?