I want to make a simple modding task (just for learning the stuff) but I find it hard to find examples on the net. As a programmer I am used to googling and reading blogs full of examples for cases similar to the one that troubles me.
But when it comes to Civ modding, I find few or no examples at all.
So anyway, what I would like to do (apart from tweaking DB values through SQL or XML files), is to modify, for example, a city's production output by a factor, based on certain conditions.
In particular, I have this in my mind: When the player (human or AI) is at Era 'X' I would like the buildings of the previous era (those that became available when a tech from the previous era was researched) to be built twice as fast. Those buildings of two eras before the current era, to be built three times faster etc.. So I thought, this sounds like a +100% modifier (for the previous era, +200% for the two eras before etc) to the city's production when building old building types.
I have already modded a lot of values through SQL or XML, and I usually like to play really slow games in really big maps which means I get to found cities even at the late eras. Those cities are part of my plan for victory, usually, but they need a lot of time to advance and become useful and catch up with the rest of the country. I would like to give the a production boost for old types of buildings, emulating the increase of the development's speed as time passes. I mean, I certainly don't need 60 turns to build a monument in my newly founded city, when I need only two turns to build, let's say a granary, in another city in my civ. The production output may differ a lot, but it doesn't seem real.
Which brings me to the other thing I had in mind. A production pool, or food pool, for boosting low production or low food cities.
For example suppose the average production per city in my civ is 15. I would like all (or some of) the cities that produce more than that, to save a portion of their production, then the sum of all this would be distributed to cities that produce less than 15, according to their needs (cities that produce 4 would receive more than cities that produce 10, etc).
So how could I achieve such functionality?
Do I have to hook on some Lua events? which are these event?
How would you achieve similar modding goals?
What I need is actual coding examples on how you do things. The Civ V lua api is less than helpful...