Difference between revisions of "Modding add monster"

From Wildermyth Wiki
(Created page with "This page is a work in progress. It will walk through the process of adding a new monster with a custom image. The focus is on getting something simple which you can see in...")
 
 
(6 intermediate revisions by one other user not shown)
Line 1: Line 1:
This page is a work in progress.  It will walk through the process of adding a new monster with a custom image.  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 November 2019, early access version 0.10+98 Ryvio Wartmarch.   
This page walks through the process of adding a new monster with a custom image.  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 November 2019, early access version 0.10+98 Ryvio Wartmarch.   
 
==Preparation==
Before you begin, create or find an image file for your monster.  It should be a few hundred pixels in each dimension (not tens, and not thousands) and should have a transparent background.  Please be sure it does not have any copyright restrictions, that is, the image should be one you drew, or one which is clearly public domain.  We will use this guy:
 
[[File:ModdingMonsterRedDragon.PNG]]


==Getting started==
==Getting started==
Line 9: Line 14:
<ol>
<ol>
<li>Using a file explorer, navigate to the game install directory: steam\steamapps\common\Wildermyth\assets.  We need to copy (not move!) several files from there to your mod directory.  For each file when it is mentioned below, create folders in your mod as needed and copy, and then modify.  These files are program source code and proper syntax is very important.
<li>Using a file explorer, navigate to the game install directory: steam\steamapps\common\Wildermyth\assets.  We need to copy (not move!) several files from there to your mod directory.  For each file when it is mentioned below, create folders in your mod as needed and copy, and then modify.  These files are program source code and proper syntax is very important.
<li>Add new aspects (effects).  Copy and modify file data\aspects\items.json.  This will contain the bonuses that your items give.  You can search in the original file for ideas.  For this project, delete all the text and paste the following lines.  This adds two effects, +10 block and +1 armor.
<syntaxhighlight lang="json">
[
{
"id": "daveaShieldBlockBonus",
"stats": { "BLOCK": 10 }
},
{
"id": "daveaShieldArmorBonus",
"stats": { "ARMOR": 1 }
}
]</syntaxhighlight>
<li>'''It is very important to delete all the other lines in the file.'''  Your declarations of these items will override what is in the original game files.  This prevents the developers from fixing bugs!  For example, suppose you leave behind the definition of an item; and the developers change that item to fix a bug or improve balancing.  Your mod loads with higher priority than the game's original files.  So your incorrect definition loads with higher priority than the developers' new and improved definition.  Players using your mod will not see this bug fix, and it will be very confusing to debug!
<li>I also recommend that all the items and effects you add should start with a unique prefix.  I have used "davea".  This helps in keeping all your items together, filtering to find your items, and distinguishing items added by one mod versus another.
<li>Add the description for the aspects.  Copy and modify file text\aspects\aspects.properties.  Delete all the text and add these lines:
<br><code>
<nowiki>#</nowiki>suppress inspection "UnusedProperty" for whole file
<br>daveaShieldBlockBonus.blurb=davea effect shield block blurb
<br>daveaShieldArmorBonus.blurb=davea effect shield armor blurb
</code>


<li>Add the new item.  Copy and modify file data\items\offHand.json.  You can search in the original file for ideasFor this project, delete all the text and paste the following lines.  This adds a shield which uses an existing image from the game, but gives the new shield effects created above.
<li>Add the monster definition.  Copy file data\monsters\animal_goat.json, and call the new file davea_monster1.jsonOn the line where the image is shown, change to misc/davea_monster1:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
[
"skin": [
{
{
"id": "daveaShield1",
"image": [ "misc/davea_monster1" ]
"tier": 1,
"category": "offHand",
"slots": ["OFF_HAND"],
"ownerAspects": [
"daveaShield1",
"daveaShieldArmorBonus",
"daveaShieldBlockBonus"
],
"cost": ["1 ingot", "2 heartwood"],
"layers": [
{"name": "augment_shieldCaveA_tint1", "depth": 6100, "tint": "primary", "tintAmount": 1.0},
{"name": "augment_shieldCaveB_untinted", "depth": 6101}
]
}
}
]
]
</syntaxhighlight>
</syntaxhighlight>
<li>Copy the image file to figures\misc\davea_monster1.png.  (Filenames appear to be case sensitive, davea_monster1.PNG appears to not work.)
<li>Add the name and blurb for the item.  Copy and modify file text\dynamic\dynamic.properties.  Delete all the text and add these lines:
<li>Add the name and blurb for the item.  Copy and modify file text\dynamic\dynamic.properties.  Delete all the text and add these lines:
<br><code>
<br><code>
<nowiki>#</nowiki>suppress inspection "UnusedProperty" for whole file
<nowiki>#</nowiki>suppress inspection "UnusedProperty" for whole file
<br>item.daveaShield1=Davea's shield name
<br>davea_monster1.name=Davea's monster
<br>itemSummary.daveaShield1=Davea's shield summary
<br>davea_monster1.blurb=Davea's monster's blurb
</code>
</code>
<li>Later, you can look at other monsters in the source directory and change the monster's abilities, health and difficulty scaling to suit.
</ol>
</ol>


==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.
# Start a new one chapter story.  Choose your mod in the mod picklist, and check "enable cheats"You don't need to select any of the sub-options under cheats for this project.
# Choose tools from the game main menu, then select combat labThis will give you a chessboard-like battle map with a few characters and monsters already spawned.
# When the game starts, click through the initial encounter to get to the first battle.
# In the "Generate a unit" dropdown at the left, choose "Davea's monster" and then click Side AYour monster should appear:
# Pick one of your characters, open the detail view, and click the gear tab.  You will see a cheat menu that allows you to select any kind of item and add it.  Select offhand, select your new item in the popup, and clock add item to add itYou will see the name at the top and the summary at the right.  Try it out in combat!
[[File:ModdingMonsterPickMe.PNG]]
[[File:ModdingItemPickMe.PNG]]


==Adding a user created image==
[[Category:Modding]]
<ol>
[[Category:Modding Guides]]
<li>Now let's add a sword with a custom image.  Copy and modify file figures\images\human\items\item_sword_night.png using your favorite photo editor.  For example, I made a yellow version and named it item_sword_davea1.png.
<li>Add the following to your existing offHand.json.  This is a copy of the definition of the nightshard sword with my image replaced.  I don't know what the grip, etc fields mean but I suppose they relate the geometry of the sword to the geometry of the character's hand.  The filename offHand.json doesn't matter, the game reads all the json files in your directory.  It could be called "davea.json".
<syntaxhighlight lang="json">
{
"id": "daveaSword1",
"tier": 1,
"category": "sword",
"tracks": ["medium"],
"slots": ["MAIN_HAND"],
"aspects": ["weapon", "melee", "weaponDamage:7", "weaponWield:3", "weaponMaxRange:1.6", "swordAccuracyBonus|5"],
"ownerAspects": ["attackRange|0|1.6|melee", "weaponAttack_basicMelee", "voiceSword", "swordBlockBonus|10"],
"layers": [
{
"name": "item_sword_davea1",
"grip": "mainHand",
"inactiveGrip": "highBack",
"rigUsage": "rigGeneral",
"gripOffset": {"x": 57, "y": 147},
"scaleX": 0.5, "scaleY": 0.5
}
],
"canBeCrafted": false,
"generateName": false,
"onlySpawnById": true
}
</syntaxhighlight>
<li>Proper json syntax is important.  If you have put this into the same file as the previous definition of the shield, you will need a comma in between the definitions, but no comma after the last definition.  This is easier if you are using a text editor with language highlighting.  I have not yet experimented with files having incorrect syntax, but it will probably result in the mod failing to load, possibly preventing the game from even starting.
<li>Add the name text into your existing file text\dynamic\dynamic.properties:
<br><code>
item.daveaSword1=Davea's sword name
<br>itemSummary.daveaSword1=Davea's sword summary
</code>
<li>Test in-game as shown above.
</ol>
[[File:ModdingItemYellowSword.PNG]]

Latest revision as of 21:09, 4 December 2019

This page walks through the process of adding a new monster with a custom image. 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 November 2019, early access version 0.10+98 Ryvio Wartmarch.

Preparation

Before you begin, create or find an image file for your monster. It should be a few hundred pixels in each dimension (not tens, and not thousands) and should have a transparent background. Please be sure it does not have any copyright restrictions, that is, the image should be one you drew, or one which is clearly public domain. We will use this guy:

ModdingMonsterRedDragon.PNG

Getting started

  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. This will pop up a file browser showing the files the tool just created; note that the directory is steam\steamapps\common\wildermyth\mods\user\<your mod name>. You will use this directory soon.
  3. Click the "save" button and then exit. Most of the work for this mod is done outside the in-game editor; the editor doesn't appear to support creating monsters yet.

Modifying the files

  1. Using a file explorer, navigate to the game install directory: steam\steamapps\common\Wildermyth\assets. We need to copy (not move!) several files from there to your mod directory. For each file when it is mentioned below, create folders in your mod as needed and copy, and then modify. These files are program source code and proper syntax is very important.
  2. Add the monster definition. Copy file data\monsters\animal_goat.json, and call the new file davea_monster1.json. On the line where the image is shown, change to misc/davea_monster1:
    "skin": [
    	{
    		"image": [ "misc/davea_monster1" ]
    	}
    ]
    
  3. Copy the image file to figures\misc\davea_monster1.png. (Filenames appear to be case sensitive, davea_monster1.PNG appears to not work.)
  4. Add the name and blurb for the item. Copy and modify file text\dynamic\dynamic.properties. Delete all the text and add these lines:
    #suppress inspection "UnusedProperty" for whole file
    davea_monster1.name=Davea's monster
    davea_monster1.blurb=Davea's monster's blurb
  5. Later, you can look at other monsters in the source directory and change the monster's abilities, health and difficulty scaling to suit.

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