Jump to content

Recommended Posts

Posted

I would like to make a suggestion to slightly alter the file structure for dialogue JSON files to make it easier to use JSON patches on them.

Currently, these dialogue files look like this:

{
  "components": [
    {
      "code": "testhasmet",
      "owner": "tobias",
      "type": "condition",
      "variable": "player.hasmettobias",
      "isNotValue": "true",
      "thenJumpTo": "firstmeet",
      "elseJumpTo": "welcomeback"
    },
    {
      "code": "firstmeet",
      "owner": "tobias",
      "type": "talk",
      "text": [{ "value": "dialogue-tobias-donttakevisitors" }],
      "jumpTo": "continuefirstmeet"
    }
  ]
}

We have a long list, that contains all the dialogue parts. When you want to patch one dialogue part from this file, you have to count which index in the list it has. (The above file is only a small excerpt. The full file has 115 elements in the list.) This is firstly quite tedious, and secondly has a lot of potential to get silently messed up. This could happen either through a game update that changes the file, or also when multiple mods try to patch the same dialogue file (Particularly since you cannot guarantee mod load order, except through dependencies).

My suggestion for changing this would be to make use of the "code" component each dialogue part already has. We can remove the list, and instead use this "code" as the key for each element. Here is the above file rewritten in this manner:

{
  "testhasmet": {
    "owner": "tobias",
    "type": "condition",
    "variable": "player.hasmettobias",
    "isNotValue": "true",
    "thenJumpTo": "firstmeet",
    "elseJumpTo": "welcomeback"
  },
  "firstmeet": {
    "owner": "tobias",
    "type": "talk",
    "text": [{ "value": "dialogue-tobias-donttakevisitors" }],
    "jumpTo": "continuefirstmeet"
  }
}

In this version of the file, you can now patch each element directly using its key. This is easier to use and much less likely to break.

Currently, the dialogue always starts at the first element of the list. In the new system, this could be done by having a required dialogue part with "start" as the key.

Of course, implementing something like this is in no way a priority. But, I hope a change like this could be added at some point.

  • Like 1
  • 3 weeks later...
Posted
On 3/31/2026 at 9:53 AM, jerjerje said:

In this version of the file, you can now patch each element directly using its key. This is easier to use and much less likely to break.

This problem sadly exists among other data structures as well, such as behaviors. On several occasions I've had to update my mods for a simple index change after an addition or removal shifted the elements around.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.