Skip to content

How to Use

Tony edited this page Oct 1, 2023 · 2 revisions

Currently, it is recommended to start with the latest version of the project file. You can then move your game project into it, if it exists.

GDDialog

GDDialog is a relatively advanced dialog tree plugin, featuring straightforward tools for creating variables and assembling dialog trees with GraphNodes.

Database Management

A dialog tree database contains a Dictionary of records (each record has a unique ID), and each record contains a Dictionary of nodes (each node has a unique ID). Nodes will be explained in more detail in a later section, but record management is done in the Dialog Records editor, located in the bottom bar of Godot's UI.

The File menu allows you to load and save database project files before eventually "baking" the final result. When working on your database, you just save the file, but baking the database saves only the essential information that your game will need.

The Records menu will create records, select them, and delete any visible (and selected) records.

The View menu allows you to open a variety of managers.

  • You can manage search tags with the Tag manager. These tags are optional and can be assigned/unassigned to your records using the tooltip-described icon buttons in said manager.
  • You can manage a variety of variables and the values associated with them. These values include flags (boolean values), floats, strings, string arrays, colors, and speaker colors. Some of these variables can be renamed, while other variables must be recreated.

The center pane is populated with records whenever you select Records > New Record. From left to right, you can manage your records by

  • Selecting/Unselecting them with the checkbox. Selecting a record allows you to delete it or manage its search tags.
  • Give the record a unique name. This name makes it easier to reference than by its unique ID.
  • View the search tags that were applied to the record. Depending on your search filters, these tags will show or hide the record in your view.
  • Add a brief description. This is optional and is generally to make it easier to remember what that record is for.
  • Finally, you can press the Edit button to edit a record.

The bottom row contains search fields, including searching by Name, ID, and Description. You can also enable tag filtering and use the tag button in the bottom right to choose which tags to filter.

Dialog Management

Each record (which has an ID and, if specified, a name) contains a Dictionary of nodes. These nodes are used to specify information that your in-game dialog UI uses to change layouts, present text, modify assets, run custom scripting, and locate the next node in the dialog tree.

There are eight unique types of dialog nodes in the dialog editor that appears when you edit a record: Start, Simple (type known as "Line"), Advanced, If, Set, Set GUI, Run Script, and End.

All nodes contain the following properties:

  • type: One of the eight unique types, String value. Retrieved with get_node_type( record_id, node_id )
  • links: each dialog node has slots on the right side that connect to the left slot of the next node. this property contains a list of its connections to destination nodes. Array. Retrieved with get_node_slots( record_id, node_id ) and get_node_link( record_id, node_id, slot )

Each node may have unique properties:

  • Line node:
    • text - A String of text. Retrieved with get_text( record_id, node_id )
    • speaker - This is intended to store the name (String) of the character who is speaking. Retrieved with get_speaker( record_id, node_id )
  • Advanced node:
    • speaker - The advanced node is is an advanced version of the line node, so this just gets the speaker, too.
    • keyframes - Instead of simple text, the advanced node breaks text into parts, with each part having its own properties. An advanced dialog node contains an Array of keyframes. This Array is retrieved with get_keyframes( record_id, node_id ). More information about keyframes will appear later on.
    • responses - If you specify that an advanced node has responses, the advanced node will gain this property. You will need to manually adjust the number of slots that the dialog node has to match said responses. Array, retrieved with get_responses( record_id, node_id ).
  • If node:
    • if_name: The name of the variable being compared to certain values. This variable can be any one of four types. The name is retrieved with get_ifset_variable_name( record_id, node_id ).
    • if_value_type: The type of variable that this is. Can be Flag, Float, String, and String Array. This type is retrieved as an Array of comparisons with get_ifset_value_type( record_id, node_id )
    • if_conditions: If your variable is a float, you can compare your variable using Equal To, Less Than, or Greater Than. This is stored as a String and retrieved with get_if_conditions( record_id, node_id ).
    • if_values: This array contains the values that your variable gets compared to. The node will automatically set slots depending on the number of values you are comparing (or defaults to 2 representing a match or mismatch if using Flag or String Array). This Array is retrieved with get_ifset_values( record_id, node_id ).
  • Set node:
    • set_name: The name of the variable being overwritten. The name is retrieved with get_ifset_variable_name( record_id, node_id ).
    • set_value_type: The type of variable that this is. Can be Flag, Float, String, and String Array. This type is retrieved as an Array of comparisons with get_ifset_value_type( record_id, node_id )
    • set_value: This is the new value the variable will get. This value is retrieved with get_ifset_values( record_id, node_id ).
  • Set GUI node:
    • gui_type: A String that you arbitrarily use to make changes to your dialog UI's layout. Retrieved with get_gui_type( record_id, node_id ).
  • Run Script node:
    • script_filepath: A string containing the res:// filepath to a .gd file. Retrieved with get_script_path( record_id, node_id ).
    • script_funcref: A string with the name of the function you intend to call. This name is a holdover from the Godot 3.5 version of the dialog plugin. Called with get_funcref_name( record_id, node_id ).

Variables

Variables are retrieved and set with these functions:

  • get_color( variable_name ) and get_speaker_color( variable_name ) will retrieve a color from your Colors and Speakers lists, respectively. You only need to pass the name of the color or speaker.
  • get_X_value( variable_name ) and set_X_value( variable_name, new_value ) will retrieve and override X variable, where X can be flag, float, and string. The type of the new value must match the function and variable.
  • get_string_array( variable_name ) and set_string_array( variable_name ). Like the above, but for string arrays.

Keyframes

Calling get_keyframes( record_id, node_id ) will retrieve an array of "keyframes." You can use the advanced dialog editor to split your dialog text into parts, each with their own speed, timing, color, audio, and other properties. Each property can be retrieved by using the get_keyframe_property( record_id, node_id, keyframe_id ) function. Each keyframe has the following properties:

  • text_type: You can control how your dialog UI handles its text by assigning this value.
  • text: This is the portion of text for this keyframe.
  • using_text_color: A boolean value specifying that we are not using your dialog UI's default color.
  • text_color: Is either set to "Custom" or is the name of a created color variable.
  • text_color_custom: A unique color for that particular keyframe.
  • timer_delay: How long to wait (in seconds) until we start writing text.
  • write_speed: A scaling value for time waited between characters typed. 1 is normal speed, 2 is double speed, 0.5 is half-speed, etc.
  • ignore_player_speed_delay and ignore_player_speed_write: These boolean values ask the UI not to factor in the player's configured text speed when applying a delay or faster/slower writing speed. But only for that keyframe.
  • animations: An array of Dictionaries specifying what profile plays what animation.
    • id: An integer number. If you have five portraits, for example, you could give each one an ID, 0 through 4, to indicate which is being modified.
    • animation: A string for the name of the animation to play.
  • sound_effect: Contains a String res:// path to a sound effect to play one time.
  • sound_typewriter: A String res:// path to the sound effect played whenever a character is typed.
  • music: Changing the song being played, currently.
  • music_transition: A String containing some possible values, like Cut, Simple Fade, and Crossfade
  • custom_data: An array of Strings and floats that you specify for that specific keyframe.
  • variable_data: An array of names of variables created in the Managers. These can be flags, floats, and strings.
Clone this wiki locally