Author: uanime5
Original: How to split a region

Post 1
Spoiler Alert, click show to read: 
This tutorial explains how to split a region; and how to add new settlements, towns, ports, and farms to this region.

To add a split a region you will need to:

1) Download the Official mod tools using Steam.

2) Either purchase a version of 3D Max or download a student version of 3D Max.
http://students.autodesk.com/

3) Ensure you have put the relevant version of the cs2_exporter.dle plugin (default location "total war shogun 2\modding\max_exporter") in both the "C:\Program Files\Autodesk\[version of 3D Max]\plugins" and "C:\Program Files (x86)\Autodesk\[version of 3D Max]\plugins" folders. The [version of 3D Max] part refers to the name of which ever version of 3D Max you're using. If you don't put the plugin in the correct folder you will not be able to save your work as CS2 files.

I recommend reading this tutorial on the official modding tools
http://www.twcenter.net/forums/showthread.php?t=564514

and watching this video on 3D Max layers before attempting this.
http://www.youtube.com/watch?v=voxomHt7pkU

I'd also like to thank for spartan_warrior all his help.

Tweak Basic

Spoiler Alert, click show to read: 
1) Open Tweak, click on the "Tools" option and select DAVE.

2) Click on the "View" option, and select "Table Launcher".

This will bring up all the DB tables and Startpos entries.


Tweak New Region
Spoiler Alert, click show to read: 
1) Open the DB table regions.

2)
  • Click the "Add record" button to add a new row.
  • Copy and paste an existing record into the new record which is the same type as your new region.
  • Give this region will need a unique name, such as "jap_hyuka".
  • The r (red), g (green), and b (blue) columns are used to give your region a unique colour. In this example I use 80, 40, 190.

When finished click the Apply button.



3) Open the start_pos_regions.

4)
  • Click the "Add record" button to add a new row.
  • Paste an existing entry into this row.
  • Change the "region" column to your new region. In this example it's "Hyuka:jap_hyuka".
  • Ensure this region is assigned to the correct campaign. In this example the campaign is "jap_shogun".
  • Change the "enclyclopedia_order" column to a unique number. In this example it's "78".

None of the other settings need to be changed to add your new region, though feel free to edit them.

When finished click the Apply button.





5) Open the start_pos_region_religions.

6)
  • Click the "Add record" button to add a new row.
  • Assign your new settlement to "region" column. In this example it's "jap_shogun:Hyuka:jap_hyuka:2130427281".
  • Select "rel_buddhist" in the "religion" column, then select the percentage of people who follow this religion (1 = 100%).
  • Click the "Add record" button to add a new row.
  • Assign your new settlement to "region" column. In this example it's "jap_shogun:Hyuka:jap_hyuka:2130427281".
  • Select "rel_catholic" in the "religion" column, then select the percentage of people who follow this religion (0 = 0%).

When finished click the Apply button.





Tweak New Settlement
Spoiler Alert, click show to read: 
1) Open the DB table campaign_map_settlements.

2)
  • Click the "Add record" button to add a new row.
  • Copy and paste an existing record into the new record which is the same type as your new settlement. You need to give it a unique name, such as "settlement:jap_hyuka:saido".
  • Next change the "region" to the region your settlement is in. In this example it's "jap_hyuka".

When finished click the Apply button.



3) Open the start_pos_settlements.

4)
  • Click the "Add record" button to add a new row.
  • Paste an existing entry into this row.
  • Add your new settlement to the "settlement_id" column. In this example it's "settlement:jap_hyuka:saido".
  • Assign your new settlement to your new region. In this example it's "jap_shogun:Hyuka:jap_hyuka:2130427281".

When finished click the Apply button.



5) Open the start_pos_settlement_garrisons.

6)
  • Click the "Add record" button to add a new row.
  • Add your new settlement to the "settlement" column. In this example it's "settlement:jap_hyuka:saido:2145379080".
  • Assign a unit to garrison this settlement. In this example it's "Inf_Spear_Yari_Ashigaru".

When finished click the Apply button.




Tweak New Town/Port
Spoiler Alert, click show to read: 
1) Open the DB table campaign_map_towns_and_ports.

2)
  • Click the "Add record" button to add a new row.
  • Copy and paste an existing record into the new record which is the same type as your new town or port. You need to give it a unique name, such as "town:jap_hyuka:region_specialty".
  • Next change the "region" to the region your farm is in. In this example it's "jap_hyuka".
  • Finally change the "slot_type" to the type of town or port you want this region to have. In this example it's "SHO_region_specialty_ninja".

If you don't want this region to have a town then set the "slot_type" to "SHO_region_specialty_farm".

When finished click the Apply button.



3) Open the start_pos_towns_and_ports.

4)
  • Click the "Add record" button to add a new row.
  • Paste an existing entry into this row.
  • Add your new town/port to the "town_id" column. In this example it's "town:jap_hyuka:region_specialty".
  • Assign your new town or port to your new region. In this example it's "jap_shogun:Hyuka:jap_hyuka:2130427281".
  • If you want your new town or port to be built to a certain level then in the "building" column select the type and level of your town/port present in this region. In this example the building used is "SHO_Region_Specialty_Ninja_1_Hideout".
  • If you don't want this region to have a town then leave the "building" column blank.

When finished click the Apply button.





Tweak New farm
Spoiler Alert, click show to read: 
1) Open the DB table campaign_map_slots.

2)
  • Click the "Add record" button to add a new row.
  • Copy and paste an existing record into the new record which is the same type as your new farm. You need to give it a unique name, such as "rice:jap_hyuka:farm".
  • Next change the "region" to the region your farm is in. In this example it's "jap_hyuka".

When finished click the Apply button.



3) Open the start_pos_slots.

4)
  • Click the "Add record" button to add a new row.
  • Paste an existing entry into this row.
  • Add your new farm to the "slot_id" column. In this example it's "rice:jap_hyuka:farm".
  • Assign your new farm to your new region. In this example it's "jap_shogun:Hyuka:jap_hyuka:2130427281".

When finished click the Apply button.




Tweak New Trade Node
Spoiler Alert, click show to read: 
1) Open the DB table trade_nodes.

2)
  • Click the "Add record" button to add a new row.
  • Copy and paste an existing record into the new record which is the same type as your new trade node. You need to give it a unique name, such as "jap_philipeans".

When finished click the Apply button.




Post 2
Spoiler Alert, click show to read: 
3D Max Part 1: adding a new region
Spoiler Alert, click show to read: 
1) Using 3D max open the "total war shogun 2\modding\raw_data\EmpireDesignData\campaign_maps\sho_japan\Shogun2.max".

2) Press <M> to bring up the Material editor.

3) Click the "Add" button. This will create a new material at the bottom of this list.

4) Give this region a unique ID and Name. In this example I used 210 and Hyuka.



5) Click on the button in the "Sub-Material" column to bring up the sub-material menu.

6) In this menu rename the material. The name of this material has to contain the "land_" prefix and the name of the region from the "region" DB Table. In this example it's land_jap_hyuka.

Then click the grey box next to "Diffuse" and in the pop-up menu choose the colour you assigned to this region using Tweak. In this example it's R:80, G:40, B:190.



7) Select the modify tab and use the "cut" tool on the region you wish to split into two regions. In this example I split the Hyuga region.



8) Set the selection tool to "Polygon". Hold down <ctrl> and select all the polygons in your new region. In the image the selected polygons are all red.



9) In the "Polygon:Material IDs" "Set ID:" box enter the ID of your new region (210 in this example). This will assign these polygons to your new region. If done correctly these polygons will change to the colour of your new region.



10) Hide all layers except the Regions.cs2.

11) Hold down the <Ctrl> key and press the <A> key to select everything.

12) Press the 3DS button and in the pop-up menu select "Export", then select "Export selected". Export this file as the Regions.CS2 in the campaign_map folder you're editing.



Congratulations you've added a new region. Next we'll add buildings to this region.


3D Max Part 2: adding a new settlement, town, and farm to this region.
Spoiler Alert, click show to read: 
1) Unhide all the Settlements.cs2, Roads.cs2, and Mountains.cs2 layers.

2) Select a nearby settlement, hold down the <Ctrl> key and press the <c> key to clone it.

3) Move this new settlement to your new region. I recommend having a road run through your settlement.

4) Right click on this town, select "Object Properties", and rename this settlement to the name you added to the campaign_map_settlements. In this example it's renamed to "settlement:jap_hyuka:saido".



If you moved the original building to the new location, rather than the cloned building, then you'll also need to rename the original building.

5) Repeat steps 2-4 for any farm or town you want this region to contain. Make sure you give these new buildings the same names you gave them in the start_pos_towns_and_ports and campaign_map_slots. In this example the town is "town:jap_hyuka:region_specialty" and the farm is "rice:jap_hyuka:farm".



6) Hide all layers except the Settlements.cs2 [ports], Settlements.cs2 [settlements], Settlements.cs2 [towns], and Settlements.cs2 [trade nodes].



7) Press the 3DS button and in the pop-up menu select "Export", then select "Export selected". Export this file as the settlements.CS2 in the campaign_map folder you're editing.



Congratulations you've added new buildings to a new region.


3D Max Part 3A: splitting a land trade route.
Spoiler Alert, click show to read: 
1) Unhide and freeze all the Regions.cs2, Settlements.cs2, Roads.cs2, and Mountains.cs2 layers. This will prevent you accidentally selecting them.



2) Unhide the "Land_Trade_Routes.cs2 [Working]" layer.

3) Select a trade route running connecting two nearby settlements. Hold down the <Ctrl> key and press the <c> key to clone it.



4) Select one of the trade routes. Delete the vertices you don't need until you have a line of vertices going from your new settlement to another settlement.



5) Select the other trade route. Delete the vertices until you have a line of vertices going from your new settlement to different settlement.

If you've done steps 4 and 5 correctly you should now have two trade routes linking your new settlement to two other settlements.



6) Hide all layers except the "Land_Trade_Routes.cs2 [Working]".

7) Press the 3DS button and in the pop-up menu select "Export", then select "Export selected". Export this file as the land_trade_routes.CS2 in the campaign_map folder you're editing.


3D Max Part 3B: adding a new land trade route.
Spoiler Alert, click show to read: 
1) Unhide and freeze all the Regions.cs2, Settlements.cs2, Roads.cs2, and Mountains.cs2 layers. This will prevent you accidentally selecting them.



2) Unhide the "Land_Trade_Routes.cs2 [Working]" layer.

3) In the Create menu use the line tool to create a spline (a curve connected by two or more points) between the centre of a settlement and an existing trade route. Do not have this new trade route touch an existing trade route.



4) If you want the vertices to be visible then right click on this spline and select "Object Properties". In the pop-up menu go to the "Display Properties" and click the "Vertex Ticks" box.



5) Rename this spline. In this example I rename it "land:359".



6) If any vertex is in the wrong position you can move it by going to the Modify menu, selecting "Vertex"; then select and move this vertex.



7) Click on the Snap Toggle (magnet with numbers next to it). Next right click on this icon and in the pop-up menu click on the vertex box.

This will allow you to join two splines together.



8) Create two new splines that goes from land:359 to an existing trade route using the arc tool (line will make cause problems because the angle will be too sharp). Rename them land:360 and land:361.



9) Select the existing trade route. Hold down the <Ctrl> key and press the <c> key to clone it. The clone will be named land:362.

10) Select one of the trade routes. Delete the vertices you don't need until you have a line of vertices going from the existing trade route to land:360.

11) Select the other trade route. Delete the vertices until you have a line of vertices going from the existing trade route to land:361.

If you've done steps 10 and 11 correctly you should now have two trade routes connected to your new trade route.



12) Create a new spline that links the two trade routes together. Rename it land:363.



13) Hide all layers except the "Land_Trade_Routes.cs2 [Working]".

14) Press the 3DS button and in the pop-up menu select "Export", then select "Export selected". Export this file as the land_trade_routes.CS2 in the campaign_map folder you're editing.



3D Max Part 4: adding a trade node to the map.
Spoiler Alert, click show to read: 
1) Unhide all the Settlements.cs2 and Trade_Routes.cs2 layers.

2) Select a nearby trade node, hold down the <Ctrl> key and press the <c> key to clone it.

3) Move this new trade node to your new location.

4) Right click on this town, select "Object Properties", and rename this trade node to the name you added to the trade_nodes. In this example it's renamed to "trade_node:jap_philippines".

If you moved the original trade node to the new location, rather than the cloned trade node, then you'll also need to rename the original trade node.



5) Hide all layers except the Settlements.cs2 [ports], Settlements.cs2 [settlements], Settlements.cs2 [towns], and Settlements.cs2 [trade nodes].

6) Press the 3DS button and in the pop-up menu select "Export", then select "Export selected". Export this file as the settlements.CS2 in the campaign_map folder you're editing.



7) Unhide all the Settlements.cs2 and Trade_Routes.cs2 layers.

8) Ensure the Trade_Routes.cs2 layer is selected or you'll add all the new splines (a curve connected by two or more points) to the wrong layer.



9) In the Create menu use the line tool to create a spline between the trade node and an existing trade route. Make sure the spline connects to the existing trade route but not the new trade node.



10) Rename this spline. In this example I rename it "seatrade:232".

11) Create two new splines that goes from seatrade:232 to an existing trade route using the arc tool (line will make cause problems because the angle will be too sharp). Rename them seatrade:233 and seatrade:234.



12) Create a new spline that links all three new trade routes to the center of the new trade node. Rename it seatrade:235.



13) If you used line spline rather than arc smooth all the new splines. If their angle is too sharp TWS2 will ignore them, preventing anyone using your new trade node.



14) Hide all layers except the "Trade_Routes.cs2".

15) Press the 3DS button and in the pop-up menu select "Export", then select "Export selected". Export this file as the land_trade_routes.CS2 in the campaign_map folder you're editing.



3D Max Part 5: adding a port to this region.
Spoiler Alert, click show to read: 
1) Unhide all the Settlements.cs2, Regions.cs2, and Mountains.cs2 layers.

2) Select a nearby port, hold down the <Ctrl> key and press the <c> key to clone it.

3) Move this new port to your new region. Make sure most of this port is on land with a small part in the sea. This port won't work if too much is in the sea.



4) Right click on this town, select "Object Properties", and rename this port to the name you added to the campaign_map_towns_and_ports. In this example it's renamed to "port:jap_awa:nangogu".

If you moved the original port to the new location, rather than the cloned port, then you'll also need to rename the original port.

5) Hide all layers except the Settlements.cs2 [ports], Settlements.cs2 [settlements], Settlements.cs2 [towns], and Settlements.cs2 [trade nodes].



6) Press the 3DS button and in the pop-up menu select "Export", then select "Export selected". Export this file as the settlements.CS2 in the campaign_map folder you're editing.



7) Unhide all the Settlements.cs2, Regions.cs2, Land_Trade_Routes.cs2 [Working], and Mountains.cs2 layers.

8) Ensure the Land_Trade_Routes.cs2 [Working] layer is selected or you'll add all the new splines (a curve connected by two or more points) to the wrong layer.



9) In the Create menu use the line tool to create a spline between the centre of a settlement and the center of the port.



10) If you want the vertices to be visible then right click on this spline and select "Object Properties". In the pop-up menu go to the "Display Properties" and click the "Vertex Ticks" box.

11) Rename this spline. In this example I rename it "land:359".

12) If any vertex is in the wrong position you can move it by going to the Modify menu, selecting "Vertex"; then select and move this vertex.

13) Hide all layers except the "Land_Trade_Routes.cs2 [Working]".

14) Press the 3DS button and in the pop-up menu select "Export", then select "Export selected". Export this file as the land_trade_routes.CS2 in the campaign_map folder you're editing.

15) Unhide all the Settlements.cs2, Regions.cs2, Trade_Routes.cs2, and Mountains.cs2 layers. Ensure the Trade_Routes.cs2 layer is selected or you'll add all the new splines to the wrong layer.

16) In the Create menu use the line tool to create a spline between the port and an existing trade route. Do not have this spline touch either the port or the existing trade route.



17) Rename this spline. In this example I rename it "seatrade:227".

18) Create two new splines that goes from seatrade:227 to an existing trade route using the arc tool (line will make cause problems because the angle will be too sharp). Rename them seatrade:228 and seatrade:229.



19) Select the existing trade route. Hold down the <Ctrl> key and press the <c> key to clone it. The clone will be named seatrade:230.

20) Select one of the trade routes. Delete the vertices you don't need until you have a line of vertices going from the existing trade route to seatrade:228.



21) Select the other trade route. Delete the vertices until you have a line of vertices going from the existing trade route to seatrade:229.

If you've done steps 20 and 21 correctly you should now have two trade routes connected to your new trade route.



22) Create a new spline that links the two trade routes together. Rename it seatrade:231.



23) If you used a line spline instead of an arc one you'll need to smooth all the new splines. If their angle is too sharp TWS2 will ignore them, preventing anyone from trading with your new port.



24) Hide all layers except the "Trade_Routes.cs2".

25) Press the 3DS button and in the pop-up menu select "Export", then select "Export selected". Export this file as the land_trade_routes.CS2 in the campaign_map folder you're editing.


3D Max Part 6: adding new rigid_splines (campaign map borders)
Spoiler Alert, click show to read: 
Rigid_splines are used to draw borders on the campaign map. They're purely cosmetic but do make it easier to see where one region ends and another begins. Though you don't make new rigid_splines using 3D Max some of the information needed to make them is in 3D Max so they're included here.

1) Unhide the borders.cs2 and regions.cs2 layers.

2) Where your new region shares a border with another region draw two splines using the line tool (one for each region). In this example Hyuka only needs a new border with Hyuga.

You don't need to draw a border through parts covered by mountains. For regions separated by a river you need to draw the boundary on each side of the river.



3) In 3D Max find the name of all the borders belonging to the region that you've split. In this example they're "border:jap_hyuga:1", "border:jap_hyuga:2", and "border:jap_hyuga:3".

4) Go to the "working_data\campaign_maps\[campaign]\display\Borders" folder (replace [campaign] with the name of this campaign). This folder contains all the rigid_spline files for this campaign.

5) Copy to another folder all the rigid_splines belonging to the region you split.

6) Determine which rigid_splines you need to rename. In this example I need to rename "jap_hyuga_1" and "jap_hyuga_2" to "jap_hyuka_1" and "jap_hyuka_2" because both are now part of the Hyuka region. I also need to rename "jap_hyuga_3" to "jap_hyuga_1" because this region no longer has 3 borders.

7) Turn these rigid_spline files into text files using the Rigid spline converter:
http://www.twcenter.net/forums/showt...line-converter

8) Open the text files and change the region border entry to the new region border. In this example I need to rename "border:jap_hyuga:1", "border:jap_hyuga:2", and "border:jap_hyuga:3" to "border:jap_hyuka:1", "border:jap_hyuka:2", and "border:jap_hyuga:1".

9) Create a new text files (jap_hyuka_3 in this example) with the following information:
Code:
border:[region name]:[border number]
int1=1
int2=1
int3=1
numEntries=[number of entries]
Replace [region name] with the name of the region you want to give a new border. In this example it's "jap_hyuka".
Replace [border number] with 1 if this is the first border in this region, 2 if this is the second border in this region, etc. In this example it's "3".
Replace [number of entries] with the number of coordinates in this entry. In this example it's "8".

10) In 3D Max find the coordinates of the first vertices belonging to the new border in this region. In this example the X coordinate is -218.102, while the Y coordinate is -159.94.



11) Divide both coordinates by 39.37 (round to three decimal places). In this example the X coordinate becomes -5.540, while the Y coordinate becomes -4.062.

12) Enter the coordinates in the following manner (use tabs, not spaces). The 0.000 part is the Z coordinate.
Code:
-5.540    0.000    -4.062
13) Repeat for every other coordinate in this region border. When done this text file should looks something like this.

Code:
border:jap_hyuga:3
int1=1
int2=1
int3=1
numEntries=8
-5.540    0.000    -4.062
-5.543    0.000    -4.053
-5.561    0.000    -4.037
-5.574    0.000    -4.022
-5.583    0.000    -4.014
-5.592    0.000    -4.004
-5.601    0.000    -3.994
-5.611    0.000    -3.981
14) Repeat for every other new border you want to add. In this example I only needed to make another text file (jap_hyuga_2).

15) Convert all these text files to rigid_splines.

16) Using Pack file manager add these rigid_splines to the "campaign_maps\[campaign]\display\Borders" folder in your mod pack (replace [campaign] with the name of this campaign).



There's no guide for borders, bridges, coast, rivers, roads, or sea_groundtypes because Bob doesn't use any of these files when remaking the esf files.


Post 3
Spoiler Alert, click show to read: 
Bob Part 1, other files
Spoiler Alert, click show to read: 
Bob is located in the "total war shogun 2\modding\binaries" folder.

1) In the "Raw Data" column go to the "EmpireDesignData/campaign_map" folder and check the "sho_japan" box. On the pop-up menu select "all".





In the "Working" column select the following entries in the text/db folder: campaign_map_settlements, campaign_slots, campaign_map_towns_and_ports, and regions. Also ensure that the text/startpos_jap_shogun entries are selected.



If you edited either of the trade routes then in the "Working" column ensure that the trade_routes.esf is selected.



In the "Retail" column select the "data" folder.

Then press the "start" button to build the a mod pack, the regions.esf, and the pathfinding.esf.

2) Don't worry about any orange error messages. However the red messages mean that you've made a mistake in one of the files, so you need to edit the files it mentions.

3) One BOB has finished you need to add the new regions.esf and pathfinding.esf from the total war shogun 2\modding\working_data folder to the mod pack in the total war shogun 2\modding\retail\data folder using the Pack File Manager (PFM). The regions.esf and pathfinding.esf need to go in the campaign_maps\sho_japan folder.




Bob Part 2, startpos
Spoiler Alert, click show to read: 
Bob is in two parts because if you try to make the startpos.esf without using a mod pack containing the regions.esf and pathfinding.esf you made in Bob Part 1 then TWS2 will use the vanilla versions of these files instead. As the vanilla versions don't contain your changes the startpos.esf also won't contain your changes.

1) In the "Raw Data" menu go to the "EmpireDesignData/campaign" folder and check the "jap_shogun" box. On the pop-up menu select "all".

If you edited the sea trade routes then in the "Working" column ensure that the sea_grids.esf is selected.

When all the files are selected press the "start" button to build the esf files.



2) In order to create the startpos.esf BOB needs to start TWS2; so when prompted start TWS2. If you have the Steam version then you also need to have Steam running before you start TWS2.

When asked if you want to load a mod pack select the mod pack you made in Bob Part 1 that contains the pathfinding.esf and regions.esf you made. If you don't use a mod pack then TWS2 will use the vanilla versions of these files and produce a startpos.esf that won't work.

3) Don't worry about any orange error messages. However the red messages mean that you've made a mistake in one of the files, so you need to edit the files it mentions.

4) One BOB has finished you need to add the new startpos.esf from the "total war shogun 2\modding\working_data" folder to a mod pack using the Pack File Manager (PFM). The startpos.esf has to go in the campaigns\jap_shogun folder.

If you created the sea_grids.esf then this file will be in the total war shogun 2\modding\working_data folder and needs to go in the campaign_maps\sho_japan folder.





Mini map
Spoiler Alert, click show to read: 
Your new region will still work even if it hasn't been added to the mini map. This part is optional.

1) Go to the total war shogun 2\modding\working_data folder and copy the "japan_lookup.tga" file to another folder.

2) Open this file using an image editing programme (such as Photoshop or Gimp).

3) Select the part of the map where your new region is located. In this example I select it with the lasso tool.

4) Change the colour of this area to the colour of your new region. The region's colour is the one in the Regions DB table.



5) Add a black border along your region's new borders.

6) Save this file.

7) Put this file in the campaign_maps\sho_japan folder of your mod pack using the Pack File Manager (PFM).


Congratulations you've added a new region. If you want to add a new faction to this region I recommend this guide:
http://www.twcenter.net/forums/showt...-existing-ones
Spoiler Alert, click show to read: