WHAT THIS TUTORIAL DOES
This tutorial will show you how to create a new custom building to use in game. Basically, assigning these custom buildings to regions in startpos you can in effect create an Area of Recruitment for Shogun 2. Though it won't be as easy as previous TW titles, it does work in my tests.
BEFORE WE START- I am assuming that you have either A) created all your custom units already OR B) are using vanilla or other units already in the units table. I will not explain how to create units here, there are other wonderful tuts out there explaining this.
I also assume that you already know how to mod (basically) creating your own mod file and can proficiently work your way around Pack File Manager (PFM).
YOU WILL NEED- PFM (latest version) and ESF Editor
SETUP PROCEDURE:
- Create a new folder anywhere on your pc and name it something like my_extracts
- Using PFM open the latest patch with db in it and EXTRACT the following tables into the folder you created in the first step (IE: my_extracts): building_culture_variants_table/ building_descriptions_texts_table/ building_effects_junctions_tables/
building_faction_variants/ building_factionwide_effects_junctions/ building_level_required_technology_junctions/ building_levels/ building_units_allowed/ building_upgrades_junctions/ (optional) units_tables - NOTE: include the units table with all your units you want to assign to the custom building just for ease of copy/pasting
- Create a NEW mod pack using PFM. Name it whatever you like and place it in a handy location (NOT in the extract folder you created).
- In PFM, click "Choose Pack Action" and Add a NEW Directory pointing to the my_extracts (or whatever name) folder your created
- "Choose Pack Action" again and ADD Files selecting each of the extracted tables from my_extracts
- Now in PFM click on Save As in the file menu and name your mod pack placing it somewhere handy
Ok, we are ready to start building our FSB... (again, you need to have your units already created)
CUSTOM BUILDING PROCEDURE: This could be a custom building for a specific clan which you can assign units to or restrict the bldg to an individual province where you can create a whole group and restrict them to a that province
- Using PFM, open the new mod pack you created in the setup steps above
- Select the table; building_levels
- Add a NEW ROW and enter the new building name with all the appropriate fields completed. Repeat for as many bldgs in the table to your liking
- NOTE: I just cloned an existing bldg and changed the name (in Building ID Ref) so they did not match any other bldg already created
- When you're done, Click SAVE in PFM
- Now that you have buildings in the building_levels table, assign effects to them using bldg_effects_junction_table and the bldg_factionwide_effects_table
- NOTE: In my case, my bldg will only allow me to recruit a unit (with no effects) so I don't need to assign any effects to it. If you want effects from your new bldg, go ahead and input them into the tables indicated above
- NOTE (optional): In my mod, I want to make my custom bldg unique (can only have 1 in game) so I made sure to change the "Unique" column value to "True".
- Select the next table; bldg_descriptions_texts
- NOTE: This requires another step that I will not yet include in this tutorial but should be added later
- In the bldg_descriptions_text_table, you can ADD a new ROW and enter a custom Building IDRef for your FSB. If you do this, you will need to adjust any fields in your mod tables that refers to the Building_Description_Text. This is a .Loc file entry and so you'll need to fix your loc file in addition to this tutorial which I won't go into now. If you skip this part, your FSB will not have a description in game
- NOTE: I WILL skip the loc file editing so that you can see what happens and know that your mod still works without it
- Save
- Select the next table; bldg_upgrades_junctions
- This is simply where you link the bldgs you created into a chain for in game use. In my case, I have only a single custom bldg with no upgrades so I will skip this step. If you want your bldg to upgrade, add it to this table and link it to the next level(s) in the chain.
- NOTE: to make your custom bldg specific to a particular region, DO NOT add your custom bldg to an existing bldg chain. CREATE A NEW BLDG CHAIN and include your new bldgs there. You'll find out why later in this tutorial
- Save
- (Optional) If you want to restrict a bldg until a tech is researched, select the bldg_level_required_tech_junction_table and add your FSB and a linked Tech to it. (In my case I did not do this)
- Lastly, select the bldg_units_allowed_table
- ADD a new ROW and start entering data in the fields for your new bldg. Make sure that the Building ID Ref field matches all the custom bldg name(s) in all the other tables. (In my case I simply cloned an existing bldg and changed the ID field to match my tables). Add your units to the buildings.
- Save
Ok, that process created the custom building(s), added them to the upgrade chain and assigned the units to them. Now, we need to go through the steps of limiting the new custom bldg(s) to specific regions.
STARTPOS SETUP: To have an Area of Recruitment (AOR), you have to tell the game where you want your custom bldg (or bldg chain) to be built or else factions will start sprouting them up all over the place as soon as they meet the building requirements.NOTE: Remember that in Shogun 2, the startpos.esf is located in the data.pack
- Using PFM, open the data.pack in the Shogun 2 main directory and extract the startpos.esf into the my_extracts folder you created previously. (close PFM when done)
- Using the latest ESF Editor (not PFM) open up the starpos.esf
- Navigate to the region that you want to add your custom bldg to.
- NOTE: a useful tutorial on how to navigate to the Regions Arrays is located HERE
- In the Region Array_Building_Manager it lists all the buildings (and bldg chains) that you have available in the region you navigated to. Look for the field that has a building or special resource that you want to replace with your custom bldg and type in your custom building name (starting at the level you want it to start out with).
- NOTE: Unfortunately, it is impossible to create new slots to add your bldg or chain to so you'll have to replace something that is already there for this to work. It does not matter which slot you place your new bldg into but keep in mind what you are losing. If inputting a custom bldg chain I would recommend creating one with the same effects/bonuses as what you'll be replacing
- Repeat these steps for all regions you want to include your custom bldg
- Save your work!
- Next, we'll add the modified startpos to a new pack file. Look in your my_extracts folder and you'll see a "campaigns" folder. Inside that, you'll see a "jap_shogun" folder and within there will be your modded startpos file.
- Cut the "jap_shogun" folder out of the "campaigns" folder and paste the jap_shogun directly under the "my_extracts" folder
- Now using PFM, create a new pack file using the my_extracts folder as the source
- Click on "Pack Actions" and select "Add Directory" choosing the my_extracts/jap_shogun folder as the directory
- You should now see in PFM: [your mod name] / jap_shogun / startpos.esf. If there are any other tables there, DELETE them.
- If you see anything else besides [your mod name] / jap_shogun in the available folders then start over and try moving the location of your jap_shogun folder before adding it to the new pack.
- Save the pack
UNITS UPDATE (optional step): In my mod, I did not want my custom bldg to recruit units, I only wanted it to be a required structure to allow other bldgs in the region to construct specific units. If this is something you want to do then you need to add something to your mod's units_table...
- Using PFM, open the mod pack which contains your units.
- Go to the units_table and look for an 'unknown' column that has a building name for some of the units. This column allows you to enter a 2nd bldg requirement for a specific unit
- Simply add the custom bldg name that you created in this tutorial in that unknown column for each unit you want to give that bldg requirement to.
- Save your pack and make sure to put it into the data folder
- You will also need to create the proper .loc entries to give your custom bldg text descriptions in game. I do not know how to create encyclopedia pages with new bldgs so you'll have to research how to do that. That will be an added file that needs to go into your data folder.
So now you have 2 pack files (not including the loc and the optional step I mentioned above), 1 that has the tables that created the custom bldg and 1 file that contains the startpos which places the custom bldg on the map.
Put your 2 new mod packs into your TWS2 data folder, add the proper entries into the user script file and then fire up a new campaign. I would make sure to keep these 2 files together in the script. I have not tested this with a save game so someone can report if it works with current campaigns or not.
WHAT's LEFT TO DO:
You might have to play with the tables which influence what buildings a clan is interested in constructing (bldg priorities) if you notice the AI not using the slot where you put your custom bldg. That is another tutorial all together though not difficult to do. However, if you start the slot with a custom bldg using a modded startpos, then the AI has no choice but to use your custom bldg!
TESTED FILES: I have included an attachment rar with 3 pack files I used to test this process. Download and input into your Shogun 2 data folder. Make sure all other mods are removed before using!
What the test files include:
1 pack containing a custom HOJO unit I created (minus a loc file so what you'll see in game is a samurai with no info or encyclopedia entry)
1 pack with the modded startpos containing the custom bldg I created (in game it replaces the slot where the roads would be. It looks like a sword dojo icon but without a text description)
1 pack with all the building tables which create my custom bldg
*You need to also add these packs to your script file or activate using Mod Manager
*You must play as HOJO to make this test file work!
Enjoy
Please +Rep if this helped you or just feel sorry for me.