Skip to content

Writing conversations ​

A conversation is a named list of lines. It plays by name, the way an AnimationPlayer plays an animation by name.

Where they live ​

Open the TalkKit main screen and go to Conversations. + adds a conversation; double-click its name, or use ⋮ → Rename…, to rename it. The same menu duplicates, deletes, or saves it to a shared library.

Conversations typed here are stored in the scene, so there are zero files. Saving one as a .tres is a later choice, not a starting requirement.

The Conversations tab: the conversation list, Haru and Ren speaking in one conversation, the lines, and the real box previewing the selected line

Writing lines ​

Type in a row and press Enter to move to the next one; Enter on the last line adds another, and so does + Continue writing. Shift+Enter starts a new line inside the same row.

  • The letter beside a row is who speaks it. Click it to pick someone else.
  • The drag handle, or Alt+↑/↓, reorders lines.
  • Tick several rows to change their speaker, box or placement together, or to duplicate or delete them.

The Defaults row above the lines says once who speaks, in which box, and where the box sits. A line only changes what is different about it.

Seeing it ​

The right pane draws the selected line with the real runtime box, and follows what you type. ▶ Play plays the conversation from the selected line, with the typewriter, transitions and voice; ■ Stop or ↓ Next holds it still again. At medium widths the pane becomes a drawer so the lines keep their room.

Names and other values in a line ​

Write in a line, such as Hello ., and the value is filled in when the line plays. It can come from two places, later wins:

  1. Default Params on the node, under Advanced Runtime in the Inspector, for values that never change.
  2. The game, when it starts the conversation, for values only it knows. See From a script.

Three rules worth knowing:

  • A key with no value stays visible. shows as written and logs a warning, rather than silently emptying. A mistake you can see beats one you cannot.
  • One pass, no recursion. A value containing is not expanded again. This is not a template language.
  • The written line is never modified. The value is filled into a copy, because the line may be shared with other NPCs.

TalkKit never reads game state. It shows what it is given.

Translating lines ​

Lines go through Godot's own translation system. The line as you wrote it is the key: add a translation (CSV or PO, in Project Settings → Localization) whose key is Hello . and whose Vietnamese text is Xin chào ., and the player sees the Vietnamese line with the name filled in. Placeholders are filled after translating, so keep them in the translated text.

A line with no translation plays as written.

Per-line options ​

Most lines need nothing but text. Select one that is the exception and use the pane on the right. Add override… shows every option; the ones in use stay visible, each with its own Reset.

Line 2 selected: the preview shows Ren's speech bubble, and the options below it set the speaker and the dialogue box for that line

GroupOptionFor
IdentitySpeakerInherit the conversation's speaker, None · narrator, or someone else for this line, name, face and voice together
Display name overridea different name only, such as "???" before a reveal. Face and voice stay the speaker's
Visual variantone of the speaker's named faces, such as angry
PresentationDialogue Boxthis line in a different box
Placementthis line somewhere else, such as a bubble over whoever interrupts
Typing speedone slower, dramatic line; 0 uses the box's speed
AudioVoice clipa recorded voice line, played as the line starts
EventEvent id, Event payloadtelling the game something, see events
Blockingpausing until the game answers, see branching
AdvancedStable line ida fixed id for your own code or localisation keys

From a script ​

The game starts a conversation by name. play() also takes the values for :

gd
extends Node

## Docs: /guide/conversations — {{placeholders}} filled at playback.

func _ready() -> void:
	_build()


#region play
# {{player_name}} is replaced when the line is shown. TalkKit never reads game
# state: it renders what you hand it.
func greet(player_name: String) -> void:
	$NPCTalkKit.play(&"greeting", {"player_name": player_name})
#endregion


#region unknown
# A key with no value is left written as-is and warned about, rather than
# silently emptied — an authoring mistake you can see beats one you cannot.
func greet_without_a_name() -> void:
	$NPCTalkKit.play(&"greeting")  # renders: Welcome back, {{player_name}}.
#endregion


func _build() -> void:
	var box := _instant_box()
	var talk := NPCTalkKit.new()
	talk.name = "NPCTalkKit"
	talk.dialogue_boxes = [box]
	var line := TalkLine.new()
	line.text = "Welcome back, {{player_name}}."
	var conversation := TalkConversation.new()
	conversation.conversation_id = &"greeting"
	conversation.default_dialogue_box = box
	conversation.lines = [line]
	talk.conversations = [conversation]
	add_child(talk)


func _verify() -> Array[String]:
	var failures: Array[String] = []
	var talk: NPCTalkKit = $NPCTalkKit
	var spoken: Array[String] = []
	talk.line_started.connect(func(line: TalkLine) -> void: spoken.append(line.text))

	greet("Alex")
	if spoken.is_empty() or spoken[0] != "Welcome back, Alex.":
		failures.append("parameters: substitution failed, got %s" % str(spoken))
	talk.stop()

	spoken.clear()
	greet_without_a_name()
	if spoken.is_empty() or not spoken[0].contains("{{player_name}}"):
		failures.append("parameters: an unknown key must stay visible, got %s" % str(spoken))
	talk.stop()

	# The source line must never be mutated: it may be shared by other NPCs.
	if talk.conversations[0].lines[0].text != "Welcome back, {{player_name}}.":
		failures.append("parameters: the authored line was mutated by substitution")
	return failures


## Typing speed lives on the dialogue box now, so turning it off for a scripted
## run means handing the node a box that types instantly.
func _instant_box() -> TalkBoxTemplate:
	var template := TalkBoxTemplate.new()
	template.typewriter_speed = 0.0
	return template

A key the dictionary does not have stays visible:

gd
extends Node

## Docs: /guide/conversations — {{placeholders}} filled at playback.

func _ready() -> void:
	_build()


#region play
# {{player_name}} is replaced when the line is shown. TalkKit never reads game
# state: it renders what you hand it.
func greet(player_name: String) -> void:
	$NPCTalkKit.play(&"greeting", {"player_name": player_name})
#endregion


#region unknown
# A key with no value is left written as-is and warned about, rather than
# silently emptied — an authoring mistake you can see beats one you cannot.
func greet_without_a_name() -> void:
	$NPCTalkKit.play(&"greeting")  # renders: Welcome back, {{player_name}}.
#endregion


func _build() -> void:
	var box := _instant_box()
	var talk := NPCTalkKit.new()
	talk.name = "NPCTalkKit"
	talk.dialogue_boxes = [box]
	var line := TalkLine.new()
	line.text = "Welcome back, {{player_name}}."
	var conversation := TalkConversation.new()
	conversation.conversation_id = &"greeting"
	conversation.default_dialogue_box = box
	conversation.lines = [line]
	talk.conversations = [conversation]
	add_child(talk)


func _verify() -> Array[String]:
	var failures: Array[String] = []
	var talk: NPCTalkKit = $NPCTalkKit
	var spoken: Array[String] = []
	talk.line_started.connect(func(line: TalkLine) -> void: spoken.append(line.text))

	greet("Alex")
	if spoken.is_empty() or spoken[0] != "Welcome back, Alex.":
		failures.append("parameters: substitution failed, got %s" % str(spoken))
	talk.stop()

	spoken.clear()
	greet_without_a_name()
	if spoken.is_empty() or not spoken[0].contains("{{player_name}}"):
		failures.append("parameters: an unknown key must stay visible, got %s" % str(spoken))
	talk.stop()

	# The source line must never be mutated: it may be shared by other NPCs.
	if talk.conversations[0].lines[0].text != "Welcome back, {{player_name}}.":
		failures.append("parameters: the authored line was mutated by substitution")
	return failures


## Typing speed lives on the dialogue box now, so turning it off for a scripted
## run means handing the node a box that types instantly.
func _instant_box() -> TalkBoxTemplate:
	var template := TalkBoxTemplate.new()
	template.typewriter_speed = 0.0
	return template

For a throwaway line, such as a tutorial hint or a bark, skip writing it in the editor and use say():

gdscript
$NPCTalkKit.say("The gate is barred.")
$NPCTalkKit.say(["One.", "Two."], {"name": "Darwin"})

The conversation is built on the spot and thrown away; nothing is added to the node.

GDScript-first. No telemetry, no network requests, no AI service dependency in the shipped addon.