How to make a free building?

Forcystus

Chieftain
Joined
Sep 22, 2007
Messages
62
Location
Everywhere
I want to make a building that increases gold yield from plantations that is free for a civilizations cities, preferably after Calendar is invented. Here's my general idea on how I might do this. It's supposed to be a mock trait essentially.

Create a building class and building with the max number of instances 0.

Create a replacement building for said civilization with desired effects. No art defines and no civilopedia entry.

Under free building classes, put said class and under replacement buildings put new building.

The question is, would this work? Has somebody done something similar and gotten it to work?
 
There are a few different ways to do what you're asking. For instance, if you give a building <FreeStartEra>ERA_ANCIENT</FreeStartEra>, then it'll be created automatically in every city you found, ever. While this'd affect all players equally, you can also do what you've described for creating a version as a UB for one civ, and give everyone else the generic version that does nothing. Unfortunately, this can't be tied to a specific technology without Lua.

There's an alternate mechanism for this that leverages the Policy tables to give some building various bonuses, using a simple start-of-game Lua trigger, but doing that requires significant alterations in other areas, and so is only useful if you already intended to do that sort of thing. I use this system heavily in my mods for a variety of uses, so once it's in place it's easy to expand.

It's easy enough to use these free-building mechanisms to give certain effects to cities in a trait-like system; one advantage is that, unlike traits, you can make it go away after a certain point simply by having a Lua script remove the buildings and/or policies used. In my mythology mod (currently under construction), I do exactly this once you decide to end the mythological age; it's not trivial to code, but it's not too difficult.
 
Back
Top Bottom