Variants
Several tellings of one conversation, one picked per opening. The feature that stops a village sounding like a recording.
A dialogue can hold variants instead of pages: a list of tellings, one of which is picked each time the conversation opens.
{
"variants": [
[ { "translate": "mypack.smith.1" } ],
[ { "translate": "mypack.smith.2" } ],
[ { "translate": "mypack.smith.3" } ],
{
"pages": [ { "translate": "mypack.smith.night" } ],
"requires": [ { "condition": "at_hour", "span": "small_hours" } ],
"weight": 3
}
]
}A bare array is just its pages. The object form adds three fields:
| Field | Default | Meaning |
|---|---|---|
pages | required | The pages of this telling. |
requires | none | Conditions that must hold for it to be a candidate. |
with | none | Values this telling needs. Named per variant, not per file. |
weight | even | How common this one is relative to the others, 1 to 1000. |
Write four greetings for a trade and the fourth smith the player meets is still saying something new.
Three things that make this work
The player is not told the same line twice in a row
What they have lately heard is remembered against them, not against the speaker. Two villagers reading one file are two mouths on one script, and hearing it from the second directly after the first is worse than hearing it from the same one twice.
Why the memory matters more than the word count
A player who hears six different lines and then a repeat concludes there are seven. A player who hears the same line twice concludes there is one.
The memory holds the last twelve at most, and is not saved: a player who logs out and back in has had the break it was standing in for.
Conditions turn variants from filler into answers
A line for the rain, a line for the small hours, a line for the fourth time you have asked this morning.
{
"pages": [ { "text": "You are bleeding on my doorstep. Sit down before you fall down." } ],
"requires": [ { "condition": "player_health", "at_most": 0.4 } ],
"weight": 5
}A heavier weight on a line that rarely applies means it nearly always wins when it does, without ever being the only thing that could.
Plain pages beside conditional variants is the fallback
A dialogue may carry both. The pages are given exactly when none of the variants apply, rather than turning up at random alongside them, so the ordinary greeting can be plain pages and every variant a special case, without writing a condition that means "and none of the others".
Writing them
Write the repetitive lines gated on times_spoken with at_most, and leave one flat line ungated. People do not become irritable when you keep talking to them; they run out of material and then say one flat thing forever.
{
"variants": [
{
"pages": [ { "translate": "mypack.smith.first" } ],
"requires": [ { "condition": "times_spoken", "at_most": 1 } ]
},
{
"pages": [ { "translate": "mypack.smith.warming" } ],
"requires": [ { "condition": "times_spoken", "at_least": 2, "at_most": 5 } ]
}
],
"pages": [ { "translate": "mypack.smith.enough" } ]
}`times_spoken` counts visits, not clicks
Walking up to somebody is one visit, however many branches the player clicks through, and a menu they opened and closed does not count either. The visit being paid right now is counted, so the first meeting is at_most: 1.
Murmurs work the same way
A murmur line takes the same requires, with and weight a variant does, and draws on the same no-repeat memory. Everything on this page applies to both.
