Casting to Actor Object

I’m having trouble getting this cast right. I have a boolean variable within the base npc blueprint that determines if the npc is in dialogue with the player. It is turned true when the player is within a collision box and presses the interaction key. The problem I’m having is that I am not sure what object to use from the cast to base npc node. Any direction would be appreciated.

There are several ways to handle this. You need to get the correct reference to cast with.

I’ll describe two ways…

  1. When the players enters the collision box, you can cast to the player using the “other actor” pin, and set a variable inside the player to that NPC. Then, you can use that variable to cast and begin the dialogue.
  2. Get rid of the collision box method and use line traces. Make it so when the players faces an NPC and hits the “E” key, a line trace is performed in the forward direction, and you can then get the NPC reference and use that to cast. Like this:

131633-cast.png