Skip to main content

SproutyDialogsCharacterData

Inherits: Resource

Description

This resource stores data for a character in the dialogue system.

It includes the character's key name or identifier, translations of the name, description, dialog box reference and portraits.

Properties

TypeNameDefault
Stringkey_name""
Dictionarydisplay_name{}
Stringdescription""
intdialog_box_uid-1
Stringdialog_box_path""
boolportrait_on_dialog_boxfalse
Stringdefault_portrait""
Dictionarymain_transform_settingsSee description
Dictionaryportraits{}
Dictionarytyping_sounds{}

Methods

Return TypeMethod
Variantget_portrait_from_path_name(path_name: String, group: Dictionary = {"data": portraits})

Property Descriptions

var key_name : String = ""

Character identifier. Corresponds to the file name of the character's resource.


var display_name : Dictionary = {}

Name of the character that will be displayed in the dialogue. The display name can be localized to different languages, so it is stored as a dictionary where each key is a locale code (e.g., "en", "fr") and its value is the name translated in that locale. Example:

{
"en": "Name in English",
"es": "Nombre en Español",
...
}

var description : String = ""

Character description. This does nothing, its only for your reference.


var dialog_box_uid : int = -1

Reference to the dialog box scene used by this character. This is the UID of a scene that contains a DialogBox node which will be used to display the character's dialogue.


var dialog_box_path : String = ""

Path to the dialog box scene to display the character's dialogue. This is for reference only, use dialog_box_uid to set the dialog box.


var portrait_on_dialog_box : bool = false

Flag to indicate if the character's portrait should be displayed on the dialog box. If true, the character's portrait scene will be shown in the portrait display node of the DialogBox. For this you need to set the portrait display node that will hold the portrait as a parent of the portrait scene.


var default_portrait : String = ""

Name of the default portrait to use for this character. If set, this portrait will be used when no specific portrait is specified in the dialogue.


var main_transform_settings : Dictionary

Transform settings for all the character portraits. This is a dictionary with the following keys:

  • scale: the scale of the portrait.
  • scale_lock_ratio: whether to lock the aspect ratio of the scale.
  • offset: the offset of the portrait.
  • rotation: the rotation of the portrait in degrees.
  • mirror: whether to mirror the portrait.

Default values:

{
"scale": Vector2.ONE,
"scale_lock_ratio": true,
"offset": Vector2.ZERO,
"rotation": 0.0,
"mirror": false
}

var portraits : Dictionary = {}

Character's portraits. This is a dictionary where each key is a portrait name or a group of portraits and its value is a dictionary containing the portrait data or more portraits.

The dictionary structure is as follows:

{
"portrait_name_1": {
"index" : 0,
"data": SproutyDialogsPortraitData (SubResource)
},
"portrait_group": {
"index" : 1,
"data": {
"portrait_name_2": {
"index" : 0,
"data": SproutyDialogsPortraitData (SubResource)
},
...
},
...
},
...
}

var typing_sounds : Dictionary = {}

Typing sounds for the character. This is a dictionary where each key is the sound name (e.g., "typing_1") and its value is a dictionary containing the sound data.

The dictionary structure is as follows:

{
"sound_1": {
"path": "res://path/to/typing_1.wav",
"volume": 0.5,
"pitch": 1.0
},
"sound_2": {
"path": "res://path/to/typing_2.wav",
"volume": 0.5,
"pitch": 1.0
},
...
}

(Not used yet, typing sounds implementation is pending)!


Method Descriptions

func get_portrait_from_path_name(path_name: String, group: Dictionary = {"data": portraits}) -> Variant

Returns the portrait data for a given portrait path name. The path name can be a portrait name or a path (e.g., "group/portrait"). If the portrait is a group, it will recursively search for the portrait data.