These are the rules for how event MODs are chosen, how they end, and what happens when something fails. Read this before publishing and whenever things do not work as expected.
When a scene happens (you talked to someone, entered a territory, etc.), the game checks events in the following order.
MODs are checked from the highest priority on the MOD screen downward.
Within the same MOD, events with a larger priority are checked first.
If priority is the same, the load order applies. Files are read in name order, and within a file, in the order listed in events.
Only the first event that meets all of the trigger, narrowing fields, roles and start condition is started.
If no event matches, the game's normal dialogue or quest is used.
Give different priority values to events whose order you want to control.
When a MOD event starts, the dialogue or quest the game would normally show in that scene does not appear. The MOD's dialogue appears instead of the normal dialogue, not in addition to it.
With broad conditions such as "anyone in the tavern", all of the tavern's normal dialogue and quests stop appearing.
Narrow down the person, place and conditions.
Exclude people whose story is over using records and the start condition, and return them to normal dialogue (Chapter 7 of the tutorial).
END: runs onComplete. Marks one-time records. Actions performed so far remain.
ABORT: does not run onComplete. Does not mark one-time records. Actions performed so far remain.
Forcibly closed, the other person disappeared, or an error occurred: does not run onComplete. Does not mark one-time records. Actions performed so far remain.
However a dialogue ends, actions that succeeded before that are not undone.
There is no way to resume a dialogue partway. After loading, the dialogue starts from the beginning.
once_per_save and once_per_target record "done" when the dialogue ends with END.
Even if onComplete after END fails, "done" is recorded. This prevents actions that partly succeeded from running twice.
ABORT and forced closing do not record it, so the event starts again at the next opportunity. However, the actions performed so far remain. If you give a reward unconditionally at the start of a dialogue, the reward grows each time it is retried. Combine rewards with records so they are given only once.
An event that you have seen through to END once in a save no longer appears. To test again, use a new save, or use always only during development.
An action group runs steps from top to bottom.
If an action partway fails, earlier successes remain and later actions do not run.
Put actions that may fail (taking money, recruiting) first, and change records or rewards only after they succeed.
If you write onFailure.goto for an action group used partway through a dialogue, the dialogue goes to that row on failure. If omitted, the dialogue is interrupted.
onComplete runs when the dialogue closes, so even if it fails, the dialogue cannot continue. Put actions whose failure you want to report in text in a row before the last row, or in a choice's event.
Failed action groups are not retried automatically.
Even if you return to the same row in the same dialogue, an action group (with repeat once_per_run) runs only once.
Cases such as a character not being found inside a condition (no father, etc.) or several being found where one is required are "errors". An error is different from "not met (false)".
Using not or "value": false does not turn an error into "met".
If the start condition results in an error, the event does not start.
When a branch results in an error, it does not necessarily go to else. Do not rely on else as the "error case".
When using a character who may not exist, check first with entity.exists, or exclude them with required in roles.
Records are stored in the save data. Changing records in the game does not write them to the file until you save. To check, save and then load.
Records are managed by the pair "MOD" and "event id". Local MODs are identified by their folder name.
After publishing, do not change the MOD folder name or event id. If you change them, players' records and "done" records will not carry over.
Even if a character's name or affiliation changes, records carry over as long as it is the same character.
When a MOD is disabled, its events no longer happen and normal dialogue returns.
Funds, Renown, affiliation and so on changed by events are not restored.
Temporarily disable other event MODs and test with only your MOD.
First check that the smallest form (a one-row dialogue) is displayed.
Add the trigger, narrowing fields and conditions one at a time and check each.
Also test cases where things go wrong: no one to talk to, not enough money, cannot join, characters with the same name, and so on.
Select every choice and check that success text or rewards do not appear when something fails.
Check separately: END/ABORT, talking to the same person again, a different person, and saving and loading.
Actually play to check that normal dialogue and quests still appear, and that controls and the cursor return to normal after the dialogue closes.
Finally, check with other MODs enabled at the same time, and with your MOD disabled.
For the steps to enable, restart and upload to the Workshop, see the home page.
The event does not appear: Is the MOD enabled? Is the events folder directly under the MOD folder? Did you restart after changing files? Has a one-time event already been marked "done"?
It does not appear only for a specific person or place: Are units, spots and placeIds correct? Does the person exist? Did unique in roles find several candidates? Is the start condition met?
The whole MOD is not loaded, or an error appears: Check schemaVersion, the spelling of field names, the JSON syntax (commas, quotation marks), value types, dialogue.id and file, startRow, row and action group names, and limits.
Pressing a choice does not advance, or goes to a different row: Do the rows in the choice's jumpTo and in onFailure.goto exist? Did an action fail?
Money or recruiting actions fail: Check the current values such as Funds, whether the game's normal joining conditions are met, and which actions succeeded before the failure.
Normal dialogue or quests stopped appearing: Is a MOD event starting in the same scene? Narrow down the person and conditions.
Records disappear after loading, or the event happens again: Did you save before loading? Is owner the same character? Did you change the MOD folder name or the event id?
{{name}} is displayed as is: Is dialogue.var.set run before that row, or in that row's event? Check the spelling of the name.
For where errors are shown and where logs are, see "If changes do not appear" on the home page.