Story patches - Pandemonium14/ExoLoader GitHub Wiki

Getting started

As with everything else, you start by creating folder in your own content folder. It should be called StoryPatches.

Then, any text file in this folder will be parsed as a patch file. Each file can contain any number of patches.

General syntax

A patch has a header, and a body.

The header declares the type of patch it is, the event it's looking to patch, and indications on where the patch should be injected. The header looks like this : @patchType|eventId|[location arguments]

The body should be located just under the header, is opened by a line containing only a {, and closed by a line containing only a }. It contains the lines that will be written into the story file when patching.

Insert patches

Insert patches insert lines just before the specified line. It doesn't modify any existing line.

The header of an insert patch should look like this : @insert|[eventID]|[location key]|[location index]

EventID is the ID of the event you want to patch. The Location key is how the target line starts (you can put the whole line in, if you want, but in the case of lines with lots of text, just the first sentence should be enough). (Reminder, the patch will insert what's in the body just before this line) The location index is there in case you can't make the key specific enough. For example, if you want to insert just before a >continue, but there's multiple of them in the event. This number is the number of instances of the key the patcher should let pass before actually inserting the patch. 0 will patch at the first it finds, 1 will patch at the second, etc.

Example:

@insert|nomiIntro|>continue|1
{

-

"Hello, I was patched to make me say this."

They seem happy about this.

}

This inserts the lines in the body (between the two curly brackets) just before the second (because of the 1) instance of >continue in the event called nomiIntro. (Don't look at what it would even do, I wrote this without even looking at the event)

Replace patches

Replace patches completely replace the specified lines with the lines from the body.

A replace patch's header should be like this : @replace|[eventID]|[starting location key]|[end location key]|[start location index]|[end location index]

EventID is, predictably, the ID of the event you want to patch.

The starting location key is how the first line you want to replace starts. The start location index is similar to the insert patch location index.

The end location key is how the last line you want to replace starts. The end location index is how many lines that start with the end key the patcher should let pass after the start location before actually stopping.

If you want to replace one single line, leave the end location key empty.

Example:

@replace|nomiIntro|~set left = nomi_sad||0|0
{
~set left = nomi_happy
}

This replaces the first time that Nomi is set to sad in their intro event with setting them to happy. Notice the double | that leaves the end key empty: this replaces a single line

@replace|nomiIntro|~set left = nomi_sad|>continue|0|0
{
You know, what you said there would have made me sad. But someone patched that out somehow. Lucky you! Imagine making me sad.

>continue
}

This replaces all the lines between the first time Nomi is set to sad and the first line after that has >continue. Here the >continue is put back by the patch, it's just used as a marker to know when to end it.

Debugging tidbits

It can be annoying to debug stories that get patched, since you're not immediately seeing the end result. Here are a few tips:

The patch process creates whole new story files with the patches applied. To look at what your patch did, launch the game once, then look in CustomContent/common/PatchedStories. You'll find all of the generated files there, and you'll be able to find the result of your patch.

Normally, editing either a story file or a patch file regenerates the patched story files. IF that doesn't happen for some reason, deleting _patched_chara_anemone.exo will force the generation of all the patched story files from scratch.