Defines a group of chains that share attributes across cultures/factions. Defines what structures you can convert something to when capturing buildings from another subculture
To create an entirely new structure for an existing chain, you need the table Building_levels and most of its dependencies (everything down to Campaign_settlement_display_building_construction) in your pack file. Effects, technology, units, and armed citizenry are optional depending on what you wish the structure to do, but if you're making more than one building, its better to grab them all at once anyway.
Therefore your Building_mod.pack should start with the following tables:
Spoiler Alert, click show to read:
Building_levels:
Spoiler Alert, click show to read:
The first step in defining a new structure is to define its basic attributes and give it a name that we can reference it with (AKA a key). I've chosen to add a fifth level to the hellenic major city line using the key: rom_HELLENIC_city_major_5_Crzy
As with most of this particular tutorial, cloning the row the official entry for the structure I wish to precede my one is the fastest way to get things done, in this case rom_HELLENIC_city_major_4, changing the levelname column to my new key, adding 1 to the level column, and changing the uniqueindex column to a unique value. You can also set a different createtime and createcost at this point, but it isn't neccesary to obtain a functioning structure.
Building_upgrades_junction:
Spoiler Alert, click show to read:
Next up is linking your new structure to the building you upgrade it from. Simply put the previous structure in the from column (in my case: rom_HELLENIC_city_major_4) and your new structure in the to column (rom_HELLENIC_city_major_5_Crzy).
Building_culture_variants:
Spoiler Alert, click show to read:
The final table required to get your structure to show ingame, once again cloning the previous building in the chain keeps headaches to a minimum. The important columns here are icon, shortdescription, and flavour. Icon is the name of a .png image with set parameters that will show in the UI whenever this structure is built, and the other two reference textual descriptions from the loc files that we will add later. If you cloned the row, you only need to change the building key to your new structure (rom_HELLENIC_city_major_5_Crzy) to get a working (if useless) version of your structure to show ingame. Yay
Campaign_settlement_display_buildings:
Spoiler Alert, click show to read:
Without the entry in this table, when your new building is constructed, it'll leave a large round hole in your settlement on the campaign map . However the keys it uses aren't those of our structure, we have to go to the table campaign_settlement_display_building_ids and make the link between our strucure key and the model key. It just so happens that the simplest method is to make both keys exactly the same (after cloning the previous structure again to fill the other columns).
key
buildinglevel_key
culture
unknown
sprawlpiece_level
sprawlpiece_type
unknown7
rom_HELLENIC_city_major_5_Crzy
rom_HELLENIC_city_major_5_Crzy
<blank>
0
Back in Campaign_display_buildings, once again clone the entry for the previous structure, change the key column to something unique, and displaybuilding column to the id you just defined.
key
buildingpath
displaybuilding_key
<unknownX>
50000
RigidModels\...\greek_city_major_4.rigid_model_v2
rom_HELLENIC_city_major_5_Crzy
<leave blank>
Finally, to enable the crane animations during construction and dismantling, go to campaign_settlement_display_building_construction, clone any 2 rows, give them a unique id, make sure one has "default" and the other "dismantle" in the constructiontype column and change the displaybuildingkey column to the id you defined.
Now your new structure has a model on the campaign map (for now, it will be the same as the previous level unless you have a compatible model to add in Campaign_display_buildings)
Buildings_level_required_technology:
Spoiler Alert, click show to read:
This table sets the level of technological advancement required before this building is elegible for construction. Very simple table, building key in the first column, technology requirements in the second column. Note that it is preferable to have all previous tech requirements, not just the one that finally unlocks the structure.
As my mod is for testing purposes, I wont be using this table
Building_effects_junctions:
Spoiler Alert, click show to read:
Time to make our building a little more useful. Effects defined here are things like a set income, % bonus to income, food, squalor, and the like. This table doesn't control garrisons or recruitment.
The table is fairly self explanatory. The first column is your structure key, second column is the key for the effect you want to give th structure (for a complete list of available effects, see effects_tables in data_rome2.pack), the third column describes how widly the effect will be applied, and the last three set the value for when the structure is in its default state, damaged, or completely ruined respectively.
I gave my city center structure just a single effect, a flat income increase of 3000 through subsistence (500 when damaged, 0 when ruined) with the following entry:
building
effect
effectscope
value
valuedamaged
valueruined
rom_hellenic_city_major_5_Crzy
rom_building_gdp_subsistence
this_building
3000
500
0
Building_units_allowed:
Spoiler Alert, click show to read:
This table sets which units can be recruited once construction is completed.
Only the effects of 4 columns in this table are known at this time, and they are the key (unique id number), building id (column building), unit id (column unit), and the experience the recruited unit will begin with (column XP).
Again, I'm only adding a single unit to my structure, Royal Peltasts starting with 3xp with the following entry:
key
building
unit
XP
enabled
unknown6
enabled7
enabled8
70020
rom_HELLENIC_city_major_5_Crzy
Gre_Royal_Peltasts
3
FALSE
0
FALSE
FALSE
Building_level_armed_citizenry_junctions:
Spoiler Alert, click show to read:
This table controls the garrison groups that will spawn if a settlement with this structure is attacked. Many pre-defined garrison groups are already defined in the armed_citizenry_unit_groups table, or you can create your own group using the armed_citizenry_units_to_unit_groups_junctions table.
The table comprises of 4 columns, a key (column id), building id (column buildinglevel), an unknown value, and the unit_group to be spawned (column unitgroup)
I'm going to add some decent melee units to my structure using the rom_hellenic_strong_melee unit group with the following entry
key
buildinglevel
unknown3
unitgroup
70030
rom_HELLENIC_city_major_5_Crzy
0
rom_hellenic_melee_strong
With our new structure functioning in a useful manner, it's time to add the appropriate UI elements to finish it off
building_culture_variants.loc:
Spoiler Alert, click show to read:
This controls the name your structure will display. The format for the key (column Tag) in this table is: building_culture_variants_name_<building id><culture id><subculture id><faction id> (subculture/faction only required if those fields are not blank in the culture_variants table)
Controls the little short piece of text that sits under the name. The format for the key in this table is: building_short_description_texts_short_description_<key defined in short description column of culture_variants table>
I'm not entirely sure where this shows up ingame, but it's typically used for several sentences describing the function of the structure. Key format: building_flavour_texts_flavour_<key defined in flavour column of culture_variants table>
Since I dont know where this shows up, I haven't bothered with an entry for testing purposes.
Tag
Localised String
Icon:
Spoiler Alert, click show to read:
The final object required to complete your new structure is a new icon for the UI. This must be a 66x66 pixel PNG image a filename exactly the same as the text in the icon column in the culture_variants table.
Add it to your pack with the filepath: ui/buildings/icons/<filename>.png
And thats all folks. Go take your new building for a spin, because it's now complete
Spoiler Alert, click show to read:
EDIT
Credit to Xil0 for this important detail, the tables which the AI needs to use your new structure
cai_base_building_context_values
Spoiler Alert, click show to read:
Clone a row, put in the key of your new structure.
cai_construction_system_building_values
Spoiler Alert, click show to read:
If you are adding a structure to the end of an existing subchain, find the key of the existing structure and replace the building_range_end_inclusive column with your structure. If you have created a branched sub chain, you will need to clone a row, and then replace the same entry as before with your new building.
Creating a new subchain or upgrade path is very simple, involving only 2 basic steps.
1) Creating a new subchain key, otherwise known as a building instance (you can also use an existing key, but I'll explain that later. Under most circumstances you will need a new key)
2) Linking 1 or more structures together to form the upgrade path of the subchain, much as you did to add a new structure to an existing subchain.
building_instances
Spoiler Alert, click show to read:
A very simple table, comprising of a key and an integer.
The key has the format <chain>_<instance> unknown, so the food instances of the port chain will use the key rom_Port_Food while the economic instance uses the key rom_Port_Trade. For this example, I'm going to be making a new port subchain, so I add the key: rom_Port_Crzy
The integer is the number of subchains from this group that can be built in a single region (1 city). In vanilla, this is set at 1 and used so that you cant build 3 cattle fams in a single region, and this is also how it shouls normally be used to create a new subchain (ie. 1 is a good value almost all the time). The interesting part of this is that multiple subchains can exist under a single instance which means if you put 2 subchains under an instance with a 1 in the limit column, only 1 of those subchains can be constructed in any region. This is how you can create mutually exclusive subchains and under this cicumstance you will be reusing an existing instance key.
building_upgrades
Spoiler Alert, click show to read:
Same as before, link the primary structure to the first of your new structures, then the first to the second and so on
And now we have a new subchain
Spoiler Alert, click show to read:
Adding to the major Roman port
Or download the buildings_subchains.pack attachment below to see it yourself
Creating a new chain requires 4 steps
1) Declaring the new chain, setting it's category and tying it to a superchain
2) Setting which culture/subculture/factions can use buildings in this chain
3 & 4) Some mess which CA just introduced with no apparent current use
building_chains
Spoiler Alert, click show to read:
3 important columns in this table. The key is the internal name for the new chain, and must be unique. The chain category looks to be used mostly by the AI functions, and has three used categories (military, happiness, money). The building superchain column ties it to the next step up the ladder, assigning the slot to be used by buildings in the chain.
My entry for a new equipment chain is as follows
key
tech_category_tab
tech_category_tab3
chain_category
in_encyclopedia
building_superchain
Crzy_Equipment_Chain
<empty>
<empty>
military
False
rom_MilitaryEquipment
building_chain_availabilities
Spoiler Alert, click show to read:
A shorterned version of building_culture_variants, buildings using this chain must match these entries in both tables.
id
building_chain
culture
faction
sub_culture
campaign
30000
Crzy_Equipment_Chain
rom_Roman
<empty>
<empty>
<empty>
building_chain_availability_sets_ids
Spoiler Alert, click show to read:
There is no apparent use for the chain sets yet, so just give it whatever name you want (I like CA's method of giving the same id as the chain to prevent mixups)
key
Crzy_Equipment_Chain
building_chain_availability_sets
Spoiler Alert, click show to read:
Linking the set to a building chain. As yet unknown use
chain
Set
Crzy_Equipment_Chain
Crzy_Equipment_Chain
NOTE: The first building in a chain must be set to level 0 in the building_levels table
Two final simple tables and then you can do whatever you want with your buildings
building_superchains
Spoiler Alert, click show to read:
Simple key declaration table, max_instances column appears to be unused (leave it at 1 as a default)
key
max_instances_per_region
rom_Equipment_Crzy
1
slot_template_to_building_superchain_junctions
Spoiler Alert, click show to read:
Sets whether structures using this superchain are built in the first slot (primary), the optional dock slot, or the generic secondary slots, and whether it is available in major or minor settlements. Multiple entries can be used to give access to several slots (eg. using both major and minor secondary slots allows for chains that can be used in both major and minor towns)
id
building_superchain
slot_template
72000
rom_Equipment_Crzy
rom_minor_secondary
Last edited by crzyrndm; April 14, 2014 at 03:28 AM.
Edit: having trouble locating the Campaign_display_buildings and Campaign_display_buildings_ids iv got the all the other tables but thos are they in a different .pack from the others. Here is what i have so far testbuilding.pack as far as tables go but i know im missing thos above
Last edited by Regoso; October 24, 2013 at 11:35 PM.
Added tutorial for creating a new structure for existing chain including example pack with completed new building (and edited pre-requisites so you can reach it in 4 turns.)
Originally Posted by Regoso
huzzah thank you very much for this
Edit: having trouble locating the Campaign_display_buildings and Campaign_display_buildings_ids iv got the all the other tables but thos are they in a different .pack from the others. Here is what i have so far testbuilding.pack as far as tables go but i know im missing thos above
Added tutorial for creating a new structure for existing chain including example pack with completed new building (and edited pre-requisites so you can reach it in 4 turns.)
Re: Comprehensive Overview of the Building System - Now with tutorial
Nice. I have a question though: Say i want to make a series of temples for the Afro-Arabian factions (and i do) when i specify that that chain of buildings is for that subfaction will it still allow those factions to build the normal set of eastern temples? If so then how can i stop that so that the Afro-Arabian factions can only build the A-A temples?
Re: Comprehensive Overview of the Building System - Now with tutorial
The easiest way to restrict a structure is through the cultural variants table. Instead of giving the temple to all eastern factions, make multiple entries using subculture restrictions (remember to add keys in the culture_variants.loc as well) for both Eastern and Parthian sub culture (the other two which fall under eastern culture). I dont think CA included a simple way to exclude a chain from a faction or sub culture.
Re: Comprehensive Overview of the Building System - Now with tutorial
Hmm.. i'm running into problems somewhere, but i'm not sure what it is. Game won't load to the Sega screen.
All i've done is copied the default eastern temples and renamed them and made them sub-culture specific. Would you mind taking a look to see if i'm missing something?
Re: Comprehensive Overview of the Building System - Now with tutorial
Renaming the one you want everyone else to have wasn't neccesary (you've now got a bunch of references to structures that don't exist). Just clone the row and add the two subculture references.
Last edited by crzyrndm; October 27, 2013 at 04:27 PM.
Re: Comprehensive Overview of the Building System - Now with tutorial
Originally Posted by crzyrndm
Renaming the one you want everyone else to have wasn't neccesary (you've now got a bunch of references to structures that don't exist). Just clone the row and add the two subculture references.
I only renamed the African-Arab specific temples though (because i had to switch what culture they boosted)
Re: Comprehensive Overview of the Building System - Now with tutorial
Originally Posted by Threadoflength
I only renamed the African-Arab specific temples though (because i had to switch what culture they boosted)
A) You shouldn't be renaming any vanilla buildings if you want other cultures to keep using them. You only need to add the entries to restrict them by sub-culture (you seem to have done this with the imperial chains).
B) You shouldn't be touching the very bottom level building at all. You've renamed the structure which defines a superchain, which means you've got 2 buildings trying to start the same superchain. What you want to do is include your new chain as part of an existing super-chain (african nations wont see the standard eastern structures becuase they don't meet the sub-culture requirement)
Here's what you need to do:
1) Clone the current temple chain you don't want the african subculture to have in cultures_subcultures, and restrict it to the other eastern subcultures.
2) Restrict your new chain to the african subculture.
3) Tie your new chain to the first level temple structure (individual chains start from the second level, not the first)
Don't go doing that all at once either, stop every few steps and make sure its working before continuing. It's much harder to debug all your changes at once, instead of 1-2 tables (you should also check your new chain by just tying it onto an existing one, like I did with the single structure in the OP to make sure all your structures are functioning)
Last edited by crzyrndm; October 28, 2013 at 01:24 AM.
Re: Comprehensive Overview of the Building System - Now with tutorial
Thanks for this... although I wish I saw it earlier before I spent about a week of trial and error figuring out how to add new buildings to the game lol.
Re: Comprehensive Overview of the Building System - Now with tutorial
Originally Posted by Xil0
Thanks for this... although I wish I saw it earlier before I spent about a week of trial and error figuring out how to add new buildings to the game lol.
No problem
Originally Posted by Caki
Do you know maybe is it possible to make a Hellenic building also buildable by Romans? If so what should I change?
Clone the rows in culture_variants, change it to Roman culture (remembering the .loc that links to it)
Building_Upgrades to link it to an existing roman building
That should be all thats required
Last edited by crzyrndm; October 31, 2013 at 03:37 AM.
Re: Comprehensive Overview of the Building System - Now with tutorial
Hmm I must be doing something wrong because I can't get it to work. Could you please do an example and let me download it so I could figure it out. If not then no worries you already helped enough whit this tutorial. Thanx
Re: Comprehensive Overview of the Building System - Now with tutorial
Working on examples for chain and super chain creation right now. Everything going to plan I should have both working and written up by tomorrow evening.
Re: Comprehensive Overview of the Building System - Now with tutorial
Originally Posted by crzyrndm
Working on examples for chain and super chain creation right now. Everything going to plan I should have both working and written up by tomorrow evening.
Cant wait.. Chain creation Ive got down.. but everytime I try to create a new super chain I never load to the Sega screen. I've tried everything I can think of. Thx!
Re: Comprehensive Overview of the Building System - Now with tutorial
Originally Posted by Xil0
Cant wait.. Chain creation Ive got down.. but everytime I try to create a new super chain I never load to the Sega screen. I've tried everything I can think of. Thx!
Heh, I may actually be the cause of your difficulties due to a misunderstanding of what chains/superchains actually are.
My initial definition of a chain is actually that of building_instances. An instance or sub-chain type is a grouping within a chain ie. rom_Port_Food for ports that focus on food over military or wealth.
A chain is a culture/faction specific grouping of structures that originate from a singular primary structure (original definition for superchains)
A Superchain is a group of chains that have similar characteristics across cultures and factions. Used primarily for setting up the links between a slot (name of the points where you can build a structure in each city) and groups of structures. Messing with these is probably unnecesary.
This makes creating a new sub chain (previously chain) a very simple affair requiring only these three tables: (roughly, if you want to do it properly you need a new instance as well)
All that is required is matching the instance and chain (you cant have the instance pointing to a city type and the chain to a port) and linking the structures together in building_upgrades.
One of the interesting possibilities that instances creates is that in a region you can set how many structures of that instance can be built. In vanilla, this is used to keep you to only one of each specific type of structure per region (one cattle farm for example), but you could also do multiple upgrade paths under the same instance and make exclusive structures (if you have one, you cant have the other)
Last edited by crzyrndm; November 01, 2013 at 01:34 AM.