Author Topic: The Ultimate Introduction to Modding | Starting out? Read this!  (Read 148053 times)

0 Members and 1 Guest are viewing this topic.

Lumos

  • Probably Not a Help Desk
  • Moderator
  • *
  • Mens INsana in corpore sano
    • Steam - lumosx
    • YouTube - LumosX
    • View Profile
  • Faction: Nord
  • WBWF&SNWM&BVC
First of all, I decided to do this because of the large amount of new recruits that appeared on the forums recently, some of them who started posting tutorials which contained unclear, misinforming, or even plainly wrong information. Please read on below. I will do my best to thoroughly and understandably explain most of the things that could be on a new user's mind. To my fellow expert modders: If you find something incorrect in this post, just name it. I shall fix it at the moment of noticing.

The Ultimate Introduction to Modding.
Contains Real, Correct, Time- and User-Proven Information.
     By modders. For modders.



Why is this the "Real" tutorial?
Because it is written by a person with, at the moment of posting of this tutorial, over seven years of modding various games, most notably Mount&Blade and Warband (six years plus). I have the highest forum rank available (which actually means only that I've hung around here a lot :mrgreen:), and I have published a few OSP code packs, as well as creating a few stand-alone applications, dedicated to modding this game.

But in other tutorials people tell me to do things a bit differently...
They could tell you that the sky is pink with green dots.
This tutorial contains the information that has been passed on to the new modders in numerous posts and (mostly) long-lost forum threads. I'm giving you this information as I know it, and trust me, I've practised it long enough. Plus, if there are any errors in here, I won't try to defend my incorrect statements, but will make the corrections, so everyone can be sure that this here is 100% quality info.

OK, but this begins to look like a wall of text. I'm starting to not like it.
Suit yourself. This will be a wall of text, but I can assure you it won't be in vain. And I promise pictures. :)
Anyways, I'd recommend you grab an ice-cold beer/insert favourite beverage here, let some good music play in the background (if that helps your concentration - it surely helps mine!) and keep reading.
If you just want to know how to set your module up, skip the hidden section. It's full of theory.

(click to show/hide)

Are you finished with the theory? I want to start modding now.
Yes, I am. So, now let's start the modding. You want to setup a Module System, don't you? Well then, just go to the thread where we summarise downloads (found in this same board... or if you click here) and get yourself a fresh ModSys for your particular game of choice. (You're looking for the "Download Module System" section, can't miss it!)
Now. In order to be able to compile the files into game-readable text files, full of numbers and numbers and numbers, and to make your awesome mod come true, you need Python (the language). Having a real pet python might help, but don't count on it. Now, don't go rushing into downloading the latest Python. Here's something really important that you should know: The ModSys does NOT work with any Python newer than 2.x*. Fortunately, the same thread you've already got open also features a link to the Python website, so you've been saved a Googling; grab the latest 2.x.x version from there.
Now all you have to do is to install Python. Using Admin rights, please. Oh, it's a good idea to install it in its preferred C:\Python27 directory (if you're still using Python 2.7 in your day and age, oh reader from the future!).
Next up. Go to your Environment Variables to see if everything is OK. For those that don't know what Environment Variables are - well, these are OS things, which your Windows uses. You will only have interest in the "PATH" variable. Now open that window and get to business.
(click to show/hide)
(click to show/hide)
Scroll that list until you find the "Path", then click it and hit the "Edit" button down there. This Path variable is basically just a string of paths to certain things which are important for your OS. It's different on every computer.
In order for your compiler to work without any hacks or fixes, you must have your Python folder in your Path variable. For an example, if you did install your Python in C:\Python27, then you should add ;C:\Python27 at the end of the Path. Do NOT alter the Path in any other way! As it contains important system stuff, it's definitely NOT recommended. Just add that ;C:\Python27 if it's not there. I think it won't be there, since I had to enter it manually. I think.
Anyways, notice the semicolon (;) that is before the C:\Python27. Entries for different applications are separated with semicolons in the Path variable string, so you should add that semicolon so your OS knows what you're talking about.
And that's about it for setting Python up.

* That's actually a lie. If you're familiar with Python, you're free to re-write the Python "compiler" that the ModSys uses, and thus convert it to Python 3.

And where is the modding?
Modding comes next. Are you OK? Still alive, computer not exploded? Very well, keep reading! You've set your Pythonic compiler up, now it's time to compile the basis for your new mod.
Now, make sure you have permissions to read and write in your ModSys folder and in your Mount&Blade folder (best is if you can freely change the whole folder). Now, open up your Mount&Blade\Modules, copy Native and paste it in the same place. Change the folder name to your new mod's name.
(click to show/hide)
Now that you have your new mod folder, you have to make your ModSys use it. Open up your ModuleSystem folder, locate module_info.py and open it. Important! Do NOT double-click the file. If you do it, Python will think that you're trying to compile a Python program, and will basically do nothing. In order for you to edit ModSys files, you need to use a text editor. You can use Notepad, although I'd strongly recommend using Notepad++, a very powerful and free text editor, and the very same software I'm using to write this post.
(click to show/hide)
Python ships with IDLE, a text editor, but it's old and bad, don't use it. Anyways, open up your module_info with your favourite text editor, and you will see this:
Code: [Select]
# Point export_dir to the folder you will be keeping your module
# Make sure you use forward slashes (/) and NOT backward slashes (\)

export_dir = "../WOTS/Modules/Native/"
#export_dir = "C:/Program Files/Mount&Blade/Modules/Native/"
(Now this right here, "WOTS", is a remnant from pre-2005 (or so), when the game was (temporarily) called "Way of the Sword". If you've played the very first versions of M&B, you can see old stuff still hanging around... :P)
Right. So, you see what you have to do. Now, let's give you some overhead. The # mark you see right there means that this line is a comment. If you're a programmer, you know what a comment is, if you're not - a comment is something that stands there for the programmer, not for the computer. Comments are used to take notes, make documentation and whatnot. Damned useful, comments are. Everything followed by a comment is invisible to the compiler, so if someone tells you you have to change both lines, tell them to **** off.
Change your export_dir (the non-commented one) so that it points to your new mod folder, and follow the lead for the slashes.
(click to show/hide)
As you can see, the second (commented) line is not changed, and it works OK. Now, you've set your mod up. And here comes the first challenge.

Challenge? What challenge?
Don't worry, it's nothing. You have to double-click the build_module.bat file in your ModSys folder - this is the compiler. Now a console window will pop up and you will see some output.
If you've done everything correctly, you'll see a good output and you can be happy.
(click to show/hide)
But. If you've failed to do something from the above, you can get errors. The highest chance of an error you'll get is to see
Code: [Select]
'python' is not recognized as internal or external command, operable program or batch file.about twenty times in a row. What this means is that you haven't set up your "Path" variable properly. Feel free to consult the stickied How to fix "Python not recognised..." thread in the forum.
If/When everything works OK, keep reading.

Uh... I'm getting a "can't open file" or something" error! What do I do?
You must be sure to have Read/Write permissions to your ModSys folder, and to your new mod's folder, of course. You can try running the build_module.bat as an admin, it may work - I haven't tried it, I don't know. However, putting the ModSys folder on the Desktop or in My Documents is bound to fix the problem.

I'm getting another error!
Use the forum's Search function (it's in the top-right corner) or ask a question in the Q&A thread. Do not make a new thread specifically for your question.

All right, my mod compiles properly. What now?
Well, my friend, this means you're done. You have the basis for your mod completed, and all that's left is the real modding itself.
One more thing you should know, though. As you probably noticed, there are four types of .py files in the ModSys folder. Read on below to understand their purposes.
(click to show/hide)
(click to show/hide)
(click to show/hide)
(click to show/hide)

But wait, aren't you going to tell me how to mod?!
This is a path that everyone must walk on their own. In other words, no, I'm not going to tell you how to mod. :mrgreen:
I will, however, give you some tips and links that will be useful for you.

Fine. What are they?
Here we go...
- Firstly, grammar and attitude. Remember these two words, for they are very important. Write properly, be polite to others, and your chances of getting help will increase exponentially. Put spaces after punctuation marks, remember that "u" and "y" and other crap are not words but letters, and no "halp plox". Treat others as your equals, in the way that you want to be treated. Members with experience (that even spare time to answer your questions) should be treated with all the respect you (should) treat your mentors with. Don't be afraid to ask your questions and to use the word "please".
- Stickied topics are your friend. Stickied topics are threads on the forum which always stay on the top, and do that because they are important. Reading them is always a good idea.
- Read the forum rules. They aren't a lot, and are put quite shortly and understandably. Also remember to read the box that appears when you make a new topic. Read it at least once, it won't hurt you.
- If you have a small question, do not make a topic about it. Post your question in the stickied Q&A thread instead.
- Use the forum search and/or Google search on the forum to find things you need.
- The best way to learn modding is to try. Start off small, although that may seem boring as an advice. But trust me, I know it from experience. Starting off small is the good way to start; trying to make a gigantic project from the beginning is a very, very bad idea. Trust me.
- You can read what each "operation" (i.e. ModSys function) does in header_operations.py

These were the only tips I can think of right now. Now I'll give you some useful links.
- The Official ModSys Documentation. That's very old and outdated, but the ModSys still works on the same principle. Reading some can't hurt you.
- jik's Updated ModSys tutorial - this is a newer (i.e. from 2009... :iamamoron:) and reworked version of the official one. Pretty useful.
- Ruthven's Beginning to mod thread. It's a compilation of links to tutorials, guides and other stuff. Has proven itself useful.
- Pyrate's Modding 101 thread. Contains useful stuff. (Just ignore the old download links!)
- Caba'drin's ModuleSystem Syntax tutorial. Incredibly useful if you're trying to find your way in MABL. Or MBScript. Or however you call it. :)
- Various Modders sharing their experiences with early modding

Wait, how can I edit the World map?
Since you asked, here's something important. In modding, the term map refers only to the World Map, the one where you move around towns with your little guy. Multiplayer maps, called like that similarly to other MP games, are called scenes in the modding section. Know that, because it's highly annoying to come across a person who asks how to edit a map, while he's actually referring to a scene.
But let's get back on the question. To edit the World Map, you need a Map Editor application. There are a few in existence, but the most well-known of them all is Thorgrim's MapEditor. It was made for the old M&B, but it can work with Warband, no matter what people may be telling you. If you're going to use it for Warband, take a look at my Warband MapManager. It takes all the dirty work (needed to make the MapEditor work for Warband), and does it for you.
Here's a link to a very good tutorial (I've followed it myself) that will get you started on the actual map editing.
Also, please note that the larger the map, the more cumbersome it is. Maps with loads of vertices (yes, the map is actually a 3D mesh), like more than 80000, will put a lot of pressure onto people's computers and should generally be avoided.

Is that it?
That's about it. Now it's time for you to venture into the big wide world of modding.





Very great thanks to Caba'drin (our most active admin in these parts of the forum at the present time) for deciding to honor this thread with a sticky. Hope it will serve its purpose. :)
Thanks to Dawiduh for translating this topic to Romanian: link to the translated version.


Hope you read, liked, and potentially learned something.
Ideas for improvement? Let me know.

Lumos out.
« Last Edit: March 01, 2018, 12:37:56 PM by L̨u҉m͞o̧s̡ »

Rodrigo Ribaldo

  • Duke
  • *
  • See you in August 20xx
    • View Profile
  • Faction: Neutral
  • M&BWB
Re: The REAL modding tutorial | Starting out? Read this!
« Reply #1 on: July 25, 2012, 10:58:14 AM »
Thanks, the situation was getting out of hand. I'll make sure to link every recruit I meet to this.
Maybe spoiler the whole "what+why" intro for folks that want to get to Python installation quickly and call the whole post "The Ultimate Modding Intro". :)

Swyter

  • Grandmaster Knight
  • *
  • »Star Wars Conquest Dev Team Leader
    • View Profile
    • [my tiny homepage]
  • Faction: Swadian
  • MP nick: Sareth | Swyter
  • WBM&BWF&S
Re: The REAL modding tutorial | Starting out? Read this!
« Reply #2 on: July 25, 2012, 11:01:13 AM »
Wowowow... Well written and entertaining. Congrats for the effort. I'm with MadVader on this, intro with capslock.
Also, I see that you keep using Mono Industrial. Dark color schemes are teh win neat. :)

Duh

  • Hyper-Masochist
  • Duke
  • *
  • Colorporasexual
    • Steam - hanzeduh
    • View Profile
  • Faction: Rhodok
  • MP nick: Sir Simpleton
  • M&BWB
Re: The REAL modding tutorial | Starting out? Read this!
« Reply #3 on: July 25, 2012, 11:04:08 AM »
You might also want to list this tutorial under worldmap editing - http://forums.taleworlds.com/index.php/topic,162501.0.html by Demonwolf. Nice tutorial Lumos.

Lumos

  • Probably Not a Help Desk
  • Moderator
  • *
  • Mens INsana in corpore sano
    • Steam - lumosx
    • YouTube - LumosX
    • View Profile
  • Faction: Nord
  • WBWF&SNWM&BVC
Re: The Ultimate Introduction to Modding | Starting out? Read this!
« Reply #4 on: July 25, 2012, 11:40:45 AM »
Thanks everyone. I followed your advice, and reworked the first post a bit.
I included the link to the tutorial, Duh, thanks for reminding me about it.

@Swy: Well, I love light-on-dark. Just prefer it over the opposite. And I have the font configured to Courier New, the good ol' monospaced coder's choice font. :)

Rodrigo Ribaldo

  • Duke
  • *
  • See you in August 20xx
    • View Profile
  • Faction: Neutral
  • M&BWB
Re: The Ultimate Introduction to Modding | Starting out? Read this!
« Reply #5 on: July 25, 2012, 12:33:44 PM »
Now if only Caba would sticky this here (so it won't get lost in the tutorials section).

Slawtering

  • Grandmaster Knight
  • *
    • Steam - http://steamcommunity.com/id/Slawtering/
    • View Profile
  • Faction: Neutral
  • WBNWWF&SM&BVC
Re: The Ultimate Introduction to Modding | Starting out? Read this!
« Reply #6 on: July 25, 2012, 01:57:12 PM »
Gambino's was better
(click to show/hide)

SonKidd

  • Knight
  • *
    • View Profile
  • Faction: Nord
Re: The Ultimate Introduction to Modding | Starting out? Read this!
« Reply #7 on: July 25, 2012, 03:28:20 PM »
lol... you actually did what you said. Impressive  :wink:.
SonKidd's Multiplayer Troop Item Generator (v0.9b)
http://forums.taleworlds.com/index.php?topic=197856.0
Shaking Camera Script (Earthquake):
http://mbmodwiki.ollclan.eu/wiki/Shaking_Camera_Script
Script to guarantee all melee weapons:
http://mbmodwiki.ollclan.eu/wiki/Spawn_troops_with_all_melee_weapons

Arvenski

  • Count
  • *
  • A fool who dreams too much
    • Steam - arvondor
    • YouTube - UCvUcSygxUX37c6fekGtqLEA
    • View Profile
  • Faction: Swadian
  • M&BWB
Re: The Ultimate Introduction to Modding | Starting out? Read this!
« Reply #8 on: July 25, 2012, 04:44:16 PM »
Congratulations,Lumos,this looks amazing,maybe it will help me with all the new recruits I usually end up mentoring.
Cold, the air and water flowing
Hard, the land we call our home
Push to keep the dark from coming
Feel the weight of what we owe
  This, the song of sons and daughters
  Hide the heart of who we are
  Making peace to build a future
  Strong united, working 'til we fall
  And we all lift
  And we're all adrift together, together
  Through the coldness
  'Til we're lifeless together, together

Duh

  • Hyper-Masochist
  • Duke
  • *
  • Colorporasexual
    • Steam - hanzeduh
    • View Profile
  • Faction: Rhodok
  • MP nick: Sir Simpleton
  • M&BWB
Re: The Ultimate Introduction to Modding | Starting out? Read this!
« Reply #9 on: July 26, 2012, 11:44:01 AM »
I might have missed it, but just in case - you should also mention that some OSs (f.e. Win7) can cause trouble during compile, if the permissions arent given. An easy way to fix that is to move your mod or mb/warband folder to a non restricted zone (like the desktop). Its also possible to change the permission settings (though i never tried) and one could also attempt to compile "as administrator" (though again i didnt try that).

Lumos

  • Probably Not a Help Desk
  • Moderator
  • *
  • Mens INsana in corpore sano
    • Steam - lumosx
    • YouTube - LumosX
    • View Profile
  • Faction: Nord
  • WBWF&SNWM&BVC
Re: The Ultimate Introduction to Modding | Starting out? Read this!
« Reply #10 on: July 31, 2012, 07:43:42 PM »
Added the permission things. Thanks, Duh, I'd forgotten that too. :)

Arvenski

  • Count
  • *
  • A fool who dreams too much
    • Steam - arvondor
    • YouTube - UCvUcSygxUX37c6fekGtqLEA
    • View Profile
  • Faction: Swadian
  • M&BWB
Re: The Ultimate Introduction to Modding | Starting out? Read this!
« Reply #11 on: July 31, 2012, 08:37:03 PM »
@Lumos:Off topic i know,but with that new avatar,i hardly know it's you. :lol:
Cold, the air and water flowing
Hard, the land we call our home
Push to keep the dark from coming
Feel the weight of what we owe
  This, the song of sons and daughters
  Hide the heart of who we are
  Making peace to build a future
  Strong united, working 'til we fall
  And we all lift
  And we're all adrift together, together
  Through the coldness
  'Til we're lifeless together, together

Lumos

  • Probably Not a Help Desk
  • Moderator
  • *
  • Mens INsana in corpore sano
    • Steam - lumosx
    • YouTube - LumosX
    • View Profile
  • Faction: Nord
  • WBWF&SNWM&BVC
Re: The Ultimate Introduction to Modding | Starting out? Read this!
« Reply #12 on: August 01, 2012, 02:42:33 PM »
@Lumos:Off topic i know,but with that new avatar,i hardly know it's you. :lol:
That's my old avatar. I used it for all the time I was here, but changed it after BF3 came out. Now I'm back. :)

Gambino

  • Sergeant Knight at Arms
  • *
    • View Profile
  • Faction: Bandit
  • MP nick: Oliver_Khan
  • M&BWBWF&SNW
Re: The Ultimate Introduction to Modding | Starting out? Read this!
« Reply #13 on: August 02, 2012, 04:47:28 PM »
great tutorial lumos!  :mrgreen: sure it will help people out!

you can also see this tutorial, it is a good one  :wink:

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

English_Knight

  • Sergeant
  • *
    • View Profile
  • Faction: Swadian
Re: The Ultimate Introduction to Modding | Starting out? Read this!
« Reply #14 on: August 03, 2012, 04:03:38 PM »
Is there any way I can import items from mods into my native version? I'd love a helm with a crown for my native game, but there are none.

Miri it is while ſumer ylaſt wiþ fuȝeles ſon.