Originally posted by sarlewis
View Post
This system would involve Linetraces on Tick, and a basic understanding of what class inheritance is. The simplest would be for your NPCs to inherit from one parent NPC class, and when you do a Linetrace, you check if it casts to an NPC. The more correct approach would be to have a Blueprint Interface, because talking is just a particular case of "using", like opening a book, or looking inside a chest, but this is a more "advanced" way.
Anyway, to do a Linetrace, you'll need some basic understanding of how to set up Collision Channels.
If you don't have a crosshair in your game, but simply want to talk to the closest NPC to your character, you'd need to place a collision sphere around your character, and then detect when an NPC enters your sphere. This also involves collision channels.
If you have a mouse based control scheme, then it's all much easier, and a working example can be found in the demo project linked on the marketplace page.
I'm not trying to be evasive about answering your question, but game logic in a broad sense is just not part of the dialogue system. Your particular problem requires an interaction system. Incidentally, there are some interaction systems on the marketplace, so I'd recommend looking into them, or getting on Udemy and watching a couple of tutorials on the subjects I've mentioned to get a better grasp on the engine.
Let me know if you have any questions.
Comment