Results 1 to 2 of 2

Thread: All tips to avoid unknown errors by the game when you install/create mods

  1. #1
    Ralendil's Avatar Semisalis
    Join Date
    Oct 2005
    Location
    France
    Posts
    426

    Default All tips to avoid unknown errors by the game when you install/create mods

    Ok, as I had several difficulties to be able to use and create mods I will summarise here all difficulties that an user could encounter while trying to mod or use mods avalaibles.
    I understand, that several of you will think by reading several parts of this post something like: "what does he say?? it never happenned to me!!!". and yes I am sure several of you had not several of the difficulties I will describe. I suspect that the localised versions are not working all by the same way.

    I. Preparing the modding

    A. Unpacking

    There's methods that describe how to unpack. Basically you need to launch the file Medieval Total war\tools\unpacker\unpack_all.bat. Be warned that it takes a lot of time AND a lot of space on your HD.

    1./ How to normally succeed to work with the unpacked files

    Normally, you just run the unpack_all.bat file and after the program has unpacked everything you have to go in your data directory and delete descr_geography_new.db and descr_geography_new.txt. Forgiving this step will result in a crash of your game.

    2./ What if it doesn't work at all?

    Sometimes (like me), unpacking the files will result in a crash of your game just after the splash screen. So don't be affraid if it happens to you...
    If it happens, and IF you need the files, I would advice you to edit the unpack_all.bat file and to make this correction:

    ;FIND
    ;-----------------------------------
    unpacker.exe --source=..\..\packs\*.pack --destination=..\..\ --verbosity=1

    ;REPLACE WITH
    ;-----------------------------------
    unpacker.exe --source=..\..\packs\*.pack --destination=..\..\backup --verbosity=1
    This code line will permit you to unpack the files in a folder called "backup" that will be in your main directory. It will permit you to be able to find the files you need to mod the game.
    If this happen, Don't put all the files in the main data directory or your mod folder... there's 1 file that create a crash (I have never determinated wich one). I suspect it is linked to the localised versions (I have a french version). It should not happen with english versions.

    B. Mod folder vs. io.file_first

    1/ Pro and contra the 2 methods

    Several of you, have seen on this forum or an another one, that there's pro and contra for the mod folder method and the io.file_first method.

    Mod folders:
    pro:
    - You can use multiple mods
    - If you use an another mod, you don't need to replace / change files in your installation
    - Each mods can have its own preferences, saved games etc...

    contra:
    - Not all files are supported, this includes textures.

    io.file_first:
    pro:
    - Supports all editable files

    contra:
    - When you want to use an another mod, you have to replace all files. This can lead you to reinstall the game.
    - Savegames, preferences, etc. have to be switched out, too
    - You will surely overwrite your unpacked files (if you could use the unpacked method)
    To use the mod folder method:

    1/ Create a folder "my_mod" in your medieval total war 2 directory

    2/ Copy the file "medieval2.preference.cfg" and rename it "my_mod.cfg"

    3/ Open "my_mod.cfg" and add at the beginning
    [features]
    mod = mymod

    4/ Copy in the "my_mod" folder all these files/folders
    - 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
    - These folders are absolutely needed: data/world/maps/base and data/world/maps/campaign/imperial_campaign, as well as text/imperial_campaign_regions_and_settlement_names.txt file

    5/ Create a new text file, open it and add this line:
    medieval2.exe @my_mod.cfg

    6/ rename the text file created to my_mod.bat. To launch your mod you will use this file.
    To use the file_first method

    1/ Copy medieval2.preference.cfg and rename it my_mod.cfg

    2/ Open my_mod.cfg and add at the beginning:
    [io]
    file_first = 1

    3/ Create a new text file, open it and add this line:
    medieval2.exe @my_mod.cfg

    4/ rename the text file created to my_mod.bat. To launch your mod you will use this file. The files modified will be put directly in your main data folder.
    2/ Combined method

    If you have the same difficulties I had (so unpacking not working), the file_first method will surely result in a crash. The solution is to combine the 2 methods...

    Combined method:
    1/ Create a folder "my_mod" in your medieval total war 2 directory

    2/ Copy the file medieval2.preference.cfg and rename it my_mod.cfg

    3/ Open my_mod.cfg and add at the beginning
    [features]
    mod = my_mod

    [io]
    file_first = 1

    4/ Copy in the "my_mod" folder all these files/folders
    - 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
    - These folders are absolutely needed: data/world/maps/base and data/world/maps/campaign/imperial_campaign, as well as text/imperial_campaign_regions_and_settlement_names.txt file

    5/ Create a new text file, open it and add this line:
    medieval2.exe @my_mod.cfg

    6/ rename the text file created to my_mod.bat. To launch your mod you will use this file.
    Create a folder "my_mod" and put here all files you can use with the mod folder method. Put in your main data folder all mods that use texture changes.
    If you don't want to turn crazy (like I was about to do) you can also copy all files of your mod in the main data directory.

    EDIT: if you use a mod folder, you must copy in your mod folder the directories "world" and the files data\sounds\events.idx and data\sounds\events.dat (for these files don't forget to create the folders for them in your mod folder).
    You can avoid that, however you won't be able to play a campaign and you won't have any sounds in your game :p.

    II. Common errors

    A. The .strings.bin files

    The game use now several files at the format .strings.bin
    You just need the txt files, and the game will convert for you the files into strings.bin files the first time you will launch your game.
    If you need to change something in these files, just put again the file you need with the changes and delete the strings.bin file that you want to regenerate.

    You can find on the net the files you need (like the text folder files, here in english), you can also use a convertor or a tool to directly write in the strings.bin files.

    B. Mods that are modifying the map

    If you add a region, modify the ressources of one existing region, or simply use one mod avalaible on the net that add/modify the map, and if you had played a campaign, you will need to delete this file: Medieval Total war\my_mod\data\world\maps\base\map.rwm or if you use the file_first method it will be Medieval Total war\data\world\maps\base\map.rwm. Don't worry the game will regenerate this file the first time you will launch a campaign. Don't worry also if you get an unknown error when it generates it, simply start again the game and the second time the campaign will be launched normally.

    Credits (the article that helped me a lot):
    HowTo: Set up MTW2 for modding - alpaca

    Nota: I know I have surely forgotten many difficulties that could generate errors, I have simply summarised here my problems and how I solved them... just to avoid someone else to reinstall the game 30 times, like I did, and to permit people that would face the same problems I had to have here maybe a solution (I really tend to think that the localised versions are not working all the same way).
    Last edited by Ralendil; May 26, 2007 at 08:03 PM.

  2. #2
    Ralendil's Avatar Semisalis
    Join Date
    Oct 2005
    Location
    France
    Posts
    426

    Default Re: All tips to avoid unknown errors by the game when you install/create mods

    New tips…

    Well after testing a lot of time and modifying my game a lot I have discovered more errors labeled unknown errors and more things to avoid them.
    First thing to note… commonly the unknown errors appear when you start a campaign.

    1./ The unknown error linked to battle_models.modeldb

    When you reach the limit of models in battle_models.modeldb you won’t get an error at the start of the game. You will be able also to launch a custom battle. But if you start a new game you will obtain an unknown error.

    What is called a model?
    A model is not the battle model defined in the descry_unit.txt.
    Let’s give an exemple.. in this exemple you can see 2 models, the first is in blue, the second in red.

    11 galloglaich
    1 4
    54 unit_models/_Units/EN_Highlander/galloglaich_lod0.mesh 121
    54 unit_models/_Units/EN_Highlander/galloglaich_lod1.mesh 900
    54 unit_models/_Units/EN_Highlander/galloglaich_lod2.mesh 2500
    54 unit_models/_Units/EN_Highlander/galloglaich_lod3.mesh 6400
    2
    5 slave
    70 unit_models/_Units/EN_Highlander/textures/en_highlander_rebels.texture
    70 unit_models/_Units/EN_Highlander/textures/en_highlander_normal.texture
    41 unit_sprites/slave_Galloglaich_sprite.spr
    4 merc
    70 unit_models/_Units/EN_Highlander/textures/en_highlander_rebels.texture
    70 unit_models/_Units/EN_Highlander/textures/en_highlander_normal.texture
    40 unit_sprites/merc_Galloglaich_sprite.spr
    2
    5 slave
    66 unit_models/AttachmentSets/Final European Light_slave_diff.texture
    66 unit_models/AttachmentSets/Final European Light_slave_norm.texture 0
    4 merc
    65 unit_models/AttachmentSets/Final European Light_merc_diff.texture
    65 unit_models/AttachmentSets/Final European Light_merc_norm.texture 0
    1
    4 None
    11 MTW2_2H_Axe 0
    1
    19 MTW2_2H_Axe_primary 0
    16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002

    So my advice is, when you add a new model, test one by one them and to test if you have not reached the limit, start a new campaign.

    By the way you can extend the modeldb by changing this number (in bold)
    22 serialization::archive 3 0 0 0 0 701 0 0
    Apparently, we don't know, yet, the true limit.
    But someone has succeeded to push it to 739...
    Changing this number will permit, for the game, to load more entries of modeldb file. In the exemple I gave,
    11 galloglaich was the entry. So I presented only 1 entry.

    2. the unknown error of descr_banners_new.xml

    As I added entirely a new faction, I faced this unknown error. This error is linked to an hardcode limit. You can’t add a crusade banner for a new faction.
    So avoid to ADD something in the lines that begin by:

    <Banner Name="Crusade">
    <MeshesAndTextures>
    <MeshAndTexture Faction="England" Mesh="data\banners\holy_banner_crusade.mesh" DiffuseMap="banners\textures\holy_banner_crusade.texture" TranslucencyMap="banners\textures\holy_banner_crusade_trans.texture"/>

    BUT you can replace one faction that will never start a crusade… the Byzantium… (what I did).
    If you add a new faction in these lines you won’t be able to start a new campaign.

    3. How to change shared.txt and strat.txt

    First you need to find the files that were given by CA with the original text files in them.
    Secondly proceed to the changes.
    In third you will need to convert them. For that you will need to rename them and to launch the game to make the game converting them. (at this stage you will surely obtain a crash :p)
    Finally, you will rename them again to the correct name.

    Let’s give an example…
    You want to change something in shared.txt (we take this example, cause you will see after there’s an another problem with strat.txt)
    You download the file and make the changes.
    nota: if you have a localized version, you will surely need to use the file shared.txt of Rome Total War and translate several parts of the file (like I did).
    Now you need to convert the file. You copy your file in the text folder and rename it menu_english.txt. You start the game. Your menus will be empty (normal), you click on “exit” and the game crashes with an unknown error.
    THEN, you rename the obtained file menu_english.txt.strings.bin to shared.txt.strings.bin and delete menu_english.txt. Here you’re done, you have your converted file that can be used.


    For strat.txt, and don’t ask me the why, you need to put the strat.txt file if you want to see the changes you made. If you add only the strat.txt.strings.bin to the folder, you will see a lot of mentions that would not be displayed (all of the mentions in strat.txt.strings.bin :p).
    Nota: if you plan to modify it and have a localized version, note that the texts about the missions, at the end of the files, are unneeded. The right texts for the missions are in missions.txt. Like for shared.txt you will need to use the Rome Total War file and translate several parts of it (or you can translate the 1000+ lines also :p)

    4. An unknown error when you load a battle

    You can read on this site that a simple error in battle_models.modeldb would make your game crash at start (at least it was what I read :p). This is wrong… not entirely, but part of it is wrong.
    You will get a crash if you make an error in the numbers of models, or the number of letter for the textures lines. BUT you won’t see an error at the start if you make an error of the number of letters for the attachments. In that case, the game will load normally, but will crash when loading a battle WITH the unit where you have made the error.
    So, first start by finding the unit that cause the error (simple, start a lot of battles with testing all units one by one). Secondly, verify the number of letters of the attachment parts for this unit. Don’t forget that each upgrade is a different part of the file.

    5. An unknown error after adding a region

    [FONT=Verdana]The hardcoded limit is 200 (199 regions and 1 sea). If you have 200 regions you will get an unknown error. So you can add a lot of regions, but not above the limit...
    The vanilla limit, without modifying the sea colors is 195. There's 5 different colors for each sea, so if you put the same color for all seas, you will be able to reach the limit of 199 regions

    6. All errors I have not evocated

    There’s a lot I have encountered. You can get errors when you start a campaign if you modify badly your cfg file (and see the game working good for loading battles).
    You can also get errors at start of a new campaign if you make an error in descr_settlement_mechanics.xml(example of one is to remove a castle parameter or to add a city parameter but you CAN replace a parameter (like replacing a castle parameter to a city parameter))
    There’s a lot of errors that can appear if you start modifying the xml files. I would advice to modify and test^^. Only way to see what can work, and what can’t work.
    By example, I wanted to remove the need of a siege gear for all city levels, so I tried in first to remove, in descr_campaign_db.xml, the line:
    <siege_gear_required_for_city_level string="huge_city"/>
    I have got an unknown error… so I tried something different… I tried to remove the mention to the huge_city… again unknown error. I tried finally to change the line to that:
    <siege_gear_required_for_city_level string="none"/>
    And here it has worked :p…
    This example is to show you that testing every modification you are not sure about, is needed… Don’t forget that the test is starting a new campaign. Loading an existing campaign is not pertinent. You could load it perfectly and have an error that will forbid you to start a new campaign.
    Last edited by Ralendil; May 26, 2007 at 08:06 PM. Reason: updated for 1.2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •