Difference between revisions of "Modding:Dialogue"
(Created page with "← Index This page explains how the game stores and obtains dialogue. This is an advanced guide for mod developers ==Source== The various dialogue options...") |
Pathoschild (talk | contribs) (standardise, reorganise, copyedit) |
||
Line 1: | Line 1: | ||
← [[Modding:Index|Index]] | ← [[Modding:Index|Index]] | ||
− | This page explains how the game stores and | + | This page explains how the game stores dialogue text, its format, and how the game parses it. This is an advanced guide for mod developers. |
− | == | + | ==Data== |
− | The | + | The dialogue text is stored in three sets of files. |
− | |||
− | |||
− | |||
− | + | ===Character-specific dialogue=== | |
− | + | <tt>Characters\Dialogue\*.xnb</tt> contains most of the dialogue for each character (one file per character). The format in this file is: | |
− | = | ||
− | |||
<source lang="yaml"> | <source lang="yaml"> | ||
− | < | + | "<preface>[heart level]_[date]_[year][suffix]": "String" |
</source> | </source> | ||
− | + | ...where: | |
+ | * {{t|preface}} is an arbitrary key which identifies what it's for (like _Introduction_, _Event_, _Season_, etc). | ||
+ | * {{o|heart level}} is the ''minimum'' heart level the player must have reached with the NPC for this dialogue to appear. | ||
+ | * {{o|date}} is the numeric day of the month (like _28_), or the three-character weekday (like _Mon_). | ||
+ | * {{o|year}} is _1_ for year one, or _2_ for any year after that. | ||
+ | * {{o|suffix}} is any string further identifying the dialogue (like <tt>_inlaw_Abigail</tt> for Pierre and Caroline, for dialogue that only appears when you're married to Abigail). | ||
+ | |||
+ | If multiple dialogues are eligible, the game prioritises by the following: | ||
+ | # marriage status; | ||
+ | # preface; | ||
+ | # suffix; | ||
+ | # in-law status; | ||
+ | # day of month; | ||
+ | # year; | ||
+ | # heart level; | ||
+ | # day of week. | ||
+ | |||
+ | ===Strings from CS files=== | ||
+ | <tt>Data\Strings\StringsFromCSFiles.xnb</tt> contains many translation strings, including NPC dialogue defined in the code. That includes every bit of dialogue that's shared between multiple characters, and dialogue for some hardcoded events like marriage. The format in this file is: | ||
− | |||
− | |||
<source lang="yaml"> | <source lang="yaml"> | ||
− | < | + | "<key>": "dialogue string" |
</source> | </source> | ||
− | + | The key is generated based on the file that contained it before translations were added (in the form {{t|file name}}.{{t|int id}}), but doesn't have any particular meaning now. | |
− | + | ||
− | * | + | ===Event files=== |
− | + | <tt>Data\Events\*.xnb</tt> contains event scripts, including any dialogue in the event (see [[Modding:Event data]]). | |
− | + | ||
− | + | ==Algorithm== | |
+ | The game finds as follows: | ||
− | + | # Event dialogue is read from the appropriate event commands (see [[Modding:Event data]]). | |
− | + | # Location-specific dialogue is read from <tt>StringsFromCSFiles {{t|location}}.cs</tt>. | |
+ | # Else character dialogue is read from the character-specific files. | ||
+ | # If no dialogues were found, the game resorts to hardcoded dialogue from the <tt>StringsFromCSFiles</tt> files (specifically keys prefixed with <tt>NPC.cs</tt> NPC.cs). | ||
− | + | [[Category:Modding]] | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 15:34, 4 May 2017
← Index
This page explains how the game stores dialogue text, its format, and how the game parses it. This is an advanced guide for mod developers.
Data
The dialogue text is stored in three sets of files.
Character-specific dialogue
Characters\Dialogue\*.xnb contains most of the dialogue for each character (one file per character). The format in this file is:
"<preface>[heart level]_[date]_[year][suffix]": "String"
...where:
<preface>
is an arbitrary key which identifies what it's for (like _Introduction_, _Event_, _Season_, etc).[heart level]
is the minimum heart level the player must have reached with the NPC for this dialogue to appear.[date]
is the numeric day of the month (like _28_), or the three-character weekday (like _Mon_).[year]
is _1_ for year one, or _2_ for any year after that.[suffix]
is any string further identifying the dialogue (like _inlaw_Abigail for Pierre and Caroline, for dialogue that only appears when you're married to Abigail).
If multiple dialogues are eligible, the game prioritises by the following:
- marriage status;
- preface;
- suffix;
- in-law status;
- day of month;
- year;
- heart level;
- day of week.
Strings from CS files
Data\Strings\StringsFromCSFiles.xnb contains many translation strings, including NPC dialogue defined in the code. That includes every bit of dialogue that's shared between multiple characters, and dialogue for some hardcoded events like marriage. The format in this file is:
"<key>": "dialogue string"
The key is generated based on the file that contained it before translations were added (in the form <file name>
.<int id>
), but doesn't have any particular meaning now.
Event files
Data\Events\*.xnb contains event scripts, including any dialogue in the event (see Modding:Event data).
Algorithm
The game finds as follows:
- Event dialogue is read from the appropriate event commands (see Modding:Event data).
- Location-specific dialogue is read from StringsFromCSFiles
<location>
.cs. - Else character dialogue is read from the character-specific files.
- If no dialogues were found, the game resorts to hardcoded dialogue from the StringsFromCSFiles files (specifically keys prefixed with NPC.cs NPC.cs).