2 Attachment(s)
Template_map.xml - Python and 3DS Max Scripts for analysing the battle templates (beta]
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:
Attachment 361043
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
Attachment 361042
Re: Template_map.xml - Python and 3DS Max Scripts for analysing the battle templates (beta]
This is actually awesome. Makes making battle maps easier. I mean the terrain from the campaign map that will be used for the battle map. Have you tested it already?
Re: Template_map.xml - Python and 3DS Max Scripts for analysing the battle templates (beta]
Indeed. It might help if you want to certain points, eg a chokepoint a certain look. But I haven't tested it yet.
What I will test is, too see, if I can give the whole of sanuki island the same battlemap. Later I want to test, how easy it is to let certain attributes (maybe buildings?) to appear on the maps.
I also added an image of the terrain templates of sanuki island.
Re: Template_map.xml - Python and 3DS Max Scripts for analysing the battle templates (beta]
It does look interesting. I was busy with some battlemaps related things. But i didn't had that much time for it. I do know how it actually works to integrate a certain part of the campaign map towards a specific battle map. But, not much time to really work on it. I did manage to add different climates to a certain area of the campaign map that gets rendered when you do a battle.