Tutorial:Building Buildings

From Total War Modding
Revision as of 21:27, 31 January 2021 by Vandy (talk | contribs)

So you want to build a building?

Buildings are a great feature in the game, and editing them can allow for a lot of fun new mechanics! New building chains can allows new units, new effects, and new landmarks. The best news of all is that most ideas with building chains are possible.

Vocabulary

I want to first cover some vernacular that we will be using throughout this tutorial. These terms are conceptual but critical to understanding what Creative Assembly is manipulating in their game files.

  • Key: A key is an identifier, a definition point in the database.
  • Id: An id is similar to a key in that it is an identifier, except it is a randomly generated number used in certain tables of the database.
  • Level: A level is each individual building that you can construct in the game. They can be one-off or individual, or they can be upgraded into other buildings. The Empire tier 1 barracks, tier 2 barracks, and the tier 3 barracks are each a level.
  • Chain: A chain is much like it sounds – a direct chain of buildings. In the images, below. each vertical set of buildings that can be upgraded is a chain. The tier 1 barracks, the tier 2 barracks, and the tier three barracks are each a level.
  • Building Availability Set (BAS): A building availability set is the link between building chains and the faction/culture/subculture that can build them.
  • Superchain: A superchain can be seen as a collection of various chains from different races/factions, which can save data space when linking to slot templates (the only way to link buildings to locations). For instance, all settled factions except for the Wood Elves (due to their unique building style) have their standard infantry building linked to the wh2_main_sch_military1_barracks superchain, which is available at all settlements. It consolidates the entirety of your buildings into one package.
  • Set: A set is more or less a visual effect that conveys a category. As you’ll see in the images below, “Military Recruitment” and “Infrastructure” are examples of buildings sets, which lump together various different building chains into a specific group.
  • Slot Template: The database (db) classification of various locations, and the union between buildings and regions. Slot templates allow you to lock buildings to specific locations (for example, landmarks). However, not every settlement has a unique slot template. For instance, Altdorf has the slot templates wh_main_special_altdorf_primary and wh_main_special_altdorf_secondary, while Bibali has the basic “wh_main_human_minor_primary_coast” slot template. As we see in an unmodded game, Altdorf has unique buildings in, while Bilbali does not, so we can infer that Creative Assembly had no need to add in a custom slot template for the latter.
Building-buildings-1.png
Building-buildings-2.png

Getting Started

First off, you’ll want to get your idea(s) in order. You want to make a building, but what will this building do? Where can it be built? Is this building locked to certain cultures/factions? How many levels will it have? Having an answer to each of these questions will help you carry on through the tutorial.

Now, you’ll want to open up Rusted Pack File Manager (RPFM) and the Assembly Kit. RPFM is where you’ll be peforming all of your work – the Assembly Kit is more of less going to be used as a glorified search engine.

Open up RPFM, go up to Packfile -> New Packfile. Right click this new packfile (called unknown.pack) -> Create -> Create DB (or, alternatively, press Ctrl+D)

Create each of the following files, replacing "new_file" in the topbar with a file name of your choice. I tend to keep the DB file name the same within a single mod:

  • building_chains_availability_sets_tables
  • building_chains_tables
  • building_culture_variants_tables
  • building_effects_junctions_tables
  • building_instances_tables
  • building_levels_tables
  • building_set_to_building_junctions_tables
  • building_superchains_tables
  • building_units_allowed_tables (Only needed if you will be linking units to the building)
  • building_upgrades_junction_tables (Only needed if you will have more than one level)
  • slot_template_to_building_superchain_junctions_tables

You will also have to add a few files for the localisation of the building mod, so let’s do that now. Press unknown.pack, and right click -> Create -> Create Folder (or Ctrl+F), and then create a folder named "text".

Within, right click the "text" folder and press Create -> Create Loc (or, well, Ctrl+L!), and make three files. They can be named anything, but I typically put a shared prefix within a single mod, ie. "mygreatmod_". Don't name them what I named them here, plop some prefix in front of it!

  • building_chains__.loc
  • building_culture_variants__.loc
  • building_short_descrptions_texts__.loc

That’s it for importing! In the future, you may need more tables such as effects if you’re going in to that, however this tutorial will not be covering that action.

Inputting Data TODO FINISH THE REST

The very first thing that I recommend is to go into the building_superchains table and delete all rows. If you have not changed around any hotkeys (which you can do by the way by going to Packfile -> Preferences), you can delete all rows in the table by clicking an entry in the table -> CTRL+A to select all in the table -> DELETE.

Let’s add in a new row by pressing CTRL+SHIFT+A. From here, we can add in your new key. It can be named whatever you want, but we advise that you rename it to something that’s not already a vanilla key or looks like it could be a vanilla key. You don’t want to assume vanilla keys, as it will make the game freak out. Depending on what I’m making, I either prefix with vandy or prussian, but you could go with whatever works for you. Just don’t assume vanilla keys.

I recommend writing an easy key, one that you can copy over through various tables and use interchangeable. If I were to make a new horde building for the Empire, I would probably call it “vandy_empire_horde_main” if it were the primary building, or “vandy_empire_horde_barracks” if it were the barracks. You could also easily do “empire_main” and “empire_barracks”, but keeping a unique prefex on all of your work helps with organization.

After that, go the slot_template_to_building_superchains_junctions. Don’t delete anything just yet! Here is where we actually want to link the building we are making to a location or locations. There are three columns we want to worry about: building_superchains, id, and slot_templates.

Note: If the building or building chain is not in here, then it will not show up in any settlements.

If you are making this into a horde building, you would assign it to the horde_primary slot for the main building, or horde_secondary for any others.

If you are making this into a settled building, you would have to have to input your building to all the different slot_templates. The four main slot_templates are

  1. wh_main_human_major_primary (a province capital’s main building)
  2. wh_main_human_major_secondary (any other building in a province capital)
  3. wh_main_human_minor_primary (a regular settlement’s main building)
  4. wh_main_human_minor_secondary (any other building in a regular settlement)

Remember, there are also unique slot_templates for all different resources, all unique locations, several new resources made for Warhammer 2, and some older and antiquated slot_templates such as “wh_main_dwarf_orc”, used for the Regional Occupation system in Warhammer 1 that is currently unused in Warhammer 2.

I’ll let you in on a little secret – typing out all the slot_templates is unnecessary and tedious. Open up the Assembly Kit real quick, go into the slot_template_to_building_superchains_junctions table and open up the Search function. Change the column filter to “building_superchain” and type in “wh2_main_sch_military1_barracks.” This will only show the junctions between the barracks superchain and all slot templates that the barracks superchain is available in. Thus, this superchain includes all beginner military superchains for each race – such as the Cemetary for the Vampire Counts. Grab the entire Slot Templates column from the Assembly Kit and paste it into the corresponding table in your mod back in RPFM. Secondly, take your building_superchain key and paste it in each entry of the column.

One last step – we need to assign unique id numbers to each of these entries. Now, Creative Assembly used random generated id numbers for their entries, and there are hundreds of thousands of entries within these game files. Thus, you probably can’t use 1 or 10 or 100 for any of these entries. I recommend being safe and using 8 digit (1906015) id numbers for each superchain entry.

If you did this right, this action should now apply that superchain’s availability to each and every settlement on the map. You’ll have to repeat this step for each new building chain.

Note: There is only the need for one superchain for a link of buildings you can upgrade, but you will need one superchain for each separate link of buildings.


Category:Unfinished