Projects Prereqs: Tying a project to a specific civ trait

StandardGaussian

Chieftain
Joined
Mar 8, 2017
Messages
15
I want to add a building (BUILDING_IMPERIAL_COURT) that can only be built after learning a particular Civic and only in the capital as a civ's trait. This is easy enough to add, though it causes a few problems. The build option will appear in all your cities, grayed out, since it's using BUILDING_PALACE as a pre-req and I don't know how to remove the entry otherwise.

I do, in fact, want the imperial court to have a build cost, but I don't want you to have to rebuild it if your capital gets taken, as that's a double-whammy for a civ whose trait is a strong capital. I'd be more than happy just attaching modifiers that change the BUILDING_PALACE for your civ, if it comes down to it. It seems to be the case that you can't actually replace the Palace, as the game seems to make sure you have specifically BUILDING_PALACE in your capital even if you have a valid (and working) entry under BuildingReplaces.

Given either case (either modifying the palace, or adding a new building), my intended solution, then, is to turn it into a Project. Completing the project "unlocks" the buffed Palace and it stays buffed even if your capital ends up changing. Projects seem to be gated entirely by Prereq Techs, Prereq Civics, Prereq Resources, Prereq Projects and Prereq Districts, though. I see no way of tying the Project to a specific civ trait, so I can't only make it appear for my civ. The completion modifiers can have the appropriate requirements, but the project still seems like it'd appear for every civ if the other pre-reqs are met.

Any advice? I tried to give a lot of context for my problem since there are usually many ways to skin a cat in the database system Civ VI seems to use. An alternate thought I had was to silently replace the city center district for my civ with an exactly identical one, whose only difference is that it counts as a new kind of district for project prereq purposes (like Brazil's Street Carnival), but I don't know what kind of havoc replacing the city center could cause, as I don't think that was ever intended. The same could be said of making a dummy resource, but again, weird side effects make the solution seem unpolished. It'd have to not appear anywhere... on the top resource bar, in the Reports tab, etc:. Dummy techs/civics have similar problems. I'm looking for the solution that requires the least amount of effort and messing with the game, of course.

I haven't found any effect types that directly address my problem. I either need to automatically grant my civ's intended capital bonuses when the appropriate civic is reached, which means I'd need to rebalance it due to it being free, or I need to figure out a way to make the player pay for the bonuses that doesn't seem obviously hacked together with duct tape.

I figured I'd throw this out there for you fine folks and see what kind of ingenuity I might be missing. Maybe there's a simple solution that I'm not seeing.

EDIT: Just prior to posting this, I realized I could attach a modifier to my civ trait the first time a BUILDING_IMPERIAL_COURT is built that would auto-grant it from then onwards, but that doesn't solve the "unbuildable building" problem in non-capital cities, and it just doesn't look right from a design point of view (why would the player expect a buildable building to be auto-built later?) It still makes the most sense as a Project and I'd still like to figure out how to do that.
 
Last edited:
1. There's a flag "Capital" in Buildings table - if it works this should make a building available only in the capital.
2. Is your building going to be a UB for a Civ (replacing anothoer one - which one?) or do you plan to have a building ONLY for the Civ, that noone else can build and has to replacement?
 
My first inclination was to make it a replacement for the Palace, but setting the "capital" flag auto-builds the building in addition to the palace. It looks like the game has separate logic to spot check whether your capital has a palace, and doesn't check if the palace has been replaced in the database.

If I only want the building buildable in the capital, but don't want it to auto-build immediately (it even ignores tech and civic prereqs, you get it as soon as you found your first city), I have to leave the "capital" flag false and make the building require the palace as a pre-req. That works, but it does make the building show up as unbuildable in the production UI of every other city I own.

Since I can't replace the palace, it'd have to be a standalone UB that doesn't replace anything else.
 
Is it possible to have UB that doesn't replace anything? That'd be interesting, actually.

Btw, did you set MaxPlayerInstances to 1? This will not solve "greyed-out" if the first one is not built, but the building should not be available to build after the first one.

Ok, another idea.
There's MODIFIER_PLAYER_RELIGION_ADD_RELIGIOUS_BUILDING that has the effect EFFECT_ADD_RELIGIOUS_BUILDING.
It's used to create several modifiers that allow buildings to be built. They all use parameter BuildingType. So, unless there is no additional check in DLL if the building is really religious, you can use it to allow any building to be built under specific conditions.
You may try to combine it with RequirementType REQUIREMENT_CITY_IS_OWNER_CAPITAL_CONTINENT, so basically you will allow to build a specific building in capital only.

If this works I will start to think that modifiers are cure for everything...
 
Also, you said that you didn't want it to be rebuilt after the captal is taken? If so, you cannot use ALL_CITIES collection (unless combined with Palace as PrereqBuilding).

Fortunately there's COLLECTION_PLAYER_CAPITAL_CITY, so actually this might work even without the Requirements. Don't know however if the modifer will be transferred to another Capital. Maybe Setting Once=1 and Perma=1 will prevent it?
 
The idea is to attach the modifier to the player trait, and then the trait modifier is the one that targets COLLECTION_PLAYER_CAPITAL_CITY to grant a building, so moving capitals is never a problem because the applying modifier isn't attached to any particular city. I can probably ignore the subject requirements too, though if it causes any issues I just need to use an inverted "CITY_HAS_BUILDING" requirement to see if I already have my UB, and grant it if I don't. Might run into problems if duplicate leaders are allowed, though, since the duplicate leader will have that same trait and the new modifier will apply to them too. It's odd that built-in collection types know who the "Player" is, but there is no in-game DB entry for players and you can't really address the player directly in any modifiers.

If this works I will start to think that modifiers are cure for everything...

For some reason, there's no "REQUIREMENT_PLAYER_HAS_CIVIC" like there is for techs, so to get a building buff unlock from a civic I had to attach a modifier with "EFFECT_ATTACH_MODIFIER" to the civic in question, which then attaches a modifier that applies the appropriate bonus to my civ trait, instead of attaching a modifier to the building in question directly (Since I can't gate the bonus behind a civic requirement, so it'd apply to everybody otherwise). I think clever use of "EFFECT_ATTACH_MODIFIER" can get around a lot of problems, since we can only use the effects, collection types, and requirements that have been pre-programmed by the devs. If the devs already did something in the neighborhood of what you want to do, it's really easy. If not, trying to trick the database into doing what you want is almost brain surgery.

In the end, I decided to just go with a normal UB that doesn't auto-build every time after the first. Since the build cost will be static, rebuilding the UB in event of losing your capital shouldn't be that bad, and I can factor that in when it comes to balancing.

Using MaxPlayerInstances=1 works like a charm, thanks for suggesting it! You have that little period of time where the UI build element shows up in cities other than your capital before you build the UB still, though I'm sure some UI LUA scripting can fix that. Overall it's a pretty minor hiccup.
 
Top Bottom