Difference between revisions of "Modding multiple branches"

From Wildermyth Wiki
(Created page with "This page walks through the process of creating an encounter which has more than one choice point. See Adding an encounter with a choice to learn...")
 
Line 18: Line 18:


==Key concept==
==Key concept==
In an encounter with only one choice, you fill in the choices using  
In an encounter with only one choice, you fill in the choices using options named "one", "two", etc.  Then in the outcomes section, you fill in the sections "Chose << one >>", etc.  Each outcome is generally a set of comic panels and some tangible change like new gearWhen there are multiple choices, one or more of the outcomes are simple pointers to a new encounter called a "branch" which contains the set of comic panels and the tangible changesBecause this branch is a separate encounter, it can have its own choices and outcomes.
In the outcomes section of an encounter, you can do a lot of thingsIn this case, we will add a custom "aspect" onto each character.  Then the second encounter will have filters, so it will only trigger if the required aspects are presentSuppose the first encounter adds aspects to two characters, but one of them is killed.  Then the second encounter will never trigger because it will never find both aspects.


==Create the aspects==
Let's take an example of moderate complexity.  In the first encounter E, there is a decision point with three outcomesChoice 1 exits the encounter, choice 2 selects a peaceful party member, and choice 3 selects a warlike party memberWith the peaceful party member, there is some dialog and then a second choice, either a "peaceful good" or "peaceful bad" resultWith the warlike party member, there is some different dialog and then a choice, either a "warlike good" or "warlike bad" resultSo there are four possible results.
It's quick to create the aspect file in a text editor, and easier to control the namesCreate the folders as needed to edit a new file in the assets/aspects folderI use one file named <mod>_aspects.json to store all the aspects.  Each aspect looks like this:
<syntaxhighlight lang="json">
[
{
"modId": "lewe",
"id": "lewe_hero",
"importance": -1,
"lifespan": "all"
}
]
</syntaxhighlight>
The default value of lifespan is "missionOnly".  This is appropriate for other situations, but here we need the aspect to remain in place for the entire game.  Be sure to set lifespan to "all".  Create one aspect for each role you wish to repeat in the second encounter.
 
==Add the aspects in the outcome==
In the outcome section, click "Add Outcome".  This exact screenshot is from a mod which has a choice, and already has some outcomes including a theme and a relationship change; your outcome section may have fewer sections filled in.


[[File:ModdingRepeatedAdd.PNG]]
This can be implemented in three encounters.  E is the main encounter, choice 1 is embedded in this file, choice 2 contains a branch to a new encounter Epeace, choice 3 contains a branch to a new encounter Ewar.  The Epeace encounter contains the peaceful dialog and the two results, without any further branch.  The Ewar encounter contains the warlike dialog and the two results, without any branches.


In the "New Outcome" dialog, on the left, select AspectsIgnore the suggestions in the middleOn the right, click target to set the role from the encounter to whom the aspect will be added.  Then hover over addAspects, click "new", and select the aspect.
It is possible, but inconvenient to change the branching structure after creating the encounterPlan out how you want the branches to work before you implement anythingDifferent modders have different approaches, but it is also possible to carefully edit the json files in a text editor to implement the "guts" of the branches with a stub comic panel for each step.  Then, using the in-game editor, add the details of the comic panels and dialog.


[[File:ModdingRepeatedOutcome.PNG]]
You can add multiple aspects to one character in one outcome, but you will need to add a separate outcome for each character.  The json text for the outcome section should look like this:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
{
TODO
"class": "Aspects",
"target": "hero",
"addAspects": [
{ "id": "lewe_hero", "value": "1" }
]
},
{
"class": "Aspects",
"target": "volunteer",
"addAspects": [
{ "id": "lewe_volunteer", "value": "1" }
]
}
</syntaxhighlight>
 
==Create the second encounter==
Create the basic encounter the same way you created the encounter above.  The encounter will have several roles.  Usually, you will establish two roles in the first encounter, such as hero and volunteer. Then in the second encounter you want to establish the same two roles; this is for convenience.  The role names can be completely unrelated, but it's much easier to remember if you use the same role names in the first encounter, the aspect names, and the second encounter.  To make the encounter require the aspects, add the aspect name in the filter section, near the bottom of the target entry.  Here is a screenshot of the effect editor showing this.
 
[[File:ModdingRepeatedAspect.PNG]]
 
Here is what the json text looks like.  It's usually a good idea to re-test some other assumptions.  In the below example, the aspect was added when the hero was "available" (no lover) but that may have changed since the aspect was added.
 
<syntaxhighlight lang="json">
{
"role": "hero",
"template": "PICK_BY_SCORE",
"scoreFunction": "1-HAS_LOVER",
"scoreThreshold": "1",
"aspects": [ "lewe_hero" ]
}
</syntaxhighlight>
</syntaxhighlight>
[[File:ModdingRepeatedAdd.PNG]]


==Seeing the effect in game==
==Seeing the effect in game==
As your chain of encounters gets longer, the amount of time it takes to trigger the chain for testing gets longer.  For two encounters, it's helpful to have a saved game just before the first encounter.  Then you can load it, trigger the first encounter, and check to make sure that the aspects are added.  You can see aspects in the cheat window of the character detail panel.  Scroll to the bottom to see the most recently added attributes.  Here is a screenshot of the detail panel.
[[File:ModdingRepeatedDebug.PNG]]


Once you have verified that the aspects are present, continue on to set up the second encounter, and save just before that.  If there is some problem with your filters, you can come back to this second save game.  If you change the aspects, you may need to delete the second save game and restart from the first one.
TODO: Write this


[[Category:Modding]]
[[Category:Modding]]
[[Category:Modding Guides]]
[[Category:Modding Guides]]

Revision as of 10:02, 28 December 2019

This page walks through the process of creating an encounter which has more than one choice point. See Adding an encounter with a choice to learn about a simpler encounter which has only one choice. Using the "branch" encounter type, it is possible to create one encounter which has any number of branches. For example, you may want to have an early choice, where the player can back out of the encounter or decide which characters will be involved, then do some more dialog, and then have a final choice to decide the encounter. The focus is on getting something simple which you can see in the game, and adding more details later. The description and screenshots are current as of December 2019, early access version 0.12+104 Pixle Masterson.

Prerequisite encounter

This is a brief summary of the prerequisite steps. If you have an example event already skip to the next section. For more details see Adding an encounter with a choice

TODO: correct these details for the choice example

  1. Select "Tools" at the main game screen, then "Open Editor", then "Content and Comics Editor"
  2. At the upper left, click "Mods", click "Create New Mod" in the browser, and fill in the form.
  3. At the upper left, click "effects", then "New", and fill in the form. In the "Type" dropdown, select "Wilderness Scouting". The name field will fill in with auto-generated text.
  4. On the targets line, add the default "hero" story role and a second story role "volunteer"
  5. Delete the choiceTarget section, and in the outcome list, add "description". This creates the comic.
  6. This is the most common mistake, causing a mod to not work! New events are disabled by default. Under abilities, set encounterEnabled to true
  7. Save, and go to the comics screen
  8. Add a basic full size panel with the hero and volunteer facing each other.
  9. Your screen should look similar to this:

ModdingVariantText.PNG

Key concept

In an encounter with only one choice, you fill in the choices using options named "one", "two", etc. Then in the outcomes section, you fill in the sections "Chose << one >>", etc. Each outcome is generally a set of comic panels and some tangible change like new gear. When there are multiple choices, one or more of the outcomes are simple pointers to a new encounter called a "branch" which contains the set of comic panels and the tangible changes. Because this branch is a separate encounter, it can have its own choices and outcomes.

Let's take an example of moderate complexity. In the first encounter E, there is a decision point with three outcomes. Choice 1 exits the encounter, choice 2 selects a peaceful party member, and choice 3 selects a warlike party member. With the peaceful party member, there is some dialog and then a second choice, either a "peaceful good" or "peaceful bad" result. With the warlike party member, there is some different dialog and then a choice, either a "warlike good" or "warlike bad" result. So there are four possible results.

This can be implemented in three encounters. E is the main encounter, choice 1 is embedded in this file, choice 2 contains a branch to a new encounter Epeace, choice 3 contains a branch to a new encounter Ewar. The Epeace encounter contains the peaceful dialog and the two results, without any further branch. The Ewar encounter contains the warlike dialog and the two results, without any branches.

It is possible, but inconvenient to change the branching structure after creating the encounter. Plan out how you want the branches to work before you implement anything. Different modders have different approaches, but it is also possible to carefully edit the json files in a text editor to implement the "guts" of the branches with a stub comic panel for each step. Then, using the in-game editor, add the details of the comic panels and dialog.

TODO

ModdingRepeatedAdd.PNG

Seeing the effect in game

TODO: Write this