How to add functionality to a new table?

omniclast

Prince
Joined
Aug 27, 2014
Messages
478
New modder, simple question. If I want to create a new modifier for a Virtue or Technology that is not defined by an existing table in the game files -- like, say, a virtue for reduced improvement build times -- how would I go about creating and implementing the new table?

So for example, CivBEBuildings.xml has a table called Building_SpecialistYieldEffects that increases specific specialists' base yields. There is no such table in the policies or techs files, so I can't create a virtue or tech that adds +1 Food to Growers.

It would be pretty easy to copy the same table structure from Buildings to Policies, but how would I make the game recognize and implement the new table? Is this typically done through Lua or DLL?

(As a side note... it seems silly to me that these tables were not defined globally, like PlayerPerks, so that the same modifiers would be accessible to virtues, techs, buildings or affinities. That would probably eliminate a lot of redundant code, and it would mean I'm less likely to run into simple modifiers that are defined for one game element but not another.)
 
Welcome to our world of pain!

To fully integrate a new table into the game requires extensive DLL modding - search the CivV forums for the "Unified Yields" thread (edit - which is here)

You can also use Lua to achieve (some of) the same effects - put it's not pretty and involves a lot of code to do basic things.

The "de facto" way to achieve a lot of these "buildings can do it but policies/techs can't" effects is to use hidden buildings. There are several threads over on the CivV C&C forum on how to use hidden buildings - suggest you start there.
 
If you want to create a policy that provides an effect from the buildings or playerPerks table, there should be a way to do it.

In civ5 I had a code snippet that allowed people to use just XML to have a policy give a building. It should work for BE but I haven't got around to testing it in BE. Assuming it works than you would be able to have policies do effects that buildings can do by putting the effect on the building and then having the policy grant the (unbuildable aka dummy) building. Buildings can provide playerPerks so this would also allow policies to grant perks.
 
Back
Top Bottom