Building Global Yields (?)

Joined
Jan 7, 2009
Messages
620
I know there is a funtion for global yield modifiers, where every city in the empire gets an X% boost to food, production, etc. Is there a way to give every city a flat bonus after building a certain building? I know the maritime CS and social policies do this, but is can the effect be tied to a building? Thanks.
 
Not through XML. You CAN do it through Lua, through the creation of invisible buildings. So you make a new building class and building that adds +1 food, set its <NoLimit> flag to true, and then use Lua to place them in each city at the end of the turn based on how many of the triggering building you have in your empire.

It's messy, but you can do it.
 
Thanks as always Spatz for a quick answer. Unfortunately it seems a bit too much trouble for a marginal gain. I'll stick with global modifier
 
I'll stick with global modifier

That's basically what I did. I'd wanted a SMAC-style "Sky Hydroponics Lab" building that'd add +1 food to all cities, so I'd looked into this. In the long term, I decided it wasn't worth the trouble, and just made it add +2% food in all cities instead.

It'd also be possible to do this in Lua without invisible buildings, by simply adding a flat amount of food to each city at the end of each turn. I actually do something along these lines in my mod for when you start in a later era; there's a Head Start period where your cities are given extra food, production, and research, to help you get up to speed. The thing is, it's got three major drawbacks: first, that the UI doesn't reflect this at all; second, the AI doesn't understand it at all; third, that the amounts aren't multiplied by any +X% buildings in the city if you do it this way (although you CAN make it do so through yet another Lua function).

Finally, there's another way I haven't mentioned, through Lua: find the hex the city sits on and increase its yields as appropriate. This would have its own set of problems, though.

Basically, again, not worth the effort. It's something they should have made easier for us from the start, but at least in this case there's a somewhat acceptable substitute available.
 
Back
Top Bottom