Adding building slots to cities in Napoleon is a similar process as in Empire. However modders that have in mind the files of Empire startpos.esf and regions.esf, will notice some important and obvious differences. Unfortunately we cannot still add new stuff in the game so the slots must be taken from other city or cities. In Napoleon we have more types of cities with 1 - 5 building slots. Also, the names of building slots have changed, while the type of buildings can vary and are not specific as in Empire. The last major deference is the addition of a height grid in regions.esf since city models in Napoleon are 3d. This last new entry was the main reason for the delay of this tutorial since the existing Esf editors could not edit Napoleon's regions.esf.
Erasmus's made an update for me so rep the man because without it's tool nothing of the following would be possible. This version is in beta stage and Erasmus is still improving that. But it is more than enough for the purposes of this tutorial. I use it only for rgions.esf changes. For startpos I use the old reliable and fast 1.4.3. As you will see when 1.5 will be ready, it is going to be the best Esf editor ever.
One of the major difficulties in Empire's similar process is the fact that modder cannot test the changes until he finishes entire modification. Finding an error, after that, is extremely difficult as this could have been happened in any step of the process. If you add the often possibility of an accidental error, the tutorial becomes a real headache even for experienced modders. In Napoleon I've organized the process in a way that testing points are appeared in several levels of the process, making easier the discovery of a possible mistake.
A. Working files
Startpos.esf
Regions.esf
Data.pack\db\campaign_map_settlements_tables
B. Tools
Pack File Manager
EsfEditor 1.5 beta (attached)
EsfEditor 1.4.3. For this tutorial I use a beta of 1.5 which is the only solution for editing regions.esf. For startpos I use 1.4.3 version after a make a small preparation with 1.5...
DataConv (attached). It is a spreadsheet that contains 3 useful sheets:
data sheet helps in copying stuff during modification,
startpos and
regions sheets are used for calculating building slot grids which change after conversions in startpos.esf and regions.esf files.
I. How to add building slots
In this tutorial we shall take a building slot from Estonia & Livonia and will add it in Courland.
Before start changes we have to make some preparations. First we'll find CAI_SETTLEMENT Id's for both cities which we shall need later. Using 1.5 editor, open startpos and go in \CAMPAIGN_ENV\CAMPAIGN_MODEL\CAI_INTERFACE\CAI_WORLD\CAI_WORLD_REGIONS find the regions Estonia & Livonia and Courland. Now go further in CAI_WORLD_REGIONS\ CAI_ REGIONS and note the CAI_SETTLEMENT Id in 3rd line of both in DataDataConv.
1. Using 1.5 editor, open starrpos.esf \CAMPAIGN_ENV\CAMPAIGN_MODEL\WORLD\REGION_MANAGER\REGIONS_ARRAY\REGION and find both Estonia & Livonia and Courland regions. Right click on every one
copy and
paste on REGIONS_ARRAY. After that delete the old records.
Save the file. In this way you can find easily both regions later, using 1.4.3 editor.
2a. Using 1.4.3 editor, open again startpos and go in Estonia & Livonia, in ...\REGION\REGION_SLOT_MANAGER\REGION_SLOT_ARRAY\. As you can see here there are all the slots of the region. The first 2 are the slots of Riga city. The second
settlement:eur_estonia_livonia:riga:settlement_2_slot:3 is the one we shall "borrow". For now, note the slot Id
861606940 and
delete this REGION_SLOT. Also though we are not going to make any changes in first
settlement_2_slot:1 note Id and the type of building from REGION_SLOT\BUILDING_MANAGER\BUILDING second line.
2b. Leave REGION_MANAGER and proceed in ...CAI_INTERFACE\CAI_WORLD\CAI_WORLD_BUILDING_SLOTS. Here we mast spot
eur_estonia_livonia:riga:settlement_2_slot:3. For that we shall use CAI_SETTLEMENT Id we already know,
1502.
Generally CAI_WORLD_BUILDING_SLOTS follow this order: if XXXX is CAI_SETTLEMENT Id of the city, then the next records are CAI_BUILDING_SLOTS that are outside city, as ports, towns, farms, etc. The 2 records before that (XXXX-1 and XXXX-2) are fortifications and road. From XXXX-3 and further are the building slot in city. There might be from 1 to 5 Id's depending on the size of the city.
In our case Estonia & Livonia is a 2 slot city so it has 2 CAI_ BUILDING_SLOTs. These must be XXXX-3 and XXXX-4 and since CAI_SETTLEMENT Id is
1502 these are
1499 and
1498. The
settlement_2_slot:3 is
1499 as we check in CAI_WORLD_BUILDING_SLOTS\CAI_BUILDING_SLOT. Here we can see the slot Id in first line we've already noted in DataConvSheet and the CAI_SETTLEMENT Id of Estonia & Livonia in third line. We'll change the Id in first line. We shall enter here the same Id of the other slot
861606940. In this way the slot we deleted will have no CAI Id and the remaining slot will have 2 CAI id's
1499 and
1498 (!!!).Why we've done that? To create our first check point. Save the file.
Check Point: In this point we just need to start the game successfully and nothing more. Start the game and enter in campaign map (do not hit turn button). In next image you can see Riga left only with one slot. The remaining building is in wrong position because we have not changed its grids yet.
If you can start the game, congratulations, everything has been made right. If a CTD happened return and try to find the problem. Keep a copy of your startpos if everything is O.K. so far.
3. Open
DataConv spreadsheet and in second sheet with startpos tables find the
1 slot. Open startpos and go in ...\REGION\REGION_SLOT_MANAGER\REGION_SLOT_ARRAY\ Estonia & Livonia. Go further in SETTLEMENT\SIEGEABLE_GARISSON_RESIDENCE.
Copy the basic grids from 10th (X) and 11th (Y) lines in ConvSheet 1 slot table.
Now we have the needed grids for the remaining slot, road and fortification. Let's change them.
Save the file and test.
As you can see now the building is in the right place.
Check Point: When a checkpoint is available we try just to start the campaign. If succeed then we keep a new copy of the working file. If a CTD happens try to find the mistake. If you cannot find it then use the last good copy and repeat the last steps after previous successful check point.
4. Open startpos and go in ...\REGION\REGION_SLOT_MANAGER\REGION_SLOT_ARRAY\ Estonia & Livonia. Proceed in ...\CAI_WORLD\CAI_WORLD_BUILDING_SLOTS and change settlement_
2_slot:1 to settlement_
1_slot:1 of the first slot since from now on Riga will be one slot city. Save the file. In next step will start modifying regions.esf file as well.
5. Go in
data\campaign_maps\nap_europe \ open
regions.esf using EsfEditor 1.5 and find Estonia & Livonia in Region_Data\Regions. Proceed in Settlement_And_Slots\Slot_DIscriptions, delete
settlement:eur_estonia_livonia:riga:settlement_2_slot:3 and in
settlement:eur_estonia_livonia:riga:settlement_2_slot:1 change 2 to 1. Do the same in second line. Save the file.
6. Open it again and go in the same place to change the grids as we did in startpos for the settlement_1_slot:1, settlement_road and settlement_fortification. To do that copy the basic grids from Regions\Settlement_And_Slots
88,65597 ; 108,6812 to DataConv in third sheet for regions.esf.
Now enter the calculated grids from sheet to regions.esf file.
You have to be extremely cautious with semicolons, the spaces before and after them if any, and the numbers of type 0,0xxxxxx since during copying it is easy to make a mistake which will cause CTD.
Save the file. We've finished working on Estonia & Livonia which has been downgraded in 1 slot city. Now we shall proceed with Courland's upgrading
IMPORTANT: From now on modded startpos.esf demands the modded regions.esf to be present and vice versa or you'll get a CTD.
Check Point: Test and keep a copy of both files. That was the last one so you need to be even more careful in next steps because there are many changes there. Follow tutorial to the letter and do not improvise.
7. Open startpos.esf with 1.4.3 editor and go ...\CAMPAIGN_ENV\CAMPAIGN_MODEL\WORLD\REGION_MANAGER\REGIONS_ARRAY\REGION and find Courland. Go further in ...\REGION\REGION_SLOT_MANAGER\ and clone the 1st REGION_SLOT_ARRAY. In first REGION_SLOT_ARRAY change settlement:eur_courland:mitau:settlement_
1_slot:1 to settlement:eur_courland:mitau:settlement_
2_slot:1, since from now on Mitau is going to be a 2 lot city.
8. Go in the cloned REGION_SLOT_ARRAY:
a) in REGION_SLOT change settlement:eur_courland:mitau:settlement_
1_slot:
1 to settlement:eur_courland:mitau:settlement_
2_slot:
3.
b)In first line change the Id and enter the one we have already copy in data sheet and have borrowed from Estonia & Livonia (861608300).
c) The same Id you'll enter in REGION_SLOT\SIEGEABLE_GARISSON 1st line replacing the existing one.
d) Proceed to REGION_SLOT\BUILDING_MANAGER\BUILDING and in second line enter a deferent type of building. I enter here
sCannon1_cannon_foundry. You can find building types and levels in db\building_levels tables.
e) Now we have to change the grids since Mitau now has 2 slots. Open startpos sheet and in
2 slot table enter the x and y grids of Courland which can be found in SETTLEMENT\SIEGEABLE_GARISSON_RESIDENCE as we did in step 3. Then copy from sheet the grids in both building slots, road and fortifications.
9. Last thing in startpos is to assign the necessary CAI_BUILDING_SLOT for our new slot in Mitau of Courland. It is there waiting from step 2b. Go in ...CAI_INTERFACE\CAI_WORLD\CAI_WORLD_BUILDING_SLOTS and find the cai slot
1499. This belonged to Riga's slot which we've already removed. Now let's assign it to Courland. Go in CAI_WORLD_BUILDING_SLOTS\CAI_ BUILDING_SLOT, change the Id in first line entering
861608300 and in third line change cai settlement of Riga
1502 with the one of Mitau
1482. All these Id's are in your data sheet. Save the file. We've done with startpos but we cannot test it until we finish as well with regions.esf changes for Courland.
10. Open regions.esf with 1.5 editor, go in Region_Data\Regions and spot Courland. Proceed in Settlement_And_Slots\Slot_DIscriptions and clone the second slot settlement:eur_courland:mitau:settlement_1_slot:1.
a) In settlement:eur_courland:mitau:settlement_1_slot:1 change in first and second line settlement_
1_slot:1 to settlement_
2_slot:1
b) Go in cloned Slot_Discriptions and change settlement_1_slot:1 to settlement_
2_slot:
3, in 1st and 2nd lines.
c) From Regions\Settlement_And_Slots copy basic grids in regions sheet in 2 slot table. Copy the calculated grids in settlement_2_slot:3 (cloned), settlement_2_slot:1, settlement_road and settlement_fortification.
Save the file, exit and have the last test. The job has been done.
The same procedure must be followed if you want to add more building slots, repeating the proper steps for the extra slots. Data sheet will be more useful in these cases.
11. There is a graphical issue with fortifications. To correct it you have to make a small pack or add the right db table and make your changes in your existing mod pack. In attached Files there is mine which you can use. Open the TSV, replace the cities with yours and change the number of slots accordingly. Then open the pack and import the TSV. Do not forget to activate your mod pack.