Difference between revisions of "Modding:Dialogue"
Pathoschild (talk | contribs) (→Dialogue format: simplify header) |
Pathoschild (talk | contribs) (→Format: note where dialogue is parsed) |
||
Line 51: | Line 51: | ||
==Format== | ==Format== | ||
− | Dialogue text can contain tokens and | + | Dialogue text can contain tokens and commands which control the dialogue box, change the text (e.g. switch between gender-specific strings), inject values, etc. These are parsed by the <tt>Dialogue</tt> class. |
Special tokens: | Special tokens: |
Revision as of 15:45, 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).
Format
Dialogue text can contain tokens and commands which control the dialogue box, change the text (e.g. switch between gender-specific strings), inject values, etc. These are parsed by the Dialogue class.
Special tokens:
character | description |
---|---|
# | Separates two commands in a dialogue string. |
{ | TODO. Stands for "breakSpecialCharacter". |
^ | Gender switch character. The text before it is shown for male farmers, the text after it for female farmers. Example: Oh, good morning Mr. @!^Oh, good morning Ms. @!
|
* | TODO. Stands for "quickResponseDelineator". |
Dialogue commands:
group | command | description |
---|---|---|
portraits | $h | Switch the speaking character to their happy portrait. |
portraits | $s | Switch the speaking character to their sad portrait. |
portraits | $u | Switch the speaking character to their unique portrait. |
portraits | $neutral | Switch the speaking character to their neutral portrait. |
portraits | $l | Switch the speaking character to their love portrait. |
portraits | $a | Switch the speaking character to their angry portrait. |
portraits | $<id>
|
Switch the speaking character to the portrait at the given index in their portraits file. NOTE: $1 can't be used as the first dialogue command (see $1 below). |
dialogue | $q <?> <?> #<text>
|
TODO. Show a dialogue box containing the given question text. |
dialogue | $r <?> <?> <response ID> #<answer text>
|
TODO. Adds an <answer text> option to the question dialogue, which when selected triggers the response indicated by <response ID> from the speaker's Content\Characters\Dialogue\*.xnb file.
|
dialogue | $e | End the current dialogue. Everything before $e is shown the first time you talk to an NPC; everything after is shown in subsequent conversations. |
dialogue | $b | End the current textbox, so the next part of the dialogue is shown in a new box. |
dialogue | $k | TODO. Stands for "dialogueKill". |
dialogue | $c <probability>
|
Choose the given text with a <probability> between 0 and 1.
|
dialogue | joja|cc} | TODO. Stands for "dialogueDependingOnWorldState". |
dialogue | $y | TODO. Stands for "dialogueQuickResponse"; works like $q, but within one and the same text line. |
dialogue | $p | TODO. Stands for "dialoguePrerequisite". |
dialogue | $1 | TODO. When used as the first dialogue command, stands for "dialogueSingle". Possibly a check for whether the player is dating (the speaking character?). |
dialogue | %fork | TODO. Seems to have to do with questions and forks, however is used sparingly in originals game code. Seems to be replaced with the actual question command. |
content | @ | Replaced with the player's name. Example: Hi there @!
|
content | %adj | Replaced with a random adjective. |
content | %noun | Replaced with a random noun. |
content | %place | Replaced with a random place name. |
content | %spouse | Replaced with the name of the farmer's spouse. |
content | %name | TODO. Stands for "randomNameSpecialCharacter". Seems to return a random name? |
content | %firstnameletter | TODO. Stands for "firstNameLettersSpecialCharacter". |
content | %time | Replaced with the current time. |
content | %band | TODO. |
content | %book | TODO. |
content | %rival | TODO. |
content | %pet | Replaced with the name of the farmer's pet. |
content | %farm | Replaced with the farm name. |
content | %favorite | TODO. Returns favorite thing? Unused? |
content | %kid1 | Replaced with the name of the farmer's first child. |
content | %kid2 | Replaced with the name of the farmer's second child. |