MainUI_Dialogue - Hawthorn-Games/ProjectScrapped GitHub Wiki

The Dialogue widget handles most of the dialogue functionality. NPC's engage the widget but their code parses through the necessary variable values/parameters on to the Widget blueprint to display them. Dialogue System Flow.png

Variables

Type Name Description
Image(Widget) Image_Placeholder Reference to image in the widget
Text(Widget) Name_Text Text Box Reference in the Widget
Button(Widget) NextButton Reference to button in the Widget
Text(Widget) ReferenceTextBlock Reference to Dialogue text box in the widget
Text TextReferencer The current line of dialogue from the dialogue array
Text CurrentChar The reference to the current/seperate character from TextReferencer while being written out
Text BuiltText The text thats being written out to the text box in the widget
int ImageInt Index for image to be displayed by widget from DialogueImage_Array
Text[] ArrayOfText Reference to the Dialogue array that is being passed through by NPC to be written out
int TextArrayInt Index to output dialogue sequentially from ArrayOfText
String[] CharacterIDArray List of characters to be ignored by blueprint when writing out dialogue
Text NPCNameText_Ref Reference to the NPC name - assigned by NPC
Text PlayerNameText_Ref Reference to the player characters name
Texture2D[] NPC_Texture_Ref Array of profile images passed by NPC to be displayed
int ExpressionNo Index as to which image to be displayed by widget from Texture_Ref
Texture2D[] Player_Texture_Ref Array of profile pictures assigned to the player character (Default assigned)
bool Skippable bool to check whether dialogue can be skipped
bool WriteComplete bool to check if current dialogue has finished writing
bool Skip Flow control for skip dialogue functionality
AnimationSequence[] Animations Reference to a array of animations to be played by NPC during specific dialogue. Reference by NPC
AnimationSequence DefaultAnimation Default animation reference - is applied to NPC after dialogue sequence is complete

Functions

WriteText()

Applies seperated characters from TextReferencer and appends them to BuiltText each delayed loop to be written out in the widget.

TextSwitcher()

Set TextReferencer to the next text value of the array (ArrayOfText) to be written out. If the array is complete then dialogue begins complete sequence.

ImageOrder_Index()

Switching between NPC and player profile images based on last text value of current Dialogue line. 0 = NPC 1 = Player

ExpressionSwitcher()

Based on the second last text value (letter/number), apply the corresponding image profile as parsed in by NPC into NPC_Texture_Ref. Max amount of images can be 9.

WriteText_Skip()

Same functionality as WriteText but is called seperately whenever Dialogue is skipped while being written out. The function writes out the whole TextReferencer without doing typewriter effect.

CallCooldown()

Calls all NPC's in the scene and calls a interaction cooldown after the dialogue has complete.

EnableTab()

Calls all NPC to enable TAB back once dialogue has finished.

Custom Events

CinematicSkip()

Skipping dialogue during cinematic sequence.

SkipDialouge()

Custom Event that enables to skip dialogue at any time (for external reference).

Initiate()

Begins the typewriter effect sequence. Loops through TextReferencer and calls WriteText() with delay.

EngageDialogue()

Called at the start of each dialogue line. Applies all visual cues such as animations to the NPCs and image profiles to the Widget depending on ImageInt.