Game Characters (1st, 3rd, enemy)

icon picker
Simple Dialogue System



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
image.png
Drag it in the scene

Create a BP Interface, called BPI_Dialogue
rename the function as Talk
image.png

Back to BP_NPC, Class Setting
Add BPI dialogue in interface
image.png

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
image.png

go to NPC event graph
implement event on talk interface
image.png
Add 2 array variables (GET node typed Get a copy)
image.png
Set talk index value as -1
image.png
Add Dialogue content in Dialogue variable:
image.png

To make ready to interact more after dialog has finished, make sure talk index won’t exceed dialogue:
change node <= to only <
image.png
image.png

Add UI to display the dialogue:


Create widget called WB_Dialogue
image.png
Name Text layer as TalkText (for later type in event graph), tick is variable
image.png

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
image.png
To remove the widget after the dialogue finishes, add follow in false branch
image.png
add sound at the end of setText
image.png

Add image layer in widget
image.png

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.