EXPWorlds / Godot-Dialog-System

A Dialog System Addon for the Godot Engine.
MIT License
124 stars 8 forks source link

EXP Godot Dialog System v.1.2.0

By David Lipps aka Dave the Dev at EXPWorlds for Godot 3.2 Stable


Example Palettle Editor Image Example Palettle Editor Image

This is an addon which assists in the generation, organization, storage, and access of large amounts of text data for Godot Engine projects. It consists of a Story Editor to create and manage lists of dialog records via tags and search filters. And a Dialog Editor through which text/dialog data is created and edited via graph nodes. Although primary designed to handle game dialog, the editors can be used to manage text data for any purpose. Text data can be saved to resource files and read in your game code via the provided helper class.

Donate If this project helped you out, consider sending some coffee my way so I can stay locked in "the zone" and bring the Godot community more cool free stuff.


Documentation:

Using the Story File Reader Helper Class:

Once you've written all your text, and baked a story file, you can use the Story Reader Helper Class to access the text and node connection data from the file in your projects. Here is an example of how to use the story reader and the class documentation...

var Story_Reader_Class = load("res://addons/EXP-System-Dialog/Reference_StoryReader/EXP_StoryReader.gd")
var Story_Reader = Story_Reader_Class.new()

var story = load("baked-story.tres")
Story_Reader.read(story)

var did : int = 1
var nid : int = 1
var text : String = Story_Reader.get_text(did, nid)
print(text)
func get_dids() -> Array:

Returns a list (int) of all the DIDs in the Story

func get_did_via_record_name(name : String) -> int:

Returns the DID associated with a user defined name.

func get_nid_from_slot(did : int, nid : int, slot : int) -> int:

Returns the NID of the node the specified slot is connected to.

func get_nid_via_exact_text(did : int, query : String) -> int:

Returns the NID of first node with a text that exactly matches the provided query. Useful for finding the start, finish or any other tagged point in a dialog. Returns -1 if an exact match is not found in any node.

func get_nids(did : int) -> Array:

Returns a list (int) of all the NIDs associated with the specified DID.

func get_slot_count(did : int, nid : int) -> int:

Slots that are not used in the Dialog Editor get culled in the baking process, therefore, this function returns the count of the slots actually connected to other nodes.

func get_slots(did : int, nid : int) -> Array:

Returns a list (int) of all the Slots associated with the specified NID.

func get_text(did : int, nid : int) -> String:

Returns the text associated with the specified node.

func has_did(did : int) -> bool:
func has_nid(did : int, nid : int) -> bool:
func has_record_name(name : String) -> bool:
func has_slot(did: int, nid : int, slot : int) -> bool:
func read(story : Resource):

Sets the story resource read by the Story Reader object. Story Readers can only use baked stories. Reading a second baked story will simply replace the first one. Your project is responsible for loading story files into memory.


Change Log

2020-04-24:

I can be reached at: davidlipps.dev@gmail.com I'd love to hear your thoughts. Especially about how I can improve. I'll do my best to get back to you.