Difference between revisions of "Modding replace faction"

From Wildermyth Wiki
(Created page with "This page walks through the process of adding a new ability to a custom monster. The focus is on getting something simple which you can see in the game, and adding more detai...")
 
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
This page walks through the process of adding a new ability to a custom monster.  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 replacing all the monsters in a faction.  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 July 2020, early access version 0.23+148 Triss Thornfire.   


==Preparation==
==Main concept==
This guide builds on the previous guide [[Modding add monster|Adding a monster]].  You can also find the files created during that guide in a learning mod on steam workshop: [https://steamcommunity.com/sharedfiles/filedetails/?id=1925402595 Oh no a dragon]If it is helpful, you can start from that mod as described in [[Modding Guide#Using an existing mod as a starting point|Using an existing mod as a starting point]].
Today, modders cannot add factions.  The game is hard-coded with five factions.  But, you can replace all the monsters in a faction and change the name.  Why would you do this, instead of just adding new monsters without factions?  Because of calamities.  In other games, you can make a large "family" of monsters with stronger and stronger abilities, and use an "encounter table" that maps the party's power level against the monster types.  So, low level parties will encounter easy monsters and high level parties will encounter hard monsters.  In Wildermyth, for the most part, low and high level parties encounter the same monsters; but calamities make the monsters stronger or add special effects.  Hopefully, this makes encounters interesting for parties of all levels automatically.
 
If you want to add one monster for one event, you can do that, but you can't really tune it to be an interesting encounter for both a low level party and high level party.  It's better to redefine a faction, and use the calamity system to make the monsters stronger as the party grows stronger.
 
Here are the steps to replacing a faction.
<ol>
<li>Add monsters.  The basics of adding monsters are described in this tutorial: [[Modding add monster|Adding a monster]].  Most factions have 5-9 different monsters.</li>
<li>Change the faction name.  This has some limitations; As of today, your name won't show up everywhere, and there are some images you can't change.</li>
<li>Update the calamities.</li>
<li>Add the "tracks" for generating monsters.</li>
</ol>
 
==Change the faction name==
 
The file assets/text/dynamic/dynamic.properties contains the faction name.  Change this to override the name in most places.  For example, to rename Drauven as Bandits:
<pre>
drauven.singular=Bandit
drauven.plural=Bandits
drauven.name=Bandits
</pre>
 
Currently there are at least two places this change won't affect.  When you create a campaign using your modified faction, you will often "lock" the campaign to one enemy; for example, the builtin campaign "Enduring War" locks the main enemy to Morthagi.  In the "new story" dialog field for "main enemy", the old name like Drauven will still appearAlso, in the page which displays calamities, there is currently no way to change the small image that appears at the top of the column, circled in red below.  All the bandit calamities will still appear under the header which is an image of a drauven.


==Main concept==
[[File:MonsterReplaceCalamity.png]]
Monsters have a list of aspects; each aspect allows them to do one thingSome aspects include things like opening doors and searching, which many but not all monsters can do.  Monsters also have several attacks which they may choose among; the aspect simply points to an effect, and the details are in the effectWe'll add a simple aspect, add this to the monster, add the related effect, and then most of the work is in the effectIt's easiest to add a new ability which is a simple modification of an existing monster ability, weapon ability, or character class abilityYou can view monster abilities using the in-game editor; choose "monsters (ctr+7)" in the top dropdown.
 
==Update the calamities==
 
All of the calamities are listed in the file assets/data/calamity/calamities.jsonToday, there is no way to "merge" calamities between different modsSo, if it happens that two mods change this file, the file from the mod with higher priority will take effect, and the other files with this name will be ignoredThe file contains all the calamities, one after the other, for all the factionsEach calamity looks like this:


==Create the aspect==
The aspect links the monster to the effect.  It's quick to create the aspect file in a text editor, and easier to control the names.  Create the folders as needed to edit a new file in the assets/aspects folder.  I use one file named <mod>_aspects.json to store all the aspects.  Each aspect looks like this:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
[
{
{
"modId": "lewe",
"weight": 0.35,
"id": "lewe_stun_lord",
"card": {
"effects": [ "lewe_stun_lord" ],
"id": "buff_yab_dagger_GAINS_armor",
"importance": -1,
"category": "buffMonster",
"flavor": "drauven",
"monsterIds": [ "yab_dagger" ],
"aspects": [ "calamityBuffMonster_armor" ]
}
}
}
]
</syntaxhighlight>
</syntaxhighlight>
The name can be anything; one possible format is "<modId>_<abilityDescription>_<monsterName>".  It is OK to have the same name for the aspect and the effect.
The key is to find all the calamities in the file where "flavor" matches the faction you are replacing, which may be scattered around in the existing file.  As you will see, there are 3 basic types: GAINS_armor, GAINS_health, GAINS_damage; GAINS_range is no longer used and always has "weight:0" to prevent it from appearingThere are also several faction specific types, like GAIN_imposeConcuss and GAINS_imposeMindworm.  Later, you could add your own aspects as described elsewhere on the wiki.


==Add the aspect to the monster==
For now, add the three basic calamities for each of your monster typesIt may be easier to do this using cut and paste in a text editor.
You can use the in-game editor, or a text editorUsing the in-game editor, go to the monster tab (ctr+7), find your monster in the alphabetical list (using the mod prefix for monster names is helpful), hover over "aspects", click "Add", and find your aspect in the picklist.  Here is a screenshot.


[[File:ModdingMonsterAspect.PNG]]
If you accidentally leave some monsterIds which refer to the monsters you removed, then the player may see these calamity cards appear, even though the monsters they refer to will never appear.


In a text editor, find the aspects section in the monster file; it will have a number of aspects including probably "monstrous" and "monsterCanSearch".  Add your aspect into the list.
==Add tracks==
 
The tracks section is similar to the "encounter table" you may find in other gamesThe related file is: assets/data/generation/monsterDecks.jsonAs with the calamity file, only the file from the highest priority mod is currently usedEach of the five factions appears in its own "groupFlavor" section, and each monster has its own entry in the "tracks" sectionHere is a section of the monsterDecks file for Gorgons.
==Create the effect==
Effects can be very complicated, and this author doesn't understand all the details yetIn general we can think of three types of combat abilities: on a player weapon (eg, water enchantment), on a player button (eg, the raider ability), or as part of a monster attack. Each of these has different detailsMonster attacks need to be triggered automatically by the AI, rather than bound to a weapon or button. It's helpful to start with two existing working game files, one which is a monster ability with the type of targeting we want, and one which has an outcome close to what we want.
Then the new effect file can be constructed by cutting together the targets section of the first one, with the outcome section of the second one.  In this example we will make an ability which stuns all adjacent characters on a hit.
 
==Create the targets section==
The targets section creates roles.  In an encounter, roles are speaking roles, that is they are characters who appear in the comic with dialogIn a combat effect, role is a more generic term which can refer to a tile as well.  Assuming you have chosen an existing ability with the same type of targeting, it may not be necessary to make changes to the targets section; paste from the existing monster ability.  Typical targets include targetTile, self, and the generic "target".  After some editing, here is the targets section of the new ability.  This author cannot explain every field; details may be available in the [[Effects]] and [[Outcomes]] pages.
 
[[File:ModdingMonsterTargets.PNG]]
 
Here is the corresponding json code.


<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
"targets": [
"tracks": [
{
{
"template": "SELF",
"name": "track_gorgon_deer",
"cost": { "class": "ActionPoints", "actionPoints": "attack" },
"advanceWeight": 1.4,
"missionFeedback": { "orientTo": "target" }
"cards": [
["gorgon_roe"],
["gorgon_roe", "gorgon_roe"],
["gorgon_roe", "gorgon_roe", "gorgon_roe"]
]
},
},
{
{
"template": "ADJACENT_ENEMY",
"name": "track_gorgon_raccoon",
"showAnyway": true,
"cards": [
"alwaysSelect": true,
["gorgon_coon"],
"aspects": [ "HOSTILE_TARGET", "alive" ],
["gorgon_coon", "gorgon_coon"]
"range": "1.6+self.BONUS_RANGE",
]
"lineOfSight": "LIVE_FIGURES"
},
},
{
{
"role": "targetTile",
"name": "track_gorgon_bear",
"template": "TILE",
"onlyIfFlavorHasCards": 4,
"missionFeedback": {
"cards": [
"rangeFeedback": "FRIENDLY_EFFECT_RANGE",
["gorgon_gheist"]
"suggestionFeedback": "FRIENDLY_EFFECT_SUGGESTION",
]
"hoverFeedback": "FRIENDLY_EFFECT_HOVER",
"applyRoleFootprint": "target"
},
"pathFrom": "self",
"pathTo": "target",
"matchSpecial": "knockBackDestination",
"relativeTo": "target",
"range": "2",
"lineOfSight": "ANY_COVER",
"tileFilter": "parentLocationOrValidMoveEnd",
"roleMustFit": "target"
},
{
"role": "target2",
"template": "ADJACENT_ENEMY",
"choose": "ANY",
"missionFeedback": null,
"aspects": [ "HOSTILE_TARGET", "alive" ],
"range": "max(1.6,weapon.weaponMaxRange)+self.BONUS_RANGE",
"lineOfSight": "LIVE_FIGURES"
}
}
]
]
</syntaxhighlight>
</syntaxhighlight>
There are several important points.
<ol>
<li>Smaller monsters will eventually appear in packs.  For example, the Roe will initially appear in groups of one, but later it may appear in groups of up to three.  In game, you will see monster cards like "Gorgon Roe II", where the roman II means that two of these monsters appear at once; this corresponds to the second entry in the cards array which lists two.  It is certainly possible to have different monster types in the same card entry.  This could be a little confusing since only one image appears to the player.</li>
<li>Some monsters are prevented from appearing early in the game, by the entry "onlyIfFlavorHasCards".  For example, the bear will only appear, after the calamities column for this faction has at least four cards.  Calamity cards are added at different points during the game, and sometimes subtracted in the chapter interval.  This roughly measures your progress through the game.  For monsters which can appear at the beginning, don't place any value; for more advanced monsters, use increasing numbers.  It's unlikely that as many as 10 calamities will appear for the faction, so numbers in the range 4-8 are probably best.</li>
<li>For the introductory mission, only the first two tracks can be selected.  Place your most "introductory" monsters here.  In addition to onlyIfFlavorHasCards, there are some rules in the game engine about introducing new monsters slowly.</li>
</ol>
Remove all the tracks for the old faction monsters, and add one track for each of your own monsters.  You should decide which monsters should have "packs" by multiple card entries, and use onlyIfFlavorCards to roughly set the order in which monsters will be introduced.


==Create the outcomes section==
For each track, you will also need to add a display name which appears as the title of the calamity card.  You can set this in assets/text/dynamic/dynamic.properties:
The outcomes section uses the roles in the targets section, and does something. It determines hit chances and applies damage or aspects to the targets who are hit. As mentioned above, this author is not yet an expert on all the things that can be done; but it is possible to make new effects by copying related sections from other outcomes sections. In this case, the stun effect is applied by other weapons and its name is "senseless".  The outcomes section of the in-game editor is very tall because of all the possible optional fields, but this screenshot shows the most important part
<pre>
 
yab_dagger.name=Brigand
[[File:ModdingMonsterOutcomes.PNG]]
yab_dagger.blurb=All daggers, and all out of targets- until now.
monsterCardName.track_yab_dagger=Brigand
monsterCardBlurb.track_yab_dagger=All daggers, and all out of targets- until now.
</pre>
The first two lines give the name and description of the monster; the second two lines give the name and description of the calamity card.  I happen to have used the same text for both.


==Seeing the effect in game==
==Seeing the effect in game==
# If you haven't already done so, enable developer mode.  (Save and exit before doing this.)  In file explorer, create an empty file under steam\steamapps\common\Wildermyth called devmode.txt.
# If you haven't already done so, enable developer mode.  (Save and exit before doing this.)  In file explorer, create an empty file under steam\steamapps\common\Wildermyth called devmode.txt.
# Choose tools from the game main menu, then select combat lab.  This will give you a chessboard-like battle map with a few characters and monsters already spawned.
# Start a new game, make sure that your faction is the "main enemy", and enable the cheats such as "objective cheat".
# In the "Generate a unit" dropdown at the left, choose "Davea's monster" and then click Side A.  Your monster should appear:
# In the introductory battle, exactly one monster drawn from your first two tracks should appear.
 
# Use the objective cheat to win the first battle; you can add more calamity cards using the cheat menu to make sure that your monster types are appropriate.
[[File:ModdingMonsterPickMe.PNG]]


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

Latest revision as of 12:01, 2 July 2020

This page walks through the process of replacing all the monsters in a faction. 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 July 2020, early access version 0.23+148 Triss Thornfire.

Main concept

Today, modders cannot add factions. The game is hard-coded with five factions. But, you can replace all the monsters in a faction and change the name. Why would you do this, instead of just adding new monsters without factions? Because of calamities. In other games, you can make a large "family" of monsters with stronger and stronger abilities, and use an "encounter table" that maps the party's power level against the monster types. So, low level parties will encounter easy monsters and high level parties will encounter hard monsters. In Wildermyth, for the most part, low and high level parties encounter the same monsters; but calamities make the monsters stronger or add special effects. Hopefully, this makes encounters interesting for parties of all levels automatically.

If you want to add one monster for one event, you can do that, but you can't really tune it to be an interesting encounter for both a low level party and high level party. It's better to redefine a faction, and use the calamity system to make the monsters stronger as the party grows stronger.

Here are the steps to replacing a faction.

  1. Add monsters. The basics of adding monsters are described in this tutorial: Adding a monster. Most factions have 5-9 different monsters.
  2. Change the faction name. This has some limitations; As of today, your name won't show up everywhere, and there are some images you can't change.
  3. Update the calamities.
  4. Add the "tracks" for generating monsters.

Change the faction name

The file assets/text/dynamic/dynamic.properties contains the faction name. Change this to override the name in most places. For example, to rename Drauven as Bandits:

drauven.singular=Bandit
drauven.plural=Bandits
drauven.name=Bandits

Currently there are at least two places this change won't affect. When you create a campaign using your modified faction, you will often "lock" the campaign to one enemy; for example, the builtin campaign "Enduring War" locks the main enemy to Morthagi. In the "new story" dialog field for "main enemy", the old name like Drauven will still appear. Also, in the page which displays calamities, there is currently no way to change the small image that appears at the top of the column, circled in red below. All the bandit calamities will still appear under the header which is an image of a drauven.

MonsterReplaceCalamity.png

Update the calamities

All of the calamities are listed in the file assets/data/calamity/calamities.json. Today, there is no way to "merge" calamities between different mods. So, if it happens that two mods change this file, the file from the mod with higher priority will take effect, and the other files with this name will be ignored. The file contains all the calamities, one after the other, for all the factions. Each calamity looks like this:

{
	"weight": 0.35,
	"card": {
		"id": "buff_yab_dagger_GAINS_armor",
		"category": "buffMonster",
		"flavor": "drauven",
		"monsterIds": [ "yab_dagger" ],
		"aspects": [ "calamityBuffMonster_armor" ]
	}
}

The key is to find all the calamities in the file where "flavor" matches the faction you are replacing, which may be scattered around in the existing file. As you will see, there are 3 basic types: GAINS_armor, GAINS_health, GAINS_damage; GAINS_range is no longer used and always has "weight:0" to prevent it from appearing. There are also several faction specific types, like GAIN_imposeConcuss and GAINS_imposeMindworm. Later, you could add your own aspects as described elsewhere on the wiki.

For now, add the three basic calamities for each of your monster types. It may be easier to do this using cut and paste in a text editor.

If you accidentally leave some monsterIds which refer to the monsters you removed, then the player may see these calamity cards appear, even though the monsters they refer to will never appear.

Add tracks

The tracks section is similar to the "encounter table" you may find in other games. The related file is: assets/data/generation/monsterDecks.json. As with the calamity file, only the file from the highest priority mod is currently used. Each of the five factions appears in its own "groupFlavor" section, and each monster has its own entry in the "tracks" section. Here is a section of the monsterDecks file for Gorgons.

"tracks": [
	{
		"name": "track_gorgon_deer",
		"advanceWeight": 1.4,
		"cards": [
			["gorgon_roe"],
			["gorgon_roe", "gorgon_roe"],
			["gorgon_roe", "gorgon_roe", "gorgon_roe"]
		]
	},
	{
		"name": "track_gorgon_raccoon",
		"cards": [
			["gorgon_coon"],
			["gorgon_coon", "gorgon_coon"]
		]
	},
	{
		"name": "track_gorgon_bear",
		"onlyIfFlavorHasCards": 4,
		"cards": [
			["gorgon_gheist"]
		]
	}
]

There are several important points.

  1. Smaller monsters will eventually appear in packs. For example, the Roe will initially appear in groups of one, but later it may appear in groups of up to three. In game, you will see monster cards like "Gorgon Roe II", where the roman II means that two of these monsters appear at once; this corresponds to the second entry in the cards array which lists two. It is certainly possible to have different monster types in the same card entry. This could be a little confusing since only one image appears to the player.
  2. Some monsters are prevented from appearing early in the game, by the entry "onlyIfFlavorHasCards". For example, the bear will only appear, after the calamities column for this faction has at least four cards. Calamity cards are added at different points during the game, and sometimes subtracted in the chapter interval. This roughly measures your progress through the game. For monsters which can appear at the beginning, don't place any value; for more advanced monsters, use increasing numbers. It's unlikely that as many as 10 calamities will appear for the faction, so numbers in the range 4-8 are probably best.
  3. For the introductory mission, only the first two tracks can be selected. Place your most "introductory" monsters here. In addition to onlyIfFlavorHasCards, there are some rules in the game engine about introducing new monsters slowly.

Remove all the tracks for the old faction monsters, and add one track for each of your own monsters. You should decide which monsters should have "packs" by multiple card entries, and use onlyIfFlavorCards to roughly set the order in which monsters will be introduced.

For each track, you will also need to add a display name which appears as the title of the calamity card. You can set this in assets/text/dynamic/dynamic.properties:

yab_dagger.name=Brigand
yab_dagger.blurb=All daggers, and all out of targets- until now.
monsterCardName.track_yab_dagger=Brigand
monsterCardBlurb.track_yab_dagger=All daggers, and all out of targets- until now.

The first two lines give the name and description of the monster; the second two lines give the name and description of the calamity card. I happen to have used the same text for both.

Seeing the effect in game

  1. If you haven't already done so, enable developer mode. (Save and exit before doing this.) In file explorer, create an empty file under steam\steamapps\common\Wildermyth called devmode.txt.
  2. Start a new game, make sure that your faction is the "main enemy", and enable the cheats such as "objective cheat".
  3. In the introductory battle, exactly one monster drawn from your first two tracks should appear.
  4. Use the objective cheat to win the first battle; you can add more calamity cards using the cheat menu to make sure that your monster types are appropriate.