AC Dialogue Base
Function List

AC_Dialogue_Base Functions
These are the different function events that are set in the Actor Component "AC_Dialogue_Base." the functions shown here are some of the main pieces of code that goes into making the dialogue system for the game, and is a Parent Component of what all of the code looks to for big changes and when communicating with each other.
Function "OpenConvo"
This screenshot shows the "OpenConvo" function in the AC_Dialogue_Base and is what the game calls to when the player first interacts with an NPC. when the code is called to, it creates a widget, using the widget "W_Dialogue" which is what the game uses as a base to put character text and dialogue options for the player to choose, displaying it onto the screen/viewport.
Function "CloseConvo"
This part of the Dialogue base is very simple, just clearing all previous instance of the dialogue from the players view and removing it from their screen
Function "Dialogue"
This function is left empty so that it is left free for the Child Actors of the code to use (Each different NPC) so that all of their dialogue is unique to them and nobody recites the same thing to the player every time.
Function "ClearDialogueProgress"
This deletes all of the data going into talking to an NPC so that after the dialogue is ended, once the player re-interacts with the NPC the dialogue is reset to the beginning. This can be turned off or set so that the NPC says any number of things after a dialogue has concluded.
Function "RemoveDialogueProgress"
This is similar to the ClearDialogueProgress code although instead of resetting the Dialogue code, it can make it so that after the dialogue has ended, after re-interacting with the NPC we can set the Dialogue to a previous said message.
Function "SetDialogueTreeIndex"
The code presented here sets up the Dialogue Tree Index for later when Dialogue branch choices can be made for the player to choose.
Function "AddDialogue"
Function Add Dialogue finds the dialogue from the Child Actor, finds the name of the NPC along with its dialogue and displays that to the Widget once the NPC is interacted with and orders all of the different dialogue nodes in the correct order. this also finds and orders the optional dialogue player choices.
Function "UpdateSelectedOption"
Another very simple part of code, The "UpdateSelectedOption" function, once a dialogue choice has been made by the player it proceeds to the next section of the dialogue in the list.
Function "ProgressDialogue"
Again being another small section of the code, this part just progresses the dialogue by a set number in the list of dialogue sections (in this instance it only proceeds by 1 every section)
AC Dialogue Child
Function & Interface List
AC_Dialogue_Child Functions
the function "Dialogue" is linked to the Parent Actor "AC_Dialogue_Base" in order to communicate to the "NPC_Child" when adding new dialogue. The rest of the Interfaces are communicating with the Dialogue's BPI "BPI_Interactable" in order for the individual interfaces to be able to also communicate to the NPC_Child.
This connects to the AC Dialogue Base for the Dialogue aspect, it connects to the NPC Child Actor in order to handle all of the physical intractability that is not handled by the Dialogue code or widgets.
Function "Dialogue"
This replaces the empty Dialogue section from the Parent Actor "AC_Dialogue_Base" and is handled here and not in the Parent Actor so that all of the individual Child Actors/NPCs have individual Dialogues and Choices.
This hijacks' the Parent Actor Dialogue function and replaces it with Speaker name information along with its Dialogue and Options, Shown in the "Add Dialogue" and "Make Array" segments, in this instant the Speaker name being "ChildTest" exclaiming "This is a test" with a Yes/No option.
BPI_Interactable
BPI Functions
This just shows the different named functions that get called when interacting with the BPI Interactable.
Enum_DialogueState
Enum_Dialogue Options
The different Enumerators here interact with the different Functions, linking them to the Enum_DialogueState to communicate through Actors.
NPC_Base
Function "SetInteractableState"
This function should be remembered from the BPI_Interactable and sets the events of "SetInteractableState" into play which means that once the player has come into an appropriate radius to the NPC, It sets their name to visible above them so that the player knows who they are talking to prior to the interaction
NPC Name Set
Here is where we set the basic npcs placeholder name to be, allowing to to be changed within its child actor so that everybody's displayed names are different
NPC_Base Viewport
This is just an example of what an NPC would look like prior to being skinned with its unique texture
NPC_Child
Function "Interact"
The function presented here shows the NPC Base Actor code contacting with the Interactable BPI so that the code with the playable character, once it enters radius of the NPC that it is able to interact with the NPC in order to open the Dialogue set up in the AC Dialogue Child.
NPC_Child Construction Script
this just connects the NPC Base and NPC Child in order for the child to be able to have a unique name set in place where the name placeholder is already set, replacing the text already there with a name
IMC_Default
IMC Button Map
The IMC is where I set up the button mapping for the Dialogue Interaction to be set for the player to push. the IMC is also set to interact with the IA_Interaction as the IA_Interact is connected to the playable character.
IA_Interaction
IA_Interaction
This is set up so that the IMC can communicate through this to the rest of the code that goes into making the Dialogue System.
W_DialogueOption
DialogueOption Viewport
this shows the dialogue option button, this will have text overlaying it to show the player what option is what and gives them a choice to select any option displayed to the player Viewport
DialogueOption Code Part 1
- Event Construct
This just sets the Dialogue Option text that is set in the NPC Child code and allows it to be seen by the player
- On Hovered
This part sets the button so that it changes colour after the player hovers over the button with their mouse icon, just making it so that it is clear to the player which button is being hovered over to reduce confusion or the chance of clicking the wrong option accidentally.
DialogueOption Code Part 2
-On Unhovered
Once the player drags their mouse away from the dialogue option button the original colour of the button is set, showing to the player that that button is no longer clickable unless they bring their mouse back
-On Released
Once the button is pushed, it looks to the UpdateSelectedOption Function in the AC Dialogue Base, to forward the dialogue and progress the game.
W_Dialogue
Dialogue Viewport
This shows the placeholder that will be filled in and shown to the player once they interact with the NPC. this will show the name of the NPC they are interacting with along with what they are saying along with the dialogue options that the player can decide on to branch the game to different endings. the name and text are set in the NPC Child code.
Function UpdateDialogueText
This code makes the widget clear back to the placeholder text and removes what was set from the NPC Child code, preparing it to be replaced by the next dialogue and dialogue options in the dialogue list, again progressing the dialogue. this happens because without this code then the next text in the dialogue list would just overlay the old text and make it unreadable for the player.
Reflection
When doing this in the future I probably could have made the code much more simple to save time to do more for the game instead of making an entire system for the dialogue and player options to be set.
Overall I feel the code works well and as intended though so I am happy with the work put into this.