Modding guide/Example

This page shows how to create a basic mod. It explains how to make a simple item, a recipe and how to export your mod. This guide assumes you have already set up the modding tool as explained in the Modding guide

Let's make a blue apple, a health-damaging food by injecting zombie jelly into apples.

## Getting started

First, you need to create a folder for your mod. Assuming you have already set up the modding tool as explained in the Modding guide, right-click the resources folder and press create -> folder

Give the folder the name of your mod, in this case blueapple.

Open the folder in explorer by right-clicking the folder and clicking 'show in explorer'

Now you can start adding files to the folder, starting with the icon of the item you will create. In this case, we will change the color of the apple icon. You can open the apple icon image by locating it in the json editor and right-clicking it selecting 'open in explorer'

Now that you have located the apple icon, use your favorite image-editing tool to change the color. Alternatively, you can download the blueapple icon image in this link. Save the image file in the mod folder you created earlier.

Next we will create the preview image. For this example, open the blueapple image you created earlier and make it 3x bigger and save it as preview.jpg in your mod folder. You should now see the two image files in your mod folder. Unity will create a .meta file for every file you create. You can ignore these for now.

Next, you need to create a json file that will contain your mod data. Go to your mod folder and create a new text file:

Open the text file and put the following inside:

```
{
 "mod id": "core",
 "data": [
   {

   }
 ]
}

```

Save the text file. Next, rename the text file to mod\_blueapple.json. make sure you have 'show file extensions' turned on in your windows explorer settings. When windows asks you if you want to change the file extension, click yes.

Now you have the following files in your mod folder (ignoring the .meta files):

To summarize, you make a folder in the resource folder of the unity project and give it the name of your mod (your mod folder needs to be inside the resources folder to be recognized by the tool later when you export your mod). You create the three files pictured above. the preview.jpg file in your mod folder should not be renamed or moved since you need it to generate and upload your mod later.

If your newly created files don't show up in the unity editor, go to the search bar in the project tab and search for 'refresh'. Then doubleclick on the Refresh\_JSON\_Scene file and click on play. Wait until the play button turns blue and press it again. Observe the following gif:

Depending on your system, refreshing may take a long time. Keep in mind that this will refresh all the files, so be sure to save your work before doing that. You can save your edited files by pressing the 'Save this JSON file' button in the JSON the JSON\_Editor.

## Making items

Let's officially start modding now. Detailed information on each item can be found in Modding guide/Item. If you created the files and refeshed your JSON\_Editor as described above, you will be able to select your mod\_blueapple json file below 'Select JSON file'. Go ahead and select it. Then, item\_Data from the dropdown menu (next to 'Element type').

Click 'Add new element' to start working.

Let's fill out the data step by step according to the direction we planned.

* The **item icon sprite** can be changed by dragging the blueapple icon you prepared before from the resources\blueapple folder onto the item icon slot in the editor.
* The **ID** is a unique name for the item, so it's a good idea to set it as something that may not be used elsewhere and you can clearly see what it is. It will only be seen on the editor, which is not usually revealed on the game.

* Unlike ID, **Name** is a name that represents in the game. Unlike the ID, duplicate is possible.

* **Description** is an explanation of items in the game. It doesn't matter if you write it or not, but it's a good place to inform the player about what the item is and does, so a well-written description helps the player.

Name and Description can be written in each language. If the setting is set in a specific language but the language part is empty, the written text is automatically output toward the language where it exists.

The icon used a pre-prepared image. It doesn't matter if you use the existing icon as it is, import and edit it, or make it from scratch. However, the editor of Nearly Dead does not provide a separate image editing tool, so please use a different image editing tool.

Next, fill in the basic item properties. For a description of each property, see Modding guide/items. For convenience, let's use the original apple item data. When you start making more items in the future, you can use features like 'duplicate this element' to quickly make new items and just change the properties to what you need. You can also look at existing items to see what in-game effects the properties have, since you are already familiar with some of the items.

Next, define the food properties. Under 'item type', select 'food'. A new list of properties becomes visible. Let's use the original apple as an example and go from there. There's an increased expiration date and it hurts when you eat it, so you feel bad. The other properties can use the same values as the original apple (see example below).

Scroll down to see 'Set consume effect'. Set the Consume Effect Type to 'Mod\_condition' and click on 'Add consume effect'

You need four effects, so click 'Add consume effect' 4 times to make a list of 4 effects. Next we'll change the properties of the effects. Let's cut thirst and hunger effect more than before, increase mental strength, and add additional effect to reduce physical strength.

Lastly, let's put the grotesque item along with the fruit in the **Set flavor** data. Because you put the zombie jelly in it (well, you will, in the recipe in the next section of this guide).

Save it by clicking the 'Save this json file' at the top of the editor, and you're done making the blue apple item.

## Make a recipe

You can make this completed item appear in the game as it is (using the wish menu in-game), but let's go a little further and make it real, through the recipe.
This time, at the top of the editor, let's select the 'Element Type' as 'Item\_Recipe' and add new element to start working.

Likewise, detailed information on each item can be found in the Modding guide/Recipe.

* The ID of the recipe may be the same as the ID of the item (but is not required). So let's use the ID of the blue apple as it is.
* The same goes for the name.

First, we set the basic recipe properties (see example below). Be sure to check 'is autolearn' and set the skill type to chemistry and set the skill level to 1. This will make sure you know the recipe when your chemistry level is one.

Let's fill in the blue apple as the result. Go to 'Set recipe result' and click 'Add new'. It's a simple caft so it won't give any skill experience.

Since you learn the recepe automatically at chemistry one, we will also set the production skill as level 1 chemisry under 'Set skill difficulty'. Next, under 'Set recipe component', add one apple and two zombie\_jelly. Since we need an injection, let's designate a blank\_syringe as a non-consumption item.

There are many factors related to balance, such as the difference between the recipe level for learning it and the skill level for make it. Adjusting the balance is up to Modder, but in most cases, good mods incorporate consideration of this balance.
Finally, let's change the stats consumed during crafting. Let's make a small amount of mental strength is used to express that you're nauseous by making a strange unknown thing yourself.

Save it too, and the recipe is done.

## Export as Mod

In order to actually apply and use this completed mod, additional steps are required.

Press 'Generate Mod' at the top of the JSON\_Editor. A file explorer window appears. Select your mod folder and press 'select folder'.

Write the name, description, and changes of the mod, set the visibility to private\_on if you don't want it so show up for other users on the steam workshop later, and press the Generate meta.json button at the bottom left to successfully create a meta.json file for that mode.

Finally, put your mod folder into C:\Program Files (x86)\Steam\steamapps\common\Nearly Dead\Nearly Dead\_Data\Mods\. If this folder does not exist, create it. When you put your mod folder in the \mods\ folder, it will look like this: C:\Program Files (x86)\Steam\steamapps\common\Nearly Dead\Nearly Dead\_Data\Mods\blueapple\

Now start the game and test your mod. Note that the mod will not show up in the 'mod manager' from the main menu but it will still be enabled in-game as long as the mod is in the \mods\ folder.

To upload your mod, the process is similar to generating your mod. Click on 'upload your mod', select your mod folder and fill in the form. Make sure the 'Visibility' is set to 'Public\_publis' if you want everyone to be able to download your mod from the steam workshop. Next, press upload and wait! A prompt will appear telling you it was a success. Make sure you have been logged into steam while pressing upload

After a **few minutes**, it will appear on the steam workshop. Be sure to change the title and description:

You can also change the visibility to private or public afterwards.
The result mod can be download in this link.