Modding monster abilities

From Wildermyth Wiki

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.

Preparation

This guide builds on the previous guide Adding a monster. You can also find the files created during that guide in a learning mod on steam workshop: Oh no a dragon. If it is helpful, you can start from that mod as described in Using an existing mod as a starting point.

Main concept

Monsters have a list of aspects; each aspect allows them to do one thing. Some 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 effect. We'll add a simple aspect, add this to the monster, add the related effect, and then most of the work is in the effect. It's easiest to add a new ability which is a simple modification of an existing monster ability, weapon ability, or character class ability. You can view monster abilities using the in-game editor; choose "monsters (ctr+7)" in the top dropdown.

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:

[
{
	"modId": "lewe",
	"id": "lewe_stun_lord",
	"effects": [ "lewe_stun_lord" ],
	"importance": -1,
}
]

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.

Add the aspect to the monster

You can use the in-game editor, or a text editor. Using 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.

ModdingMonsterAspect.PNG

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.

Create the effect

Effects can be very complicated, and this author doesn't understand all the details yet. In 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 details. Monster 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 dialog. In 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.

ModdingMonsterTargets.PNG

Here is the corresponding json code.

"targets": [
	{
		"template": "SELF",
		"cost": { "class": "ActionPoints", "actionPoints": "attack" },
		"missionFeedback": { "orientTo": "target" }
	},
	{
		"template": "ADJACENT_ENEMY",
		"showAnyway": true,
		"alwaysSelect": true,
		"aspects": [ "HOSTILE_TARGET", "alive" ],
		"range": "1.6+self.BONUS_RANGE",
		"lineOfSight": "LIVE_FIGURES"
	},
	{
		"role": "targetTile",
		"template": "TILE",
		"missionFeedback": {
			"rangeFeedback": "FRIENDLY_EFFECT_RANGE",
			"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"
	}
]

Create the outcomes section

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

ModdingMonsterOutcomes.PNG

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. 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.
  3. In the "Generate a unit" dropdown at the left, choose "Davea's monster" and then click Side A. Your monster should appear:

ModdingMonsterPickMe.PNG