Basic Modding Tutorial 1

From 7 Days to Die Wiki
Jump to: navigation, search
Some items' or groups' chance to drop changes according to the player's gamestage. Here you can see those values for any gamestage you want using the little box below. Just type the gamestage you want in the box and press the Apply!-button. The values should change immediately, if the chance is different.

Current game stage: 1

Introduction[edit | edit source]

In this section we will go over creating a very basic mod for 7 Days to Die (Alpha 19). It will be the simplest type of mod, which simply modifies some of the parameters of existing game objects.

Specifically, we will make the nice wooden doors found on prefabs available as craftable items for the player.

Files and Folder Structure[edit | edit source]

To begin with, we will need some very specific folders and files for our mod.

1. First we need the root folder of the mod. I'm just going to create a folder called "MoreDoors".

2. Within that folder, create a subfolder called "config". This is where the actual configuration files will go. This is the only subfolder we need, because for this mod we are not adding any new assets to the game, just modifying existing assets.

3. Now create a new text file called "ModInfo.xml" in the root of MoreDoors.

4. Create three (3) text files in the config folder, called: blocks.xml, Localization.xml, and recipes.xml.

That's all we need for this simple mod. I'll explain the use of each file as we continue. Your folder structure should look like this:

MoreDoors
    \config
        \blocks.xml
        \Localization.txt
        \recipes.xml
    \ModInfo.xml

Using Xpath[edit | edit source]

Before we go further, I want to talk a little bit about xpath.

What is Xpath?[edit | edit source]

Xpath is a way of finding information in xml files, and modifying values in those xml files. In the context of our 7 Days to Die mod, it will allow us to change some of the parameters set by the main game, when the game loads up.

Xpath uses a very specific syntax, which I'm not going to document here. (See: XPath Explained) But to help understand it, think of an XML file as almost being like a folder structure in your computer's file system.

You can have items that contain subitems, and value assignments. For example, a <block> item can have a bunch of attributes under it, which you could think of like:

\block\attribute

Xpath uses that sort of syntax for finding, adding, removing, and changing attributes of things in the game.

You can easily google for more assistance on using Xpath.

Modinfo.xml[edit | edit source]

This file is required by the game to even load your mod at all, and contains just some basic parameters. It's easiest to simply show you an example, which is the one I created for my MoreDoors mod: (NOTE: There is actually an extra line that needs to be at the beginning of the file, but the editor thinks that this is a "Link in Non-wiki Syntax" so it won't let me put it in here...)

<xml>
	<ModInfo>
		<Name value="More Doors" />
		<Description value="Adds more doors to craft." />
		<Author value="IcebergTitanic" />
		<Version value="1.3" />
	</ModInfo>
</xml>

You can put whatever you want in there, to be honest. It's mostly to help document the mod.