Dear fellow modders,
I wrote some scripts for analysing the template_map.xml. Those scripts might be helpful if you want to edit a specific tile but you are not sure which one.
It consists of two scripts. One for python (3.x needed) which parses through the xml and writes a new txt file. The maxscript script then creates new planes in 3ds max which resemble the templates and assignes the textures of the templates (like terrain.tga, attribute.tga etc)
Those scripts aren't very polished yet, but do work. So if they are useful for you, you are free to develop them further according to your needs and publish them!
~~ Explanation ~~
Python Script "Battle_Template_Analyse.py"
- Here you can edit the path where you saved the template_map.xml
- edit the area, where the templates should be loaded (rectangle. The coordinates are in the down left and upper right)
- you can also specifiy, which template type should saved in the txt file. Eg land_normal, land_ambush etc.
Code:
import xml.etree.ElementTree as ET
tree = ET.parse("E:\\S2_Moding\\working_data\\campaign_maps\\bos_japan\\Template_map.xml") #edit path if necessary
root = tree.getroot()
#area, which should be analysed. For complete boshin map its -280,-280 (down left) to 280,280 (upper right). Only integers!
range_x = range(-130,-10)
range_y = range(-200,-120)
#type in the templates you want to filter. For boshin map templates: land_normal, land_ambush, land_bridge,fortified_settlement, naval_normal, port_assault
filt = "fortified_settlement"
Maxscript "import_battle_templates.ms"
Here you can also edit the variables to your paths and which files you want to load.
Currently i have a problem with the "end of file" loop. It does not work for me, therefore i specified a "max_count" after which the scripts terminates. You can edit this max_count (if eof does not work for you either) to fit the lines of your txt files (which gets created by the python script above)
Example of the templates of Sanuki island:
Code:
--load file
in_name = "E:\S2_Moding\3dsmax_templates.txt"
in_file = openFile in_name
count = 1 -- for testing, delete count if you want to use the whole file
template_bmp = "attribute.tga" -- defines the template bitmaptexture which should get loaded. Possible are attribute, deployment_attack_east/north/south/west, tactical, terrain
max_count = 500
mat_ID = 16 -- defines, which material in the material liberary is used
game_path = "E:/Steam_Libary/steamapps/common/Total War SHOGUN 2/data/" -- base path, where you saved the template tgas
campaign_map_tools.zip