Problem with Gate overlapping event not triggering

Im trying to make my character talk to an NPC when overlapping its collision box while pressing C on the keyboard. I use a Gate to open and close the option to talk to the npc so you’ll only be able to speak when close enough. I used Print to see if the gate opens and closes, and it does. Then when I press the key, nothing happens.

1 Like

Is this code in the NPC?

yes, its in the npc blueprint.

You’re NPC won’t get the keyboard input, even with Enable Input - you should put the handling of that in your BP_Hero - look into sending Events.

You can’t send input to an NPC, I don’t think.

I might be wrong, I noticed this post

If that doesn’t work, I think you’ll need to do the checks inside your player.

I used the same setup to pick up loot, so I don’t understand what’s the difference, since with the loot it works. I enter the collision box, press a key, and pick up the item. here though, its the same setup but it wont do anything.

Because the NPC is a character, it has to be possessed to enable input.

I changed it to my player character and now the gate works, but in the tutorial I’m watching they say I need to create a reference to the widget of the dialogue and it gives me an error for some reason.

Try making those right hand nodes ( the ones with errors ) again, by dragging from the ‘create widget’ node.

For this sort of interaction, you need something that’s kind of half way between what you’re used to ( with the overlap interaction ), and something new, where you call an event on the object.

So, when you press C, you player can find what objects are overlapping itself and call the ‘interact’ event on them.

To find what’s overlapping with your player, you can use

image

and the easiest way to call an event on them is with an interface.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.