Pixel Dream StudiosWiki

Errands in conversation

The ten kinds this mod adds to RPG Dialogue: what a conversation can ask about an errand, say about one, and do with one. No Java at any point.

Nothing about an errand is hard-wired into who says what. A conversation asks how things stand, says what is wanted, and offers to take it on or hand it over, and all of that is written in datapack files.

Ten kinds, added to RPG Dialogue's own conditions, values and actions, and used exactly like them.

The five states

How things stand between one player and one person. Exactly one holds at any moment.

StateMeans
noneNothing between them. Either they have nothing to ask, or it is long since settled.
offeredThey have something to ask and the player has not taken it on.
runningThe player took it on and is still short of it.
readyThe player took it on and is carrying the whole of it.
settledThey ran it and the villager still remembers. The rest of that day, and no longer.

That is what lets a conversation offer the right line without asking three questions: a choice gated on ready and one gated on running can never both be shown, so the villager either asks after the goods or waits for them, and never does both in the same breath.

Conditions

ConditionFieldsHolds when
rpg_errands:errandstateThat state is the one that holds.
rpg_errands:errand_kindkindThe errand in play is of that task kind.
rpg_errands:errands_runerrand (optional), at_least=0, at_most=∞The player has run that many. Named, of one errand; left out, of all of them.
"requires": [
  { "condition": "rpg_errands:errand", "state": "ready" },
  { "condition": "rpg_errands:errand_kind", "kind": "rpg_errands:hunt" }
]

errand_kind is for the handful of lines that cannot cover all three tasks. "I have what you asked for" is right over a sack of clay and strange said having just come back from killing wolves.

errands_run is what a village's opinion of you can be written against without inventing a second reputation to hold it. Somebody who has run nine errands out of this village is a known quantity, and a line gated on at_least is how they find that out.

To cover more than one state, wrap them

any_of takes them as ordinary conditions: { "condition": "any_of", "of": [ ... ] }.

Values

ValueGives
rpg_errands:errand_itemWhat is being asked for, by name.
rpg_errands:errand_countHow many were asked for, as agreed.
rpg_errands:errand_remainingHow many are still wanted. Never negative.

These are what let one written line serve every errand in the pack. "%1$s %2$s, if you can spare them" is a sentence about wheat, about copper, about the wolves in the trees and about a mod's own material, none of which needed a file:

{
  "pages": [ { "translate": "mypack.asking" } ],
  "with": [
    { "value": "rpg_errands:errand_count", "capitalize": true },
    { "value": "rpg_errands:errand_item" }
  ]
}

Both counting values take the usual number style fields, so they arrive as words rather than figures. "Twenty-six", not "26". Add "digits": true for a ledger, and "capitalize": true for a number that begins a sentence.

errand_remaining is for the line given to somebody who came back short. A player carrying twenty of the twelve that were asked for is short of none of them, and a villager who announced they were owed minus eight would be doing arithmetic rather than talking.

Actions

ActionDoes
rpg_errands:speak_of_errandSays the thing that needs saying: the asking, or the reminding. Opens a screen.
rpg_errands:take_errandThey agree to it.
rpg_errands:hand_in_errandSettled: takes what it costs, pays, moves the gossip, says so. Opens a screen.
rpg_errands:drop_errandThey back out. Nothing was done, so nothing is remembered.

speak_of_errand is one action rather than two on purpose. The conversation gates its choices on the state, and cannot then pair the wrong label with the wrong conversation.

hand_in_errand does everything in one place and in one order: take, pay, thank, then say so. Taking comes first and takes all or nothing, so no path through it pays out twice or pays out for a player who dropped the goods on the last page.

None of the actions names which errand it means

Deliberate. The errand is whatever stands between this player and the person in front of them, worked out on the server from the pair of them. A client crafting a packet could at most pick a choice it was already offered about the errand it was already on.

These two actions are also what makes a mark appear

A villager is only marked if the conversation that would actually open for that player contains a choice carrying speak_of_errand or hand_in_errand. It is asked of the file rather than of the moment, which is what keeps a mark honest, and it means a greeting of your own with no errand choice in it takes those villagers out of the system silently and correctly. See The marks.

Writing your own

An errand names its own conversations with asking, reminding and thanking. They are ordinary dialogue files and the only thing that makes them errand conversations is the actions in them.

An asking file needs a way to say yes.

{
  "pages": [
    { "text": "The last of my ink went on a copy nobody has come to collect." },
    { "text": "Six sacs would set me right, if the squid are running." }
  ],
  "dismissible": true,
  "choices": [
    {
      "label": { "translate": "rpg_errands.choice.accept" },
      "actions": [ { "type": "rpg_errands:take_errand" } ]
    },
    { "label": { "translate": "rpg_errands.choice.decline" } }
  ]
}

A reminding file needs a way to hand it over, gated on ready, and usually a way out:

"choices": [
  {
    "label": { "translate": "rpg_errands.choice.deliver" },
    "requires": [ { "condition": "rpg_errands:errand", "state": "ready" } ],
    "actions": [ { "type": "rpg_errands:hand_in_errand" } ]
  },
  { "label": { "translate": "rpg_errands.choice.later" } },
  {
    "label": { "translate": "rpg_errands.choice.abandon" },
    "actions": [ { "type": "rpg_errands:drop_errand" } ]
  }
]

A thanking file is only words. It is opened by hand_in_errand after everything has already happened, so it must not carry one itself.

Use variants rather than writing three files

A reminding conversation that reads differently when the player is short and when they are carrying the lot is one file with variants, each gated on running or ready. That is how the shipped one is written.

Text this mod already ships

Translation keys you can use in your own files, so the wording matches everywhere and is translated for you.

KeyEnglish
rpg_errands.choice.ask"Is there anything you need?"
rpg_errands.choice.accept"I will see it done."
rpg_errands.choice.hunt.accept"It will be seen to."
rpg_errands.choice.carry.accept"I will carry it."
rpg_errands.choice.decline"Not today."
rpg_errands.choice.recall"What was it you asked of me?"
rpg_errands.choice.deliver"I have what you asked for."
rpg_errands.choice.hunt.deliver"It is done."
rpg_errands.choice.carry.deliver"I was sent to find you."
rpg_errands.choice.later"You will have them."
rpg_errands.choice.abandon"Find another for it."
rpg_errands.choice.more"There was something else."
rpg_errands.choice.trade"Let me see what you have."

On this page