Part 1: Getting Started.

Users who are viewing this thread

Status
Not open for further replies.
1.1 What is the Module System?
The Mount&Blade Module System is a set of python scripts that lets you create and/or modify content for Mount&Blade. This is actually the system we are using for working on the content of the official version. Using the module system, you can do things like adding new troop types, new characters, new quests, new dialogs, etc., or you can edit the existing content.

It is important to note that Mount&Blade does not use Python and does not read the Module System python scripts directly. Rather, the python scripts are executed to create the text files that Mount&Blade reads.

Mount&Blade actually reads its content from text files under the Mount&Blade/Modules folder.  Thus, *in theory* you can do all the modifications you'd like to do by editing these text files. (Indeed, some modders had worked out how to use these files and were able to create amazing mods by themselves.) However the text files are not really human-readable and are very impractical to work with. There are currently two options for writing new modules. The first is the official module system described in this document. The other is Effidian's unofficial editor which is currently discontinued and unusable for the current version -  v.1.011, but works for older versions of M&B, such as v.7.51 .

1.2 Requirements for using the Module System

The module system consists of Python scripts, and as such, you need to have Python installed on your system to be able to work with them. You can download Python from Python.org's download page:
http://www.python.org/download/
There are more than a few downloads on that page. However you'll only need version 2.6 or 2.4 for Windows.

After you download and install Python, you'll also need to add Python to your path enviroment variable. This is important, so try to be exact when you make these changes.

For Windows 9x systems, you can edit autoexec.bat file and add your python folder to the Path. For example if Python is installed under C:\Python24, add the following line:
set PATH=C:\Python24;%PATH%

If you have a Windows XP or a Windows Vista system, this operation is slightly different: Right-click on My Computer (Computer in the start menu for Vista users) select 'Properties', click on the 'Advanced' tab and then click on 'Enviroment Variables':

modulesystemjl4.jpg


1. Scroll down on the 'System variables' until you find the 'Path' variable.

2. Click on the 'Edit...' button, a new window should pop up:

modulesystem2ua4.jpg


Scroll to the end of the 'Variable value' and add ";C:\Python26".

Click ok on this box, then ok again on the next box.

1.3 Obtaining the Module System
The latest version of the Module System can be downloaded from the links listed here:

http://forums.taleworlds.com/index.php/topic,111706.0.html

You'll need to download the zip file for the module system and extract it (requring a program such as WinRAR, or 7-zip). Extract the Module System wherever it is easy to locate, e.g, the Desktop or My Documents.

1.4 Module Sytem Files

Now, let's have a look at the files in the module system. When we look at the actual Python files (files that end with .py) we see that there are actually four kinds of files:

    * files that start with header_
    * files that start with process_
    * files that start with ID_
    * files that start with module_

The first two kinds of files are necessary for running the module system. You shouldn't modify these at all. The third kind of files (ID_) are temporary files created while building the module. You can delete them if you like and the module system will generate them again. The final kind of files (module_) are actually the files that contain the content data. These are the files you will be modifying.


1.5 Creating a new module


Before going any further, let's first create a folder for your new module. For this, we need to go to the Mount&Blade/Modules folder (by default this is at "c:/Program Files/Mount&Blade/Modules") Now, under the Modules folder there should be a folder named Native. This is, so to speak, the official module. For your own module, you must create a new folder here, and copy the files from Native to the new folder. This new folder will be your own module folder so name it as you like. For the sake of simplicity, I am assuming it is named MyNewModule

You can test if you have done this right by launching Mount&Blade. Now, Mount&Blade's launch window should show a combo box, which lets you select the module you'd like to play. Now, try selecting your new module and starting a new game. Since we copied the contents of the native folder for our new module, the game we play now will be identical to the native game.

Next, we must make the Module System use the new folder as its target. To do that, open the file module_info.py for editing (Right click on the file and select "Edit with IDLE"; or open the file with Notepad or your preferred text editor) and change export_dir to point to your new folder. For example, if the folder for your module is: c:/Program Files/Mount&Blade/Modules/MyNewModule  You should change this line as follows:

export_dir = "C:/Program Files/Mount&Blade/Modules/MyNewModule/"

Now our module system setup should be ready. To try it out, remove the file conversation.txt inside our new module folder, and then double click on build_module.bat. You should see a command prompt with some output like this:


Code:
Initializing...
Compiling all global variables...
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Exporting map icons...
Creating new tag_uses.txt file...
Creating new quick_strings.txt file...
Exporting faction data...
Exporting item data...
Exporting scene data...
Exporting troops data
Exporting particle data...
Exporting scene props...
Exporting tableau materials data...
Exporting presentations...
Exporting party_template data...
Exporting parties
Exporting quest data...
Exporting scripts...
Exporting mission_template data...
Exporting game menus data...
exporting simple triggers...
exporting triggers...
exporting dialogs...
Checking global variable usages...

______________________________

Script processing has ended.
Press any key to exit. . .


If you ran into an error, make sure you've followed all the steps of this tutorial exactly, and if you think you have, please use the Search function on the forums; chances are someone has already run into the same problem and an easy solution has already been posted.

If not, congratulations! You're all set up to create your own mod with the M&B module system. Now let's move on to Part 2.


Thanks to Buxton for the update!
 
Status
Not open for further replies.
Back
Top Bottom