How to cast to NPC?

Hi,

I am trying to get an NPC to become agressive when the player gives a specific answer. When the player is in range of the npc (overlaps with a box w/o collision) he can press a button to open a widget. This widget has several buttons that can be clicked, and one of them is supposed to cause the NPC to become agressive.

Here is how i tried to cast to the NPC:

Here you can see how i tried to do the same cast not from the widget, but the player character blueprint. It also fails every time.

As you can see, the cast failed bit is always the route that is taken.

And here you can see that it does the same when the button is clicked:

Here you can see my NPC is the content browser (hope it helps to figure out what’s going on)

I can cast to the player character (from the button clicked in the widget and the button pressed as a player) just fine (tried to disable movement and it worked). For some reason I just can’t cast to my NPC.

I tried setting different nodes as objects to the cast but nothing i tried has worked.

You are basically asking the game if “player pawn” is from the BranchChatNPC class, and its not, thats why the cast failed. So you need to input the NPC actor you wanna cast to, not the player pawn I think.

Training Video recommandation for the Basics. It includes Casting and many other thing. It will be worth your time trust me :stuck_out_tongue_winking_eye: