Difference between revisions of "Modding multiple branches"

From Wildermyth Wiki
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
This page walks through the process of creating an encounter which has more than one choice point.  See [[Modding encounter choice|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.   
This page walks through the process of creating an encounter which has more than one choice point.  See [[Modding encounter choice|Adding an encounter with a choice]] to learn about a simpler encounter which has only one choice point.  Using the "branch" encounter type, it is possible to create one encounter which has any number of choice points.  For example, you may want to have an early choice point, 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 second choice point 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==
==Key concept==
This is a brief summary of the prerequisite stepsIf you have an example event already skip  to the next sectionFor more details see [[Modding encounter choice|Adding an encounter with a choice]]
In an encounter with only one choice point, 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 choice points, 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 choice points and outcomes.


TODO: correct these details for the choice example
Let's take an example of moderate complexity.  In the first encounter E, there is a choice 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 point, either a "peaceful good" or "peaceful bad" result.  With the warlike party member, there is some different dialog and then a choice point, either a "warlike good" or "warlike bad" result.  So there are four possible results.


# Select "Tools" at the main game screen, then "Open Editor", then "Content and Comics Editor"
This can be implemented in three encounters.  E is the main encounter with the first choice point.  Choice 1 (exit) 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 choice point, with its two results, without any further branch.  The Ewar encounter contains the warlike dialog and choice point, and its the two results, without any branches.
# At the upper left, click "Mods", click "Create New Mod" in the browser, and fill in the form.
 
# 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.
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.
# On the targets line, add the default "hero" story role and a second story role "volunteer"
# Delete the choiceTarget section, and in the outcome list, add "description".  This creates the comic.
# '''This is the most common mistake, causing a mod to not work! New events are disabled by default.''' Under abilities, set encounterEnabled to true
# Save, and go to the comics screen
# Add a basic full size panel with the hero and volunteer facing each other.
# Your screen should look similar to this:
[[File:ModdingVariantText.PNG]]


==Key concept==
==Getting started==
In an encounter with only one choice, you fill in the choices using options named "one", "two", etcThen in the outcomes section, you fill in the sections "Chose << one >>", etcEach 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.
This guide builds on the previous guide [[Modding encounter choice|Adding an encounter with a choice]].  Please create the files described there.  Note, here we will be surgically re-arranging the json source code rather than using the in-game editorIf you have planned your encounter and set up the branch points in advance, it may be easier to use the in-game editorThis guide will have related screenshots of the in-game editor, but primarily relies on editing the json file in a text editor.


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" resultWith 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.
==Creating the branches in the main encounter==
The encounter described previously has a choice with two branchesThe following json excerpt has the relevant lines (not a complete file):


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.
<syntaxhighlight lang="json">
"outcomes": [
{
"class": "IfPlayerChose",
"ifPlayerChose": "one",
"then": {
"class": "DoAll",
"outcomes": [
{
"class": "Description",
"script": [ { "panel": { ... } ... ]
}
},
{
"class": "IfPlayerChose",
"ifPlayerChose": "two",
"then": { ... }
}
}
]
</syntaxhighlight>


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 stepThen, using the in-game editor, add the details of the comic panels and dialog.
To replace the existing text with a branch, insert the following (again only an excerpt)The value of branchEvent is the new encounter you will add.


<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
TODO
{
"class": "IfPlayerChose",
"ifPlayerChose": "two",
"then": {
"class": "Branch",
"branchEvent": "cropsOfStone_branch_a3"
}
}
</syntaxhighlight>
</syntaxhighlight>
[[File:ModdingRepeatedAdd.PNG]]
 
Here is a screenshot of an encounter with branches as it appears in the in-game editor.  In this case choice one is embedded in the same encounter (under Description), and choice three is a branch to a separate encounter cropsOfStone_branch_a3.
 
[[File:ModdingBranchesEditor.PNG]]
 
==Creating the second encounter==
 
This author tends to create new files in a text editor, by mixing together different blocks cut from earlier mods or original game files.  You absolutely can create these using the in-game editor.  In the previous section we established the name of the branch encounter.  Either in a text editor, or in-game, create the new encounter.  Its type must be "branch".  There are some subtle points about what can be inherited from the previous encounter, but in general every speaking role can be inherited with a role in the target section.


==Seeing the effect in game==
==Seeing the effect in game==


TODO: Write this
The previous guide has the [[Modding encounter choice#Seeing the effect in game|details]].


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

Latest revision as of 14:17, 31 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 point. Using the "branch" encounter type, it is possible to create one encounter which has any number of choice points. For example, you may want to have an early choice point, 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 second choice point 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.

Key concept

In an encounter with only one choice point, 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 choice points, 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 choice points and outcomes.

Let's take an example of moderate complexity. In the first encounter E, there is a choice 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 point, either a "peaceful good" or "peaceful bad" result. With the warlike party member, there is some different dialog and then a choice point, 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 with the first choice point. Choice 1 (exit) 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 choice point, with its two results, without any further branch. The Ewar encounter contains the warlike dialog and choice point, and its 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.

Getting started

This guide builds on the previous guide Adding an encounter with a choice. Please create the files described there. Note, here we will be surgically re-arranging the json source code rather than using the in-game editor. If you have planned your encounter and set up the branch points in advance, it may be easier to use the in-game editor. This guide will have related screenshots of the in-game editor, but primarily relies on editing the json file in a text editor.

Creating the branches in the main encounter

The encounter described previously has a choice with two branches. The following json excerpt has the relevant lines (not a complete file):

"outcomes": [
	{
		"class": "IfPlayerChose",
		"ifPlayerChose": "one",
		"then": {
			"class": "DoAll",
			"outcomes": [
				{
					"class": "Description",
					"script": [ { "panel": { ... } ... ]
		}
	},
	{
		"class": "IfPlayerChose",
		"ifPlayerChose": "two",
		"then": { ... }
		}
	}
]

To replace the existing text with a branch, insert the following (again only an excerpt). The value of branchEvent is the new encounter you will add.

	{
		"class": "IfPlayerChose",
		"ifPlayerChose": "two",
		"then": {
			"class": "Branch",
			"branchEvent": "cropsOfStone_branch_a3"
		}
	}

Here is a screenshot of an encounter with branches as it appears in the in-game editor. In this case choice one is embedded in the same encounter (under Description), and choice three is a branch to a separate encounter cropsOfStone_branch_a3.

ModdingBranchesEditor.PNG

Creating the second encounter

This author tends to create new files in a text editor, by mixing together different blocks cut from earlier mods or original game files. You absolutely can create these using the in-game editor. In the previous section we established the name of the branch encounter. Either in a text editor, or in-game, create the new encounter. Its type must be "branch". There are some subtle points about what can be inherited from the previous encounter, but in general every speaking role can be inherited with a role in the target section.

Seeing the effect in game

The previous guide has the details.