Make talk target:
Create a BP Character, name as BP_NPC (NPC: Non Player Character)
Add Sphere collision, name as Trigger zone, increase radius to 600
Set collision as Overlap all dynamic
Drag it in the scene
Create a BP Interface, called BPI_Dialogue
rename the function as Talk
Back to BP_NPC, Class Setting
Add BPI dialogue in interface
Make talk function:
Go to 3rd person BP, event graph
Set a command that detect surround character
And add talk function at 3rd person graph
go to NPC event graph
implement event on talk interface
Add 2 array variables (GET node typed Get a copy)
Set talk index value as -1
Add Dialogue content in Dialogue variable:
To make ready to interact more after dialog has finished, make sure talk index won’t exceed dialogue:
change node <= to only <
Add UI to display the dialogue:
Create widget called WB_Dialogue
Name Text layer as TalkText (for later type in event graph), tick is variable
Back to NPC graph, disconnect print string input, and extend by follow:
GET node created from validate UI variable, it’s made after promote to variable (name as UI) after create widget
To remove the widget after the dialogue finishes, add follow in false branch
add sound at the end of setText
Add image layer in widget