Guide to crashes
The purpose of this guide is to explain what is causing the various types of crashes to desktop (CTD) in mods and provide some advice on how to fix them.
Before I begin I would like to point out that the best way to resolve a crash is to add the following line to the .cfg file
This will give you a log report, which contains the reason for the crash. Always check this to fine out which file is causing problems.
to = logs/system.log.txt
level = * error
If you think a file is causing problem change its name and see if this fixes the problem (if M2TW can't find a file it reverts to the default version). If this fixes the problem then you know this file is faulty.
Mod CTD and without starting
CTD on startup
Q: When you start the mod you get a black screen and the mod CTDs.
A: There is an erronous entry in the data\unit_models\battle_models.modeldb, normally a reference to an non-existant mesh or texture, or an entry is incorrect. You won't recieve any help in the log for this so you'll have to check your entries manually.
CTD on startup vRAM
Q: When you start the mod you get a black screen and the mod CTDs. The logs say you lack enough vRAM.
A: There is a texture with an incorrect path. This is usually a texture for a unit on the campaign map, not the battlemap. Check that all the paths are correct in the data\descr_model_strat.txt file.
Black screen CTD
Q: When you start the mod you get a black screen and it it will not disappear unit you hit the 'return' key. Often it's replaced with a black version of the intro.
A: This normally occurs when you sound system has been disabled. You can re-enable it by clicking on the 'Control Panel', then 'Administrative Tools', then 'Services', then scroll down in the pop-up until you find 'Windows Audio'. Starting this should fix this problem (if not reboot your computer).
Mod loads, then CTD without starting
Q: The game starts to load, then CTD.
A: This is usually caused by an entry in the data\export_descr_buildings.txt or data\export_descr_unit.txt, such as an incorrect entry. The log files should help.
Loading game CTD, with Insufficient video memory error message
Q: The game starts to load, then CTD and error log says there is 'Insufficient video memory'.
A: This is normally caused when you tell M2TW to look for an image file that doesn't exist. The two files most likely to cause this error are the data\unit_models\battle_models.modeldb and descr_model_strat.txt. Check both to ensure that all the image paths (eg models_strat/textures/southern_ambasador_papacy.tga) lead to an image file (.tga or .texture) and the spelling is correct.
CTD after removing regions
Q: After removed most of the regions the mod CTDs. The error message just says the mod has crashed.
A: M2TW requires a mininium of regions of regions (unsure how few), so try adding some more. Also you have to delete the data\world\maps\base\map.rwm file everytime you alter the data\world\maps\base\map_regions.tga file.
CTD after adding a lot of regions
Q: After adding a lot of new regions the mod CTDs. The error message just says the mod has crashed.
A: M2TW cannot have more than 199 regions and 1 sea, so try deleting some. Also you have to delete the data\world\maps\base\map.rwm file everytime you alter the data\world\maps\base\map_regions.tga file.
CTD after editing some regions, no map.rwm
Q: After moding the map_regions.tga file, deleting the map.rwm, and selecting a faction the mod CTDs without generating a new map.rwm file. The error message just says the mod has crashed.
A: This is caused by one of the following.
1) One or more regions does not have a black pixel representing a settlement.
2) One or more regions by the sea does not have a white pixel representing a port.
3) One or more of the pixels is the wrong colour, causing M2TW to treat it as a new region without a settlement.
4) One or more regions has the black pixel touching mutiple regions (it must be located inside only one region).
To resolve the first 3 you need to ensure all the pixels are the correct colour (even a small variation that is invisible to the human eye will cause the mod to crash). To resolve the 4th problem you need to move the black pixel.
CTD after adding some regions, map.rwm generated
Q: After moding the map_regions.tga file, deleting the map.rwm, and selecting a faction the mod CTDs but generates a new and complete map.rwm file. The error message just says the mod has crashed.
A: This can be caused by:
1) The RGB (Red Green Blue) colour of a region does not matching the colour in the data\world\maps\campaign\custom\origin\descr_regions.txt (usually the problem). Fixing the incorrect entry will solve this problem.
2) The settlement in the region is in an inaccessable area eg in a forest or up a mountain. Move the black pixel elsewhere.
3) Some graphics programs cannot generate map_regions.tga files that M2TW will accept. I had this problem when I edited the map_regions.tga file using Photoshop Elements 4.0 but not when I switched to Gimp.
Mod CTD during game
Loading or during game CTD, with no error message
Q: The game CTD and error log just says the mod has crashed.
A: This is normally caused by one of the files in the data/text folder not containing all the required information. It's often the data/text/expanded.txt but not always.
Faction selection CTD, missing region
Q: The mod crashes CTDs when you try to play as a specific faction, error message says a province is missing.
A: There are 4 files that deal with provinces:
The make sure the missing province appears in the first three of these and that the missing province is spelled correctly in all of them.
Q: Game crashes when you try to get the information about a unit or when you go to battle with a particular unit.
A: The data\export_descr_unit.txt info for that unit contains an error. Make sure the tabs and spaces are in the right place, information is not missing or duplicated, and that the 'soldier' line refers to a an actual unit (try not to change this).
Q: Game crashes at the start when you click the recruit on the recruit option of a settlement.
A: Either this settlement starts with a building this faction cannot have (this only causes a crash at the start of the game) or there's an error in the data\export_descr_buildings.txt file regarding one of the settlement's buildings.
5th turn crash
Q: The game crashes at the end of the fifth turn / start of the fifth turn.
A: I actually had this error, it's not a joke. This error is caused by the following trait in the data\export_descr_character_traits.txt file.
Trying to exclude one of the cultures caused the game to crash at the end of the fourth turn. Excluding other hidden traits can also cause crashes.
Effect Piety 3
20th turn crash
Q: The game crashes during the AI's turn at about turn 20 and the error log just says the mod has crashed.
A: I had this error and it took me a long time to fix it. This error occurred because I increased the number of children allowed in the data/descr_campaign_db.xml file. When the AI's family had more than 4 children the mod crashed.
Game crashes during the AI's turn
Q: The game crashes during the AI's turn and the error log just says the mod has crashed.
A: It's possible that the trigger for a trait is incorrectly written. I once had this problem when the trigger's 'WhenToTest' was 'GeneralAssaultsGeneral', rather than 'PostBattle'.
Another possible cause is that a culture has a trait excluded but the corrisponding 'antitrait' is not excluded. This causes a problem when a general or agent switches from a trait to its antitrait (due to a loss or gain of skill points).
Additional information on crashes and how to solve them is appreciated.