Modificações:Diálogo

Fonte: Stardew Valley Wiki
Saltar para a navegação Saltar para a pesquisa
Robin building.png
“Ainda tenho muito trabalho a fazer”
— Robin

Tradução incompleta

Este artigo ou seção não foi completamente traduzido para o português. Você está convidado a ajudar na sua construção editando-o
Última edição por Gabie em 2021-06-12 02:43:55.

Índice

Esta página explica como o jogo armazena o texto do diálogo, seu formato e como o jogo o analisa. Este é um guia avançado para desenvolvedores de mods.

Data

O texto do diálogo é armazenado em quatro conjuntos de arquivos.

Diálogo específico do personagem

Characters\Dialogue\*.xnb contém a maior parte do diálogo para cada caractere (um arquivo por caractere). O jogo escolherá o diálogo em uma das seções abaixo, na ordem mostrada aqui.

Diálogo especial

Existem algumas chaves predefinidas para casos específicos:

Formato de chave Descrição
Rejeição de Dança Diálogo usado para rejeitar uma oferta de dança na Dança da Flores. (Um diálogo diferente é usado se eles ja estiverem aceitado dançar com outro jogador.)
Divorciado Diálogo mostrado quando você fala com seu cônjuge divorciado.
<Localização>_Entrada Possíveis linhas de diálogo mostradas acima do nome do NPC quando eles inserem o nome. <Localização>, com 50% de chance. Essa entrada de diálogo pode conter múltiplas opções separadas por /; o jogo, aleatoriamente, irá escolher uma para mostrar.
Exemplo: Entrada Loja de Sementes: "Oi, Pierre!/Agora, O que eu preciso.../Ah, isso parece bom!/Fazendo meu molho especial esta noite!/Pierre! O que há de novo?/Pierre! O que você tem aí para mim?"
Volte Mais Tarde
Ronco
Diálogo do Gil's aparece quando você ainda não completou nenhuma meta do novo Adventure Quest. Volte Mais Tarde... será mostrado uma vez, e nos diálogos subsequentes irá mostrar Ronco.

Caso contrário, o jogo escolherá o diálogo nesta ordem.

Variantes:

  • Cada chave pode, opcionalmente, ser prefixada com um season name, Como springMountain_47_23.

O jogo verificará as variantes nesta ordem: <season><key>, e <key>. As variantes não estão listadas abaixo para simplificar.

key format description
<location>_<x>_<y> Dialogue shown in the named location when the NPC is standing at tile position <x>, <y>.
Example: Mountain_47_23: "I come here for the peace and quiet."
<location>_<dayName> Dialogue shown in the named location on the given day of week.
Example: winter_Fri: "One thing I've learned living here... everyone stares at you if you look different."
<location><hearts> Dialogue shown in the named location if you have at least <hearts> hearts with them. The <hearts> will be checked in the order 10, 8, 6, 4, 2 (no other value will be recognised).
Example: Saloon8: "Hi there @. I'm glad to see you! You're always welcome here."
<location> Dialogue shown in the named location.
Example: Saloon: "Now that I'm here I can finally relax and socialize a bit."

Diálogo da chuva

Characters\Dialogue\rainy.xnb Contém uma entrada de diálogo por NPC. Existe, aproximadamente, 50% de chance que eles usem esse diálogo se nenhum deles combinarem, está chovendo, e você não é casado ou divorciado com nenhum deles.

Diálogo Genérico

Caso contrário, o jogo escolherá um destes na ordem mostrada aqui.

Variantes:

  • Each key can optionally be prefixed with a season name, like spring_14.
  • Each key can optionally be suffixed with _inlaw_<spouseName> (the current player's spouse's internal name), like Sat_inlaw_Abigail. The NPC doesn't actually need to be related to the spouse.

Variants are checked in this order: <season><key>_inlaw_<spouseName>, <season><key>, and <key>_inlaw_<spouseName>, and <key>. The variants aren't listed below for simplicity.

key format description
<dayOfMonth> Dialogue shown on the given day of month in the first year only.
Example: 10: "Did you watch the game last night?#$b#Or wait, do you even have a TV set...?"
<dayOfMonth>_<firstOrLaterYear> Dialogue shown on the given day of month in the first/later year.
Example: 2_1: "My husband Kent is a soldier, working overseas. That's why he's not here right now.#$b#I know he'll come back safe once his tour is over!!#$e#Need something?"
<dayOfWeek><hearts>_<firstOrLaterYear> Dialogue shown on the given day of week if you have at least <hearts> hearts with them, in the first/later year. The <hearts> will be checked in the order 10, 8, 6, 4, 2 (no other value will be recognised).
Bug: only shown if an equivalent <dayOfWeek><hearts> key also exists.
Example: Thu2_2: "Well, my Dad is back. Have you met him?#$b#I'm just glad he's okay."
<dayOfWeek><hearts> Dialogue shown on the given day of week if you have at least <hearts> hearts with them. The <hearts> will be checked in the order 10, 8, 6, 4, 2 (no other value will be recognised).
Example: Sun4: "Hey, @.#$e#How's your day going?"
<dayOfWeek>_<firstOrLaterYear> Dialogue shown on the given day of week in the first/later year.
Bug: only shown if an equivalent <dayOfWeek> key also exists.
Example: Sat_1: "Dad's coming back soon!#$b#I hope he brings me some toys.$u"
<dayOfWeek> Dialogue shown on the given day of week.
Example: Mon: "Oh, hey. Taking a break from work?"

Fallback

If none of the above match, the game will show the value with key NPC.cs.4061 in Strings\StringsFromCSFiles.xnb. (English version: "Hi.")

Marriage dialogue

Characters\Dialogue\MarriageDialogue.xnb contains dialogue text for all spouses, and each NPC may optionally have their own dialogue file like Characters\Dialogue\MarriageDialogueAbigail.xnb. When looking up a dialogue key, it will use the one in the NPC's file if it exists, else the one in the generic file, else a default text (usually blank).

Each dialogue entry has a key with one of these formats:

key format description
<season>_<day> Dialogue shown when the day starts, if <season> and <day> match the current date.
Example: fall_1: "The scent is unmistakable... mushroom, rotting leaves, pumpkin. It's fall, alright. Isn't it lovely?"
patio_<spouse> Dialogue shown when the NPC is standing on the patio.
<weather>_<dayOrNight>_<random> Daily dialogue. <weather> is Rainy if it's raining, else Indoor (even if they're not indoors). <dayOrNight> is Night after 6pm, else Day. <random> is a number -1 to 4, used to randomly select an entry.
Example: Rainy_Night_3: "On nights like this, I like to turn the light down low and just listen...$8"
funLeave_<spouse> TODO
jobLeave_<spouse> TODO
funReturn_<spouse> Dialogue shown after 1pm when they enter the farmhouse but before reaching their target position, but only on Monday (any NPC) or Friday (if not Maru/Penny/Harvey).
Example: funReturn_Abigail: "Hey! Did you have a good day? Mine went well. It was refreshing to take a walk.$h"
jobReturn_<spouse> Dialogue shown after 1pm when they enter the farmhouse but before reaching their target position, but only if funReturn isn't shown instead.
Example: jobReturn_Penny: "#$c .5#Good evening. My day was fine, thanks! How was yours?$h#$e#Jas and Vincent weren't behaving very well today. I'm still all wound up..."
<season>_<spouse> Dialogue shown at 9+ heart levels with a 5% chance each day.
Example: fall_Abigail: "Do I smell pumpkin on you? Maybe I'm just dreaming...$h"
Outdoor_<spouse> Dialogue shown on the farm with a 20% chance.
Example: Outdoor_Abigail: "I'm just going to hang out here, okay?#$e#There's a lot of interesting bugs and things out here. *chuckle*$h"
Outdoor_<random> Dialogue shown on the farm with an 80% chance. <random> is a number 0–4, used to randomly select an entry.
Example: Outdoor_3: "It's pretty cool that we have a cave on our property. It's something I always dreamed about.$h"
spouseRoom_<spouse> Dialogue shown when the NPC is in their room.
Example: spouseRoom_Abigail: "$c .5#I got up a little before you and fed David Jr. He's very active this morning.#$e#I hope you don't mind the guinea pig smell."
OneKid_<random> Dialogue shown when standing in the kitchen, if they have one child. <random> is a number 0–4, used to randomly select an entry.
OneKid_1: "I wonder if %kid1 will grow up to be a farmer like you?"
TwoKids_<random> Dialogue shown when standing in the kitchen, if they have two children. <random> is a number 0–4, used to randomly select an entry.
TwoKids_2: "I had a dream that %kid2 will grow up to be a famous monster hunter. I've already been thinking about a little armor set."
<affection>_<random> Dialogue shown inside the farmhouse between 11am and 6pm, or when the day starts if a different dialogue isn't selected. <affection> is randomly Bad or Neutral if they have less than 9 hearts; 50% chance of Good and 75% chance of Good if you have 10+ or 11+ hearts respectively; else Neutral <random> is a number 0–9, used to randomly select an entry.
Example: Good_5: "I was just admiring the mermaid's pendant you gave me... I'll proudly wear this to my grave.$l"

Event files

Data\Events\*.xnb contains event scripts, including any dialogue in the event (see Modding:Event data).

Descrição de Animação

Data\animationDescriptions.xnb contém pequenos trechos de diálogo para acompanhar certos pontos da programação.

Strings from CS files

Strings\StringsFromCSFiles.xnb contains miscellaneous translations. That includes NPC dialogue defined in the code, dialogue that's shared between multiple characters, dialogue for some hardcoded events like marriage, etc.

The file has entries in the form "<key>": "dialogue string", where the key is an arbitrary unique identifier. These must exactly match the key expected by the game, but the keys are just unique identifiers — even though most keys look like <file name>.<line number>, that's just the convention originally used to assign IDs and it has no meaning or effect (nor does it even necessarily match the current file name or line number).

NPC-specific generic dialogue

With some ingenuity, you can make each NPC respond differently instead of using the normal static dialogue. For example, you can use Content Patcher to change NPC.cs.3962 and NPC.cs.3963 (to give a bouquet), and NPC.cs.3980 (for the mermaid pendant acceptance):

{
   "Action": "EditData",
   "Target": "Strings/StringsFromCSFiles",
   "Entries": {
      "NPC.cs.3962": "$q 10001 give_flowersA#?!...#$r 10001 0 give_flowersA# [Give Bouquet]",
      "NPC.cs.3963": "$q 10001 give_flowersB#?!...#$r 10001 0 give_flowersB# [Give Bouquet]",
      "NPC.cs.3980": "$q 10001 give_pendant#?!...#$r 10001 0 give_flowersB# Will you marry me?"
   }
}

In this example, each NPC will get their response from the give_flowersA, give_flowersB, and give_pendant dialogue key in their character dialogue files. (See format below for more info on the syntax.) Note that these should be added for all datable characters to avoid errors. For example, you could add this for Haley:

{
   "Action": "EditData",
   "Target": "Characters/Dialogue/Haley",
   "Entries": {
      "give_flowersA": "Oh.. these are beautiful.$1#$b#...What? You want to be my Boyfriend?$8^...What?  You want to be my Girlfriend?$8#$b#....I thought we already were together.$1",
      "give_flowersB": "Ohhh, @!  I would love to be your true love.$1",
      "give_pendant": ".....$8#$b#@, I don't know what to say..$8#$b#...$7#$b#Yes... I accept...$4#$b#I can't wait to tell the Mayor... Everything should take 3 days to set up.$1"
   }
}

This can be used for other generic responses, and you even can avoid the "Give Bouquet" by asking for an answered question's ID.

Algorithm

The game finds dialogue as follows:

  1. Event dialogue is read from the appropriate event commands (see Modding:Event data).
  2. Location-specific dialogue is read from StringsFromCSFiles <location>.cs.
  3. Else character dialogue is read from the character-specific files.
  4. 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. @!
% Turns the dialogue box into a generic text box.
Example: "%Abigail is lost in her music."
* TODO. Stands for "quickResponseDelineator".

Portrait commands

These commands determine which portrait will be shown in the dialogue box. Portrait commands go to the end of a line of dialogue:

"fall_Fri6": "When I was a little girl, my father abandoned us.$s#$b#I'm sorry to make things uncomfortable for you...$u#$e#Anyway... How's the farming life going?",
command description
$neutral Switch the speaking character to their neutral portrait.
$h Switch the speaking character to their happy portrait.
$s Switch the speaking character to their sad portrait.
$u Switch the speaking character to their unique portrait.
$l Switch the speaking character to their love portrait.
$a Switch the speaking character to their angry portrait.
$<id> Switch the speaking character to the portrait at the given index in their portraits file. Portraits are numbered from left to right and top to bottom, starting at $0. All characters have six standard portraits: $0 (neutral), $1 (happy), $2 (sad), $3 (unique), $4 (love), and $5 (angry). Characters may have custom portraits beyond those for their dialogue and cutscenes.
NOTE: $1 can't be used as the first dialogue command (see $1 below).

Dialogue commands

$q <response IDs> <fallback>#<text> Show a dialogue box containing the given question text. If <response IDs> (a list delimited by /) contains an answer already given, the question is skipped (along with the rest of this dialogue line), and instead the dialogue entry identified by <fallback> will be appended to whatever precedes this $q command. The <fallback> dialogue typically uses a $p command to adjust the text based on the player's answer to this question.
$r <response ID> <friendship> <reaction>#<answer text> Define a response option to a $q question dialogue. <answer text> is the text shown. <response ID> is used to group responses for future reference (multiple answers can share an answer ID). <friendship> defines the change in friendship value, positive or negative, if this response is selected. <reaction> names the dialogue entry from the NPC's Content\Characters\Dialogue\*.xnb file that will be the NPC's reaction if this response is selected by the player.
$p <response ID>#<match text>|<no-match text> Stands for "dialoguePrerequisite". Shows different text depending on whether the player gave a particular answer to a previously-asked question. If <response ID> matches an answer the player gave, <match text> is shown; otherwise, <no-match text> is shown. These texts, separated by |, can each contain multiple commands separated by #. This does not need to be the first command in the dialogue string.
$b Indicates pauses in dialogue, where the player will need to click for the next part to load in a new dialogue box.
$e Ends the current dialogue, closing the dialogue box and resuming player control. The dialogue following $e will require a new interaction with the NPC.
$k TODO. Stands for "dialogueKill".
$c <probability>#<text1>#<text2> Show <text1> with a <probability> between 0 and 1; otherwise, show <text2>. E.g. $c 0.9 for a 90% chance of <text1> and a 10% chance of <text2>. NOTE: Replacer commands (see below) do not work in <text1>. This does not need to be the first command in a dialogue string. It is unaffected by daily luck.
$d <bus|joja|cc> dialogueDependingOnWorldState

"Tue4": "$d <dependence>#|Dialogue when dependence value is true.|Dialogue in other situations.",
The dependence can take one of three values: "bus": is the bus fixed?; "joja": is JoJa Mart in business?; "cc": has the Community Centre been completed? This command must start the dialogue string and does not allow for any other dialogue commands in the string.

$y TODO. Stands for "dialogueQuickResponse"; works like $q, but within one and the same text line.
$1 <letter ID>#<1st-time text> #$e# <nth-time text> Creates a line of dialogue which the character will only see once (at most). <1st-time text> is shown only if <letter ID> has not been marked as sent yet (and this marks it as sent); otherwise, <nth-time text> is shown. <letter ID> should not correspond to an actual piece of mail (because it will not be sent), but it can be referenced by events or other dialogue lines.
%fork TODO. Seems to have to do with questions and forks, however is used sparingly in game code. May be limited to forking events.
[# # #] Gives the player a random item, from the pool of item IDs within the brackets.

Question example

To understand how $q, $r, and $p work, an example may be helpful. Note how you can format the script to be easier to read:

summer_Fri:
    "I think I'll go to the beach tomorrow!
    #$q 305/306 beachquestion_followup#Would you like to go with me?
        #$r 305 15 beachquestion_yes#Sure, I would love to!
        #$r 306 0 beachquestion_sorry#Oh, sorry, I've already made plans with someone else...
        #$r 306 -10 beachquestion_no#No thank you.
    ",
    beachquestion_yes: "Good! It's a date.$h",
    beachquestion_sorry: "Oh. Darn. Okay.$6",
    beachquestion_no: "Oh. Um. Sorry.$s",
    beachquestion_followup:
        "$p 305
            #Tomorrow should be a lot of fun!$h
            |Hmm, I wonder if I can get someone to go with me...$s
        ",

summer_Sat:
    "The beach is lovely this time of year...
    #$p 305
        #Thanks for coming with me today.$h
        |Oh, hi @, how's it going?
    ",

The dialogue above triggers on any Friday in the summer. The NPC begins with a response that is always shown: "I think I'll go to the beach tomorrow!"

Next they ask you a question.

#$q 305/306 beachquestion_followup#Would you like to go with me?

$q starts the question. 305/306 checks to see if this question has been asked before, and if it has it sends you to the dialogue key beachquestion_followup. (Note that you can name your dialogue keys whatever you like which makes it easier to read.)

Next are the responses the player can give. You can add any number of $r lines; here we have three:

    #$r 305 15 beachquestion_yes#Sure, I would love to!
    #$r 306 0 beachquestion_sorry#Oh, sorry, I've already made plans with someone else...
    #$r 306 -10 beachquestion_no#No thank you.

If you say yes (first option), the game will store ID 305 as the answer given to this question. Next, your friendship with that person increases by 15. beachquestion_yes tells the script which dialogue key continuation to use as a response to your answer.

If you say no (second and third option) the game will store ID 306 as the answer given, then depending on which answer you gave will either not change your friendship with the person, 0, or reduce it, -10. Then it will use either beachquestion_sorry or beachquestion_no to continue the dialogue.

Now we need to make dialogue keys for each response:

    beachquestion_yes: "Good! It's a date.$h",
    beachquestion_sorry: "Oh. Darn. Okay.$6",
    beachquestion_no: "Oh. Um. Sorry.$s",
    beachquestion_followup:
        "$p 305
            #Tomorrow should be a lot of fun!$h
            |Hmm, I wonder if I can get someone to go with me...$s
        ",

Of note here is beachquestion_followup. If the player talks to the NPC again, $q 305/306 will check that the question has already been answered and instead go directly to this key.

$p 305 begins a variable response which means "if the player chose yes, say this line, else say this line instead". If the player answered yes, the NPC responds happily. Otherwise, they will comment that they need to find someone to go with them.

There is another variable response the next day:

summer_Sat:
    "The beach is lovely this time of year...
    #$p 305
        #Thanks for coming with me today.$h
        |Oh, hi @, how's it going?
    ",

Once again the first line (The beach is lovely...) always shows up when the player talks to the NPC, but the next line depends on whether or not they've answered yes the previous day.


Here is another example from Haley's existing dialogue file. Note how the script formatting is harder to read, but the game is able to process both.

    summer_Sat: "Farming sounds so boring...#$q 42/43 summer_Sat_old#What do you even do all day?#$r 42 10 summer_Sat_12#Care for plants#$r 42 10 summer_Sat_12#Explore the caves#$r 43 -10 summer_Sat_13#Snoop around in your room#$r 42 10 summer_Sat_12#Dig for treasure" #!String
    summer_Sat_old: "#$p 43#Hey, you better not be snooping around in my room anymore!$a|But I guess it could get you in pretty good shape." #!String
    summer_Sat_12: "Hmm... sounds like a lot of work." #!String
    summer_Sat_13: "What? You'd better not be doing that!$a" #!String

The first time the summer_Sat dialogue is chosen, neither response 42 nor 43 will have been given (because this question is the only one which has them as responses), so Haley will say, "Farming sounds so boring... What do you even do all day?" The player can select among these responses:

  • Care for plants
  • Explore the caves
  • Snoop around in your room
  • Dig for treasure

The third response, $r 43 -10 summer_Sat_13#Snoop around in your room, sets response ID 43, reduces Haley's friendship by 10 points, and brings up the dialogue summer_Sat_13 (Haley says, "What? You'd better not be doing that!"). All of the other responses set response ID 42, increase Haley's friendship by 10 points, and bring up the dialogue summer_Sat_12 ("Hmm... sounds like a lot of work.").

The next time summer_Sat is chosen, one of the response IDs listed in the $q command will have been given (either 42 or 43). Therefore, the $q and everything after is scrapped, and dialogue summer_Sat_old is put in its place. This new dialogue uses the $p command to change Haley's dialogue based on whether or not you gave response ID 43 to any previous question. If you answered "Snoop around your room," everything before the | will be used, so Haley will now say, "Farming sounds so boring... Hey, you better not be snooping around in my room anymore!" If response ID 43 has not been given (in this case, you must have given response ID 42, i.e. one of the other three responses to the previous question), everything after the | will be used, so Haley will instead say, "Farming sounds so boring... But I guess it could get you in pretty good shape."

Comandos substitutos

Comandos substitutos irão ser substituídos pela string relevante.

@ Nome do Fazendeiro.
Example: Eai @!
%adj Adjetivo aleatório. (Definido em StringsFromCSFiles.xnb)
%substantivo Substantivo aleatório. (Definido em StringsFromCSFiles.xnb)
%lugar Nome de lugar aleatório. (Definido em StringsFromCSFiles.xnb)
%cônjuge O nome do cônjuge do fazendeiro.
%nome Um nome gerado aleatoriamente
%PrimeiroNomeCarta As primeiras 2 cartas no nome do fazendeiro. (Exemplo: Se o nome do Fazendeiro for Jack.) "Olhe! Está soletrando algo!, I... ❤, J-A. Espere.. I, ❤, Ja...?)
%tempo Tempo atual.
%banda O nome da banda de Sam e Sebastian.
%livro O título do livro de Elliott.
%rival Um primeiro nome aleatório do mesmo gênero que o fazendeiro vindo de StringsFromCSFiles.xnb (keys Utility.cs.5499 through Utility.cs.5560). O nome não irá combinar com o do Fazendeiro. %pet O nome do pet de estimação do fazendeiro.
%fazenda Nome da Fazenda.
%favorito Coisa favorita do Fazendeiro.
%criança1 O nome da primeira criança do Fazendeiro.
%criança2 O nome da segunda criança do Fazendeiro.

Constantes

O jogo usa esses valores pré-definidos em algumas chaves de diálogo. Essa seção está vincula com a de cima quando necessário.

Dias da Semana

  • Seg
  • Ter
  • Qua
  • Qui
  • Sex
  • Sáb
  • Dom

Estações

  • Primavera
  • Verão
  • Outono
  • Inverno

Primeiro/Último ano

Em alguns casos, o jogo usa "primeiro/último ano" para condições de diálogo. Existe apenas duas possibilidades de valores:

Valores Significados
1 Ocorre no primeiro ano.
2 Ocorre em qualquer ano após o primeiro (não apenas no segundo ano).