[GS] <BuildingPrereqs>

Riker13

King
Joined
Nov 9, 2001
Messages
859
Location
UK
Hi all,
Can a building have two prerequisite buildings needed to build it?
Regards
Riker13:crazyeye:
 
No. When multiple entries are provided for the same Building, any one of the listed PrereqBuildings will do.

Code:
<Row Building="BUILDING_ARMORY" PrereqBuilding="BUILDING_BARRACKS"/>
<Row Building="BUILDING_ARMORY" PrereqBuilding="BUILDING_STABLE"/>
Also Terracotta Army works the same way, as does the Broadcast Center and Film Studio.
 
Yes. You can create a building with many prerequisites. I'm using code similar to what is below for one of my mods and I've confirmed that it works properly. The only minor annoyance is that the helper text still says that only 1 building is required. That text appears to be hardcoded somewhere that I have not found yet.

Code:
<Row Building="BUILDING_D" PrereqBuilding="BUILDING_A"/>
<Row Building="BUILDING_D" PrereqBuilding="BUILDING_B"/>
<Row Building="BUILDING_D" PrereqBuilding="BUILDING_C"/>

However, if all the PrereqBuildings are mutually exclusive (like the Barracks/Stable mentioned in previous comment), then only 1 PrereqBuilding will actually be required.
 
Code:
	<BuildingPrereqs>
		<Row Building="BUILDING_NATIONAL_MUSEUM_LRS" PrereqBuilding="BUILDING_STONEHENGE" />
		<Row Building="BUILDING_NATIONAL_MUSEUM_LRS" PrereqBuilding="BUILDING_HANGING_GARDENS" />
		<Row Building="BUILDING_NATIONAL_MUSEUM_LRS" PrereqBuilding="BUILDING_PYRAMIDS" />
		<Row Building="BUILDING_NATIONAL_MUSEUM_LRS" PrereqBuilding="BUILDING_ORACLE" />
		<Row Building="BUILDING_NATIONAL_MUSEUM_LRS" PrereqBuilding="BUILDING_GREAT_LIGHTHOUSE" />
		<Row Building="BUILDING_NATIONAL_MUSEUM_LRS" PrereqBuilding="BUILDING_COLOSSUS" />
		<Row Building="BUILDING_NATIONAL_MUSEUM_LRS" PrereqBuilding="BUILDING_PETRA" />
		<Row Building="BUILDING_NATIONAL_MUSEUM_LRS" PrereqBuilding="BUILDING_COLOSSEUM" />
		<Row Building="BUILDING_NATIONAL_MUSEUM_LRS" PrereqBuilding="BUILDING_GREAT_LIBRARY" />
		<Row Building="BUILDING_NATIONAL_MUSEUM_LRS" PrereqBuilding="BUILDING_MAHABODHI_TEMPLE" />
		<Row Building="BUILDING_NATIONAL_MUSEUM_LRS" PrereqBuilding="BUILDING_TERRACOTTA_ARMY" />
	</BuildingPrereqs>
Only one is ever required in order to construct BUILDING_NATIONAL_MUSEUM_LRS in the same city.
 
Thanks guys for answering, Contravity I did try it your way and I dont know how you got it to work but it does just as LeeS says, by having:
<Row Building="BUILDING_D" PrereqBuilding="BUILDING_A"/>
<Row Building="BUILDING_D" PrereqBuilding="BUILDING_B"/>
(Which is what I want in my mod just two buildings to build main building not three)
All it did was allow either Building A or B to allow Building_D they were not mutually exclusive.
Im not denying you got it to work but it dont for me :(, can I have some more information on how you done it, LeeS can you weigh in again please.
Regards.
 
Last edited:
Little bit of a spoiler, but here is my exact code from my upcoming progressive defenses mod (will get released if I can ever figure out how to use criteria to exclude a game mode, i have a thread with no replies yet :sad: ). Can exclude dlcs and mods, but not game modes apparently *sigh*.

I am using the city defenses as the tiered building for the city center with walls as the "tier 1" building. All of the wall based "upgrades" are "tier 2", however, I opted not to have them mutually exclusive because they represent equally weighted minor improvements to the basic wall infrastructure. The "tier 3" "capstones" represent a theme for that particular city and provide weak or strong bonuses depending on how much you want to invest in city defenses.

This actually show 2 different capstone buildings that have different number of prereq buildings. I do have those 2 capstone buildings mutually exclusive with each other, but that shouldn't make a difference.

The in-game text for each capstone building will still say that only 1 is required, but they are not available to build until all of the prereqs are completed. Note: the BUILDING_TSIKHE_TALUS_UPGRADE is a replacement for BUILDING_TALUS_UPGRADE so the major capstone doesnt require both even though both are in the list.

From BuildingPrereqs:
Code:
        <!-- Classical era defense and upgrades -->
        <Row Building="BUILDING_TOWER_UPGRADE" PrereqBuilding="BUILDING_WALLS"/>
        <!-- Classical era defense and upgrades -->

        <!-- Medieval era defense and upgrades -->
        <Row Building="BUILDING_KEEP_UPGRADE" PrereqBuilding="BUILDING_WALLS"/>
        <Row Building="BUILDING_MOAT_UPGRADE" PrereqBuilding="BUILDING_WALLS"/>
        <!-- "tier 3" upgrade -->
        <Row Building="BUILDING_HERALDRY_CAPSTONE" PrereqBuilding="BUILDING_TOWER_UPGRADE"/>
        <Row Building="BUILDING_HERALDRY_CAPSTONE" PrereqBuilding="BUILDING_KEEP_UPGRADE"/>
        <Row Building="BUILDING_HERALDRY_CAPSTONE" PrereqBuilding="BUILDING_MOAT_UPGRADE"/>
        <!-- "tier 3" upgrade -->
        <!-- Medieval era defense and upgrades -->

        <!-- Renaissance era defense and upgrades -->
        <Row Building="BUILDING_TALUS_UPGRADE" PrereqBuilding="BUILDING_WALLS"/>
        <Row Building="BUILDING_TSIKHE_TALUS_UPGRADE" PrereqBuilding="BUILDING_WALLS"/>
        <!-- Renaissance era defense and upgrades -->

        <!-- Industrial era defense and upgrades -->
        <Row Building="BUILDING_CASEMATE_UPGRADE" PrereqBuilding="BUILDING_WALLS"/>
        <!-- "tier 3" upgrade -->
        <Row Building="BUILDING_BLOCKHOUSE_CAPSTONE" PrereqBuilding="BUILDING_TOWER_UPGRADE"/>
        <Row Building="BUILDING_BLOCKHOUSE_CAPSTONE" PrereqBuilding="BUILDING_KEEP_UPGRADE"/>
        <Row Building="BUILDING_BLOCKHOUSE_CAPSTONE" PrereqBuilding="BUILDING_MOAT_UPGRADE"/>
        <Row Building="BUILDING_BLOCKHOUSE_CAPSTONE" PrereqBuilding="BUILDING_TALUS_UPGRADE"/>
        <Row Building="BUILDING_BLOCKHOUSE_CAPSTONE" PrereqBuilding="BUILDING_TSIKHE_TALUS_UPGRADE"/>
        <Row Building="BUILDING_BLOCKHOUSE_CAPSTONE" PrereqBuilding="BUILDING_CASEMATE_UPGRADE"/>
        <!-- "tier 3" upgrade -->
        <!-- Industrial era defense and upgrades -->
 
And this will allow my x-building to need two or three types of other buildings to build, not just any of the two or three?
 
I've never had the game interpret the table in that manner but it might be because of the combination of the MutuallyExclusive buildings at the end of the prerequisites chain and the disparity in the prereqs chain between those two buildings.

__________________

I have made the game lock up completely by the structure of a Prereqs-Chain, however.

Before R&F you could make a building its own prerequisite and thereby lock the building from ever being buildable or purchasable so it could only be acquired in a city by a Modifier or by an lua script. The alterations to the game DLL from R&F simply made the game go into a hard-lock when a city was founded and there was such a 'self' prerequisite setup in table <BuildingPrereqs>.. Took me quite a while to find the cause since the game never made any database errors -- just locked upon founding the first city in the game because the lua script that is used for the City ProductionPanel could not get "answerback" from the gamecore for the list of valid buildings the city could construct.

___________________

Also, when a Building is listed as a replacement in table <BuildingReplaces> you don't need to list it separately as a prereq for other buildings. I don't think there is any negative impact or altered behavior of the game if you do so, but it is not needed. Stave Church, Madrasa, Film Studio, etc., are not listed as prereqs for the Religious Buildings, the Research Lab, or the Power Plant buildings. The game will automatically equate the Replacement as being the same as the building it replaces. However you still have to list in a separate row the prereq for the replacement building.

Copy/Paste from a discord convo:Consider the contents of this table from the Vanilla Buildings file
Code:
	<BuildingReplaces>
		<Row CivUniqueBuildingType="BUILDING_FILM_STUDIO" ReplacesBuildingType="BUILDING_BROADCAST_CENTER"/>
		<Row CivUniqueBuildingType="BUILDING_MADRASA" ReplacesBuildingType="BUILDING_UNIVERSITY"/>
		<Row CivUniqueBuildingType="BUILDING_STAVE_CHURCH" ReplacesBuildingType="BUILDING_TEMPLE"/>
		<Row CivUniqueBuildingType="BUILDING_ELECTRONICS_FACTORY" ReplacesBuildingType="BUILDING_FACTORY"/>
	</BuildingReplaces>
Then consider the contents within the same file for table <BuildingPrereqs>. Here we see both the Temple and the Stave Church needing a Shrine:
Code:
	<BuildingPrereqs>
		<Row Building="BUILDING_TEMPLE" PrereqBuilding="BUILDING_SHRINE"/>
		<Row Building="BUILDING_STAVE_CHURCH" PrereqBuilding="BUILDING_SHRINE"/>
But we never see any of the Tier 3 Religious Belief Buildings requiring a Stave Church
Code:
		<Row Building="BUILDING_CATHEDRAL" PrereqBuilding="BUILDING_TEMPLE"/>
		<Row Building="BUILDING_DAR_E_MEHR" PrereqBuilding="BUILDING_TEMPLE"/>
		<Row Building="BUILDING_GURDWARA" PrereqBuilding="BUILDING_TEMPLE"/>
		<Row Building="BUILDING_MEETING_HOUSE" PrereqBuilding="BUILDING_TEMPLE"/>
		<Row Building="BUILDING_MOSQUE" PrereqBuilding="BUILDING_TEMPLE"/>
		<Row Building="BUILDING_PAGODA" PrereqBuilding="BUILDING_TEMPLE"/>
		<Row Building="BUILDING_STUPA" PrereqBuilding="BUILDING_TEMPLE"/>
		<Row Building="BUILDING_SYNAGOGUE" PrereqBuilding="BUILDING_TEMPLE"/>
		<Row Building="BUILDING_WAT" PrereqBuilding="BUILDING_TEMPLE"/>
Similarly, we see that the Madrasa requires a Library (like the University the Madrasa replaces), but nowhere do we see the Madrasa listed as a Prereq for the Research Lab.

-- end copy/paste

For a replacement building you should ensure it is linked to a TriatTtype that is then linked to a Leader or Civilization Trait to ensure the game properly parses how to handle the Prerequisites when another building requires the Default building as a prerequisite.
 
Last edited:
Back
Top Bottom