Page 1 of 8 12345 ... LastLast
Results 1 to 30 of 239

Thread: HowTo: Set up MTW2 for modding

  1. #1
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default HowTo: Set up MTW2 for modding

    You can quote or link to this tutorial at wish, but please don't mirror it. This is required to keep discussion about it all in one place.

    Setting up MTW2 for modding

    In this tutorial I want to walk you through the necessary or at least very useful steps to set up a working modding environment.

    This can be done using one (or both) of two different ways:
    - Creating mod folders
    - Making the game recognize files you put in the data directory (using the io.file_first switch)

    Both ways have their own advantages and disadvantages, but overall I feel that mod folders should be the first choice, unless you want to do something they don't support (more on that later), but I will nonetheless describe both methods.



    1. Getting the files

    Well, the first step of setting up your game will always be unpacking the data files, no matter if you want to use mod folders or io.file_first.
    To do this, you have to have patch 1.1 installed. If you do, you should be able to find a directory called "tools" inside your MTW2 directory, and inside that, you will find a folder named "unpacker".
    To unpack all the game's data files, simply run unpack_all.bat - this will take a while, so be warned. After the program's finished, open your data directory (inside your MTW2 directory) and delete or rename descr_geography_new.db and descr_geography_new.txt (this is important - if you don't do it, your game won't run)

    Information for advanced users:
    Spoiler Alert, click show to read: 
    I recommend editing unpack_all.bat to not unpack into your vanilla data directory, but into a subfolder. This way, you can always keep a clean copy of the files.
    To do this, open up the batch file and edit it like this:
    Code:
    unpacker.exe --source=..\..\packs\*.pack --destination=..\..\backup --verbosity=1
    That will unpack the files into a directory called backup inside your MTW2 folder.

    You should also copy the data/world/maps/base and data/world/maps/campaign/imperial_campaign folders to this directory


    1.1 Converting the text files

    The next step after unpacking is due to the fact that the game stores the localised text in files with the extension .strings.bin - however in order to edit them, you want to have them in .txt format (UTF-16 if you know what that is). The game will then automatically generate the .strings.bin files from these txt files.
    I wrote a useful python script that allows batch conversion of these files. You can find it here
    Usage instructions can be found in the read-me file for the tool.

    1.2 Alternative: Directly editing the .strings.bins

    pmcorp wrote a nice tool that allows you to edit the .strings.bin files directly. I prefer converting them and editing them in my favourite text editor, but I guess some people prefer to directly edit the bin files.
    Further, this tool allows you to edit the files my converter can't convert, so you should definitely get it at least for that end (click here).
    Be aware that you will have to install the .net frameset before being able to use this (get it here or the 64-bit version here)



    2. Mod folder vs. io.file_first

    In the next step, you will have to decide whether you want to use a mod folder, or the io.file_first switch for your working environment. To easy your decision, I will state some of the advantages/disadvantages for both methods:

    Mod folders:
    pro:
    - You can have multiple mods at once without them interfering with each other
    - When changing mods you don't have to switch out any files
    - Savegames, preferences, etc. can be kept separately for each mod

    contra:
    - Not all files are supported, this includes textures. For more information, visit this link
    - Slightly harder to set up

    io.file_first:
    pro:
    - Supports all editable files
    - Slightly easier to set up

    contra:
    - When changing mods you have to switch out all modified files
    - Savegames, preferences, etc. have to be switched out, too
    - You will always overwrite your unpacked files


    3. Setting up a mod folder

    The easiest way to set up a new mod folder is probably using my mod folder installer
    It will allow you to easily set up a mod folder with all the necessary files.
    For manual instructions, click on show:
    Spoiler Alert, click show to read: 
    First of all, create a new folder inside your MTW2 directory called "mymod" (you can replace mymod with anything you like, as long as you keep replacing it throughout the rest of this section).


    3.1 Creating a new config

    To do this, copy your medieval2.preference.cfg file and name the copy "mymod.cfg"
    Then open "mymod.cfg" with a text editor and add the following to the top:
    Code:
    [features]
    mod = mymod
    
    [log]
    to = logs/system.log.txt
    level = * error
    The first setting tells the game the mod folder in which it should look for files, the second enables error logging to a custom error log file which is highly recommended, but not exactly required.


    3.2 Necessary files

    Before proceeding, please create a data folder inside your "mymod" folder.
    In order for your mod folder setup to work, you will have to copy data/world/maps/base and data/world/maps/campaign/imperial_campaign, as well as text/imperial_campaign_regions_and_settlement_names.txt to your "mymod" directory, leaving the directory structure intact (i.e. data/world/maps/base should go to mymod/data/world/maps/base, etc.)


    3.3 Optional files

    On top of this, you may want to copy the following:
    - To enable sounds, data/sounds/events.dat and data/sounds/events.idx
    - To enable loading screens, data/loading_screen
    - To enable event videos, data/fmv

    Of course, you should also copy any files you want to edit into the data directory of your mod folder.


    3.4 Batch file creation

    In order to be able to start your game using your mod folder, create a new text file inside your MTW2 directory called mymod.bat
    Open it (right-click, edit) and write this into it:
    Code:
    medieval2.exe @mymod.cfg

    Congratulations. If everything worked, you should now be able to run the game with your mod directory by starting mymod.bat



    4. Setting up io.file_first

    4.1 Creating a new config

    To do this, copy your medieval2.preference.cfg file and name the copy "mymod.cfg"
    Then open "mymod.cfg" with a text editor and add the following to the top:
    Code:
    [io]
    file_first = 1
    
    [log]
    to = logs/system.log.txt
    level = * error
    This will tell the game to use the files it finds in the data directory instead of those in the packs.
    It will also enable error logging to a custom error log, which is highly recommended, but not strictly necessary.

    In order to be able to start your game using this config, create a new text file inside your MTW2 directory called mymod.bat
    Open it (right-click, edit) and write this into it:
    Code:
    medieval2.exe @mymod.cfg
    Congratulations. If everything worked, you should now be able to run the game with your unpacked files by starting mymod.bat



    5. Testing

    An easy test is editing a screen text file (for example text/imperial_campaign_regions_and_settlement_names.txt) and replacing one entry with something different. If your change shows up in the game, you're set up fine. I usually do something like changing
    Code:
    {London}	London
    to
    Code:
    {London}	The Moloch
    If you then start the game as the English, London should (more or less) rightfully be called "The Moloch" - if it isn't, your modding environment is not set-up correctly.



    6. The error log

    This doesn't really fit here, but as it is probably somewhat of a beginner tutorial, I want to make sure you understand how important the error log is.
    Remember what you added into your config file:
    Code:
    [log]
    to = logs/system.log.txt
    level = * error
    This tells the game to create an error log in the MTW2/logs folder called system.log.txt

    A lot of common errors will be shown in this log, so if something doesn't work, or the game crashed, it's a good idea to check this log file before doing anything else.
    As you are a beginner, it will probably tell you what's wrong in at least 50% of the cases, and although its usefulness will decrease slightly once you're getting more experienced, it will still be a routine action to check this file every time you quit the game.
    The progression for log levels is trace<info<warn<debug<err<fatal<always
    Usually, the most useful one is level = * err or level = * error because it will show you the errors you make (like spelling mistakes and so on) without giving a lot of unnecessary info. However, if you're creating triggers or scripts and want to test them you should use level = game.script.* trace as it will yield all the info about the scripting side of the game, including triggers.
    I don't think there are any debug messages in the retail exe so debug is the same level as err
    The warn level can be useful sometimes if you want info about missing files and so on but you'll have to dig through a lot of stuff to find it.

    There's a few issues with this file, for example you can't guarantee when it writes the log unless you close the game. So it may be a good idea to only test one thing at a time and then close the game again in order to be able to catch as many problems as possible.
    Last edited by alpaca; 05-11-2007 at 19:35.

  2. #2
    It was a trap, after all. Member DukeofSerbia's Avatar
    Join Date
    Feb 2005
    Location
    Sombor, Serbia (one day again Kingdom)
    Posts
    1,001

    Thumbs up .bin editor

    Quote Originally Posted by alpaca

    1.1 Converting the text files

    The next step after unpacking is due to the fact that the game stores the localised text in files with the extension .strings.bin - however in order to edit them, you want to have them in .txt format (UTF-16 if you know what that is). The game will then automatically generate the .strings.bin files from these txt files.
    I wrote a useful python script that allows batch conversion of these files. You can find it here
    Usage instructions can be found in the read-me file for the tool.
    Hello alpaca.

    I found that somebody in TWC make .bin editor and it actually open .bin files like Notepad .txt. Is it possible to direct modify .bin files or I need to convert it in .txt (probably stupid question but...)?
    Watching
    EURO 2008 & Mobile Suit Gundam 00

    Waiting for: Wimbledon 2008.

  3. #3
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: .bin editor

    Quote Originally Posted by DukeofSerbia
    Hello alpaca.

    I found that somebody in TWC make .bin editor and it actually open .bin files like Notepad .txt. Is it possible to direct modify .bin files or I need to convert it in .txt (probably stupid question but...)?
    Well I didn't try his tool. If it works, then you can directly modify them.
    However, converting them to .txt files has the advantage that you only need a tool once, whereas editing them directly forces you to use it all the time for every editing step.

    Anyways, if you can confirm that this tool works I can add it to this tutorial, at least to edit the files my converter doesn't convert.

  4. #4

    Thumbs up Re: HowTo: Set up MTW2 for modding

    Thanks a ton man, I needed this, and so does everyone new to modding MTW 2. Everyone else seems to already know most of it from RTW or assume you already know all the basics.


  5. #5
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: HowTo: Set up MTW2 for modding

    Quote Originally Posted by Valentine82
    Thanks a ton man, I needed this, and so does everyone new to modding MTW 2. Everyone else seems to already know most of it from RTW or assume you already know all the basics.

    Well the problem is rather that nobody wants to bother and has the time to write tutorials apparently. I don't have enough time, either ;)

  6. #6

    Default Re: HowTo: Set up MTW2 for modding

    I am sooo fvkin p1ssed off right now, i install m2tw, install the 1.1 patch, try and run the unpack_all batch file and get a fvkin error, (This application has failed to start because MSVCP71.dll was not found. Re-installing the application may fix this problem) so, i copied the unpack_all into my main m2tw install folder in which this MSVCP71.dll file is and run the unpacker...
    the file doesnt give me an error and seems to be working... Do you agree to these terms and conditions (Y/N) so i type Y and enter, then it informs me that this program may damage my install of m2tw, read the read me and would you like to continue (Y/N) so i type Y and enter, next it informs me this will overwrite files in the target folder, are you sure you would like to continue (Y/N) i type Y and enter...then thats fvkin it, the program closes and thats it...NOTHING, FVK ALL, JACK SH1T, Im soooooo FVKIN P1SSED OFF, all I FVKIN WANNA DO IS MOD THE UNIT STATS, THATS IT, AND I HAVE TO GO ABOUT ALL THIS B.S TO DO THAT, unlike rtw the data files were alrdy unpacked and in txt format, y is it so hard to fvkin get this done, y couldnt they just make the tree structure and layout like rtw, like fvk, im sooooo fvkin p1ssed, im goin to fvkin burn this godamn game b4 the night ends...FVK, what the fvk am i doing wrong, i follow the tutorial word 4 word, and that dont work, like fvk, someone let me know what the fvk is wrong with what im doin......FVK

  7. #7

    Default Re: HowTo: Set up MTW2 for modding

    The Unpacker should be placed in the 'tools\unpacker' folder of your
    Medieval II: Total War installation folder

    - To unpack all files and place them in your 'data' directory run
    the batch file 'unpack_all.bat'

    NOTE: To use this batch file the Unpacker and the batch file must
    be in the 'tools\unpacker' folder for Medieval II: Total War

    - To create a text file with a list of all files within the packs
    run the batch file 'list_contents.bat'. This will create a file
    'pack_contents.txt' in the 'tools\unpacker' folder;

    NOTE: To use this batch file the Unpacker and the batch file must
    be in the 'tools\unpacker' folder for Medieval II: Total War


    YA thats nice to know...but it gives me that error, MSVCP71.dll was not found..........when i run the unpacker from the tools folder....FVK

  8. #8
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: HowTo: Set up MTW2 for modding

    Mate, watch your language please. Rants against CA have no right of existence in this thread.
    Especially not if you use swearwords.

    Try editing your unpack_all.bat so that it says:
    Code:
    unpacker.exe --source=packs\*.pack --destination=. --verbosity=1
    Then run it from your MTW2 main directory.

  9. #9
    It was a trap, after all. Member DukeofSerbia's Avatar
    Join Date
    Feb 2005
    Location
    Sombor, Serbia (one day again Kingdom)
    Posts
    1,001

    Thumbs up .bin editor and Python

    Quote Originally Posted by alpaca
    Well I didn't try his tool. If it works, then you can directly modify them.
    However, converting them to .txt files has the advantage that you only need a tool once, whereas editing them directly forces you to use it all the time for every editing step.

    Anyways, if you can confirm that this tool works I can add it to this tutorial, at least to edit the files my converter doesn't convert.
    My computer is on upgrade and when it backs I will check and post results here.

    Anyway,

    What about Python? I downloaded Python 2.5 Windows installer but I see Python 2.5 Windows AMD64 installer?
    What is Python 2.5 Windows AMD64 installer? What is this? I ask that because I have AMD Athlon64 and have they some connections or not?
    Watching
    EURO 2008 & Mobile Suit Gundam 00

    Waiting for: Wimbledon 2008.

  10. #10
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: .bin editor and Python

    Quote Originally Posted by DukeofSerbia
    My computer is on upgrade and when it backs I will check and post results here.

    Anyway,

    What about Python? I downloaded Python 2.5 Windows installer but I see Python 2.5 Windows AMD64 installer?
    What is Python 2.5 Windows AMD64 installer? What is this? I ask that because I have AMD Athlon64 and have they some connections or not?
    Well as it says, it's the installer for AMD 64bit CPUs, so if you have one of those, download the AMD64 version. It's probably not strictly necessary but probably has some more features and/or optimizations.

  11. #11
    It was a trap, after all. Member DukeofSerbia's Avatar
    Join Date
    Feb 2005
    Location
    Sombor, Serbia (one day again Kingdom)
    Posts
    1,001

    Default Re: .bin editor and Python

    Thank you alpaca. I will download Python 2.5 Windows AMD64 installer.
    Watching
    EURO 2008 & Mobile Suit Gundam 00

    Waiting for: Wimbledon 2008.

  12. #12

    Default Re: HowTo: Set up MTW2 for modding

    I ve got the same problem like FvkinFrustrated.So i copied all files similar to msvcp71.dll from main install folder to Tools\Unpacker.I run unpack_all and it asked me the same questions like Fvkin wrote.But when i type Y for all it was working.BUT I COULDNT EDIT IT BECAUSE THERE WAS TOHSE FVKIN QUESTIONS.Well anyway it runs, but i want to edit it like you have recommended.
    Would you know how to do that?

  13. #13
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: HowTo: Set up MTW2 for modding

    You edit batch files by right-clicking them and press on edit... I wrote it's for advanced users for a reason because I wouldn't recommend changing it if you don't know what you're doing ;)

  14. #14

    Default Re: HowTo: Set up MTW2 for modding

    Yeah it is ok now .And i find a topic Mod folder installer and downloaded tool also.However i quiet didnt understand it. I have to install it to the BACKUP file wehre i unpacked M2TW?

  15. #15
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: HowTo: Set up MTW2 for modding

    No, you install it to your MTW2 folder and then copy the files you want to edit into it from your backup folder.

  16. #16

    Default Re: HowTo: Set up MTW2 for modding

    So i chose a way to creat a mod folder.I did all like u wrote and wanted to make some test.
    Code:
    5. Testing
    
    An easy test is editing a screen text file (for example text/imperial_campaign_regions_and_settlement_names.txt ) and replacing one entry with something different. If your change shows up in the game, you're set up fine.

    [code]In the text file you wrote i changed this
    Code:
    {Palermo}Palermo
    {Palermo_Province}Palermo Region
    to this
    Code:
    {MAfiano}Mafiano
    {Mafiano_Province}Mafiano Region
    And the change didnt show.There still was Palermo.How to do that?

  17. #17

    Default Re: HowTo: Set up MTW2 for modding

    Of course 1. MAfiano i rename to right Mafiano and still didnt change in game.

  18. #18

    Default Re: HowTo: Set up MTW2 for modding

    I renamed it in mymod/data/imperial_campaign_regions_and_settlement_names.txt and in backup/data/text/imperial_campaign_regions_and_settlement_names.txt .In which folder of this two do i have to rename it?


    And can i edit my post on this forum?Because if i forget to write something i always must write a new post and cant edit previous.

  19. #19
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: HowTo: Set up MTW2 for modding

    Junior members can't edit their posts.
    Anyways, try just to change the right hand part of the settlement names, this is the part that actually holds the screen name. The left hand part is the internal name, if you want to change that, you have to change a few more files (not exactly sure which).
    You should also make sure to check the system.log.txt file in your MTW2/logs directory.

  20. #20

    Default Re: HowTo: Set up MTW2 for modding

    Yes I changed it. But i made one more mistake befere.Before i could start the campaign(already in game).But i didnt copy mymode.cfg to main M2TW folder but to mymode folder. Now i copied it to main and when in game click on GRAND CAMPAIGN it shows me: PLEASE SELECT AN ITEM FROM THE LIST.

  21. #21

    Default Re: HowTo: Set up MTW2 for modding

    And could i change and apply textures (when i chose way of MOD FOLDERS) if i write to mymod.cfg also [io]
    file_first = true

    If not,is it able to change and apply textures in way of creating MOD FOLDERS?
    And pls answer my previous question too.But i could do a mistake somewhere too so i check it one more time.

  22. #22
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: HowTo: Set up MTW2 for modding

    You need the world/maps/base and world/maps/campaigns/imperial_campaign folders from the data folder.

    And if you want to use file_first you need to put the files into your mtw2/data dir, they won't be used from the mod folder.

  23. #23

    Default Re: HowTo: Set up MTW2 for modding

    Everythings ok now.I tried both ways and and with each i succesfully changed name of the city.
    I am starting to understand modding and week ago didnt have any idea how to mod.Well it is only begin.
    Thank you alpaca.You are boss.You know everything.

  24. #24

    Default Re: HowTo: Set up MTW2 for modding

    Hi there, i am just starting up and what i would like to do is to in the future install different skins,ect.
    I understand step on, though i did this last night i did not deleat these files
    descr_geography_new.db and descr_geography_new.txt
    when i loaded up the game to play custom battle, just befor it started it crashed. i dont really want to do any modding i am not that confidant But i would like to install other peoples work/skins and othe stuff. I am playing LTC at the mo.
    What i am asking is, step 1.2 seems confusing,do i need to go through step1.2 in order to install skins and stuff?
    Thank you Great forum

  25. #25
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: HowTo: Set up MTW2 for modding

    Quote Originally Posted by gary
    Hi there, i am just starting up and what i would like to do is to in the future install different skins,ect.
    I understand step on, though i did this last night i did not deleat these files
    descr_geography_new.db and descr_geography_new.txt
    when i loaded up the game to play custom battle, just befor it started it crashed. i dont really want to do any modding i am not that confidant But i would like to install other peoples work/skins and othe stuff. I am playing LTC at the mo.
    What i am asking is, step 1.2 seems confusing,do i need to go through step1.2 in order to install skins and stuff?
    Thank you Great forum
    Well if you only want to use mods by other people, you probably don't have to follow section 1. at all.

  26. #26

    Default Re: HowTo: Set up MTW2 for modding

    well, i think i would have to unpack them, the data that is, in order to copy and paste skins, i guess,

  27. #27
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: HowTo: Set up MTW2 for modding

    Hmm ya that's true, I don't know my own tutorials...
    Well, then ignore steps 1.1 and 1.2 ;)

  28. #28
    It was a trap, after all. Member DukeofSerbia's Avatar
    Join Date
    Feb 2005
    Location
    Sombor, Serbia (one day again Kingdom)
    Posts
    1,001

    Question Question

    alpaca

    I finally got my computer from upgrade and installed M2 TW, unpacked and used Python 2.5 Windows AMD64 installer. It can't be installed even I have AMD Athlon64. But ordinary can.

    I have one, maybe stupid question:

    Can I erase all those files which I unpacked as I don't need them? I see many RTW-BI files which just slow down performances.
    Watching
    EURO 2008 & Mobile Suit Gundam 00

    Waiting for: Wimbledon 2008.

  29. #29
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Question

    Quote Originally Posted by DukeofSerbia
    alpaca

    I finally got my computer from upgrade and installed M2 TW, unpacked and used Python 2.5 Windows AMD64 installer. It can't be installed even I have AMD Athlon64. But ordinary can.

    I have one, maybe stupid question:

    Can I erase all those files which I unpacked as I don't need them? I see many RTW-BI files which just slow down performances.
    You shouldn't delete any files. If you want to mod them, you'll have to have at least those that you want to mod (and maybe a few more). You can move them to a backup directory and only copy those to your modding folder/data folder that you actually want to work on, though.

  30. #30

    Default Re: HowTo: Set up MTW2 for modding

    Wow do I feel dumb. Reading through some random threads, I learned that after extracting the patch, you actually have to install it.
    I apologize for this waste of space.
    Last edited by Psyco; 01-16-2007 at 06:38.
    Anyone who has no fear of death himself can succeed in inflicting it.
    The Prince,
    Machiavelli

Page 1 of 8 12345 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO