Results 1 to 17 of 17

Thread: How to Create an Area of Recruitment

  1. #1
    Hazbones's Avatar Senator
    Join Date
    May 2007
    Location
    Iwakuni, Japan
    Posts
    1,104

    Icon1 How to Create an Area of Recruitment

    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:
    1. Create a new folder anywhere on your pc and name it something like my_extracts
    2. 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
    3. NOTE: include the units table with all your units you want to assign to the custom building just for ease of copy/pasting
    4. 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).
    5. In PFM, click "Choose Pack Action" and Add a NEW Directory pointing to the my_extracts (or whatever name) folder your created
    6. "Choose Pack Action" again and ADD Files selecting each of the extracted tables from my_extracts
    7. 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
    1. Using PFM, open the new mod pack you created in the setup steps above
    2. Select the table; building_levels
    3. 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
    4. 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
    5. When you're done, Click SAVE in PFM
    6. 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
    7. 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
    8. 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".
    9. Select the next table; bldg_descriptions_texts
    10. NOTE: This requires another step that I will not yet include in this tutorial but should be added later
    11. 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
    12. NOTE: I WILL skip the loc file editing so that you can see what happens and know that your mod still works without it
    13. Save
    14. Select the next table; bldg_upgrades_junctions
    15. 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.
    16. 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
    17. Save
    18. (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)
    19. Lastly, select the bldg_units_allowed_table
    20. 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.
    21. 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

    1. 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)
    2. Using the latest ESF Editor (not PFM) open up the starpos.esf
    3. Navigate to the region that you want to add your custom bldg to.
    4. NOTE: a useful tutorial on how to navigate to the Regions Arrays is located HERE
    5. 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).
    6. 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
    7. Repeat these steps for all regions you want to include your custom bldg
    8. Save your work!
    9. 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.
    10. Cut the "jap_shogun" folder out of the "campaigns" folder and paste the jap_shogun directly under the "my_extracts" folder
    11. Now using PFM, create a new pack file using the my_extracts folder as the source
    12. Click on "Pack Actions" and select "Add Directory" choosing the my_extracts/jap_shogun folder as the directory
    13. You should now see in PFM: [your mod name] / jap_shogun / startpos.esf. If there are any other tables there, DELETE them.
    14. 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.
    15. 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...
    1. Using PFM, open the mod pack which contains your units.
    2. 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
    3. 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.
    4. Save your pack and make sure to put it into the data folder
    5. 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.
    Attached Files Attached Files
    Last edited by Squid; November 07, 2013 at 02:42 PM. Reason: Fixed BBCode Formating

  2. #2
    Hazbones's Avatar Senator
    Join Date
    May 2007
    Location
    Iwakuni, Japan
    Posts
    1,104

    Default Re: How to Create an Area of Recruitment with Buildings

    Tests:

    In the OP I have added the files I used to test this tutorial. You must play as HOJO to see the results in game.
    I created a test unit (samurai) and made them recruitable only by the Hojo in Sagami province.

    In the test game you'll see that the unit requires farms and the custom bldg I created.
    *NOTE in game the custom bldg is located where the roads slot would have been under province. There is no description of the bldg because I did not create a loc entry for the new bldg however, it looks like a sword dojo.

    You can recruit the custom unit in Sagami no problems... but look in Izu and you'll see the same unit under the castle's "Recruitment" bar.
    You can see the unit in Izu because there is a farm in that province (which is what I assigned my custom unit to) but you can't recruit there because I have a secondary recruitment bldg criteria (in the units_table) which requires you to have the custom bldg which only sagami has.

    I plan to make a mod which has a custom "provincial building" for each region so that people can start making their own AORs!
    Last edited by Hazbones; January 03, 2012 at 02:35 AM.

  3. #3
    Hazbones's Avatar Senator
    Join Date
    May 2007
    Location
    Iwakuni, Japan
    Posts
    1,104

    Default Re: How to Create an Area of Recruitment with Buildings

    Shameless bump...

    I have re-created this tutorial with all the new info and testing I have gathered. It works to an extent...

    In theory, you can create a unit, create a new building and assign the unit to it.
    Restrict the building you created to a single clan (meaning only 1 clan can build it)
    Assign a clan's units to this special building and in the faction_permissions_table allow other clans to train the same units as the home clan.
    The catch is that the non-home clans must capture the special building intact in order to recruit that clan's units from it. If the enemy destroys the special building then they do not have the capability to build it again themselves. They would have to try capturing another of the clan's special buildings in order to recruit that clan's units.

    As I said, it is a poor replacement AOR system but it serves it's purpose and makes things interesting.
    Last edited by Hazbones; May 23, 2011 at 11:15 PM.

  4. #4
    Radious's Avatar I came, I saw, I modded
    Join Date
    Mar 2009
    Location
    Czech Republic
    Posts
    11,083

    Default Re: How to Create an Area of Recruitment with Buildings

    How about AI, is it able to construct those buildings aswell?

  5. #5
    Hazbones's Avatar Senator
    Join Date
    May 2007
    Location
    Iwakuni, Japan
    Posts
    1,104

    Default Re: How to Create an Area of Recruitment with Buildings

    So far I have not had the chance to make sure the AI constructs the special bldg for it's clan but I will try it when I get back home from work. My testing so far has centered around making sure it worked for the player which it does with the caveots I explained above.

    I am not good at editing the AI behavior to make it WANT to build or recruit units. Perhaps someone can help? If the AI's priorities can be adjusted like setting the units that the special buildings recruits at a higher priority then maybe the AI will build them?
    Last edited by Hazbones; May 24, 2011 at 07:55 AM.

  6. #6
    Hazbones's Avatar Senator
    Join Date
    May 2007
    Location
    Iwakuni, Japan
    Posts
    1,104

    Default Re: How to Create an Area of Recruitment with Buildings

    Ok, I updated the OP with a test and fix to the tutorial Step #24. Now only 1 clan can build a specific FSB if you so desire.

    I am now trying to fix the problem where the AI doesn't want to construct its own Faction Specific Buildings.
    Does anyone know how to force the AI to construct certain buildings and units?
    Last edited by Hazbones; May 25, 2011 at 01:40 AM.

  7. #7

    Default Re: How to Create an Area of Recruitment with Buildings

    Quote Originally Posted by Hazbones View Post
    Does anyone know how to force the AI to construct certain buildings and units?
    You can have a read in hedge's new resource about AI, but the values for buildings are in cai_personalities_construction_preference_policy_building_junctions and cai_base_building_context_values.

    /Vragos

  8. #8
    Hazbones's Avatar Senator
    Join Date
    May 2007
    Location
    Iwakuni, Japan
    Posts
    1,104

    Default Re: How to Create an Area of Recruitment with Buildings

    Quote Originally Posted by Vragos View Post
    You can have a read in hedge's new resource about AI, but the values for buildings are in cai_personalities_construction_preference_policy_building_junctions and cai_base_building_context_values.

    /Vragos
    Check! That was what I needed. I will update this tutorial's OP when I get the chance to test those tables.

    Thanks!

  9. #9
    Hazbones's Avatar Senator
    Join Date
    May 2007
    Location
    Iwakuni, Japan
    Posts
    1,104

    Default Re: How to Create an Area of Recruitment

    SUCCESS!!!

    I have successfully created a custom bldg, assigned a unit to it, and got it to show up and function in game!
    That is not all... the custom bldg I have made distinct to a single province! Nowhere else can this custom bldg be constructed!

    You can now limit clan recruitment to specific regions (Area of Recruitment) using this tutorial.

    Updated the OP with the new steps in the tutorial...
    I have included a rar file attachment in the OP which if you extract it into your data folder (remove all other mods first) you can see the test unit and bldg I created and got to work in game.
    *You must play as HOJO for the test files to work

    If you find any problems with this tut please let me know!
    Last edited by Hazbones; January 03, 2012 at 02:20 AM.

  10. #10
    Hazbones's Avatar Senator
    Join Date
    May 2007
    Location
    Iwakuni, Japan
    Posts
    1,104

    Default Re: How to Create an Area of Recruitment

    If anyone would like to add the loc text to the custom building and maybe even an encyclopedia page I would appreciate it.
    I am not good at doing that but it would improve this tutorial for the community.

    Please attach your work to a PM and send to me. Make sure to include instructions how to do it and I will update the OP.

    The custom building in this tutorial is a "provincial building" with no other buildings requirements. You can write up any appropriate description you like for the encyclopedia page.

  11. #11
    Paladin94610's Avatar Senator
    Join Date
    May 2010
    Location
    A Motte & Bailey
    Posts
    1,035

    Default Re: How to Create an Area of Recruitment

    I think we also need to tick destruction terminator box. In case it is destroyed, it may be built again elsewhere on the map. The building must be both unique and indestructible like rice paddies or castle towns.
    Formerly Iberia Auxilia


  12. #12
    Artifex
    Join Date
    Oct 2012
    Location
    Germany, Baden
    Posts
    1,284

    Default Re: How to Create an Area of Recruitment

    The Kyoto Police from the Boshin campaign can only be hired in the Kyoto province. CA achieves this by adding a region resource requirement called "kyoto" to the units table. Instead of adding custom buildings to every province, I would try to add more region resources to the game.
    Units with region resources can be hired by one or more clans, depending on the entries in units_to_military_groups_permission table and units_to_exclusive_faction_premission table.
    My Mod:
    Shogun II Total Realism
    A realism mod for Shogun II, Rise of the Samurai and Fall of the Samurai

  13. #13
    Hazbones's Avatar Senator
    Join Date
    May 2007
    Location
    Iwakuni, Japan
    Posts
    1,104

    Default Re: How to Create an Area of Recruitment

    Quote Originally Posted by Destin Faroda View Post
    The Kyoto Police from the Boshin campaign can only be hired in the Kyoto province. CA achieves this by adding a region resource requirement called "kyoto" to the units table. Instead of adding custom buildings to every province, I would try to add more region resources to the game.
    Units with region resources can be hired by one or more clans, depending on the entries in units_to_military_groups_permission table and units_to_exclusive_faction_premission table.
    That was the very first thing I saw when I first thought about creating an AOR for Shogun 2 using the "region resource". I could never get it to work. I must have missed a table or entry somewhere. It would have made my mod a whole lot easier to make if I could just use the region resource option. If someone can figure this out, please let me know.

  14. #14

    Default Re: How to Create an Area of Recruitment

    First, you have to make a mod pack containing your new \db\region_unit_resources_tables and \text\db\region_unit_resources.loc files.
    Put the mod pack in the \steam\SteamApps\common\Total War SHOGUN 2\data folder.
    Then add your "region resource" to start_pos_regions_to_unit_resources in tweak.
    Open BOB, in the "Raw Data" menu go to the "EmpireDesignData/campaign" folder and check the "jap_shogun" box. On the pop-up menu select "all". Then press the "start" button to build the startpos.esf.
    When BOB starts TWS2 and the game asked if you want to load a mod pack select the mod pack you made that contains the db and .loc files.
    Once BOB has finished you need to add the new startpos.esf from the "total war shogun 2\modding\working_data" folder to your mod pack using the Pack File Manager (PFM). The startpos.esf has to go in the campaigns\jap_shogun folder.
    Then you can use your new "region resource" in the units table.

  15. #15
    Hazbones's Avatar Senator
    Join Date
    May 2007
    Location
    Iwakuni, Japan
    Posts
    1,104

    Default Re: How to Create an Area of Recruitment

    Thanks! +rep

    Wow, I must have been really close in my initial AOR trials. I think the only thing I missed was adding the "region_unit_resources.loc" file. Amazing how something so trivial could cause me to have to work so dang hard to find a work-around.

    It looks like I might be able to update my MBS mod after all!

    Is there a way to cut out the use of BOB and Tweak all together?
    I never liked those tools and if I can do this AOR without them, that would be great.

    If the Tweak table "start_pos_regions_to_unit_resources" is accessible in PFM and I add my resources there via PFM, what needs to be done in startpos (without BOB) to make this work?
    Last edited by Hazbones; April 01, 2014 at 01:13 PM.

  16. #16

    Default Re: How to Create an Area of Recruitment

    BOB and Tweak is the easier way. "start_pos_regions_to_unit_resources" will be written into the startpos.esf itself. Without BOB you either need to use the Shogun 2 converter tool(http://www.twcenter.net/forums/showt...pdate-30-03%29), or edit the startpos.esf manually. Should be somewhere under Compressed_Data>Campaign_Env>Campaign_Model>World

  17. #17
    Hazbones's Avatar Senator
    Join Date
    May 2007
    Location
    Iwakuni, Japan
    Posts
    1,104

    Default Re: How to Create an Area of Recruitment

    Ok thanks. I will give it a try.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •