Corporations

3335d

CCtP Player
Joined
Jun 15, 2012
Messages
642
How would it be possible to create corporations using Lua? Basically, I would like to create Lua objects that could do the following:
  1. Produce "gold", "science", "food", etc. and store these values, with the actual values of these to one's empire determined by other functions (taxation, contracts,etc.)
  2. Response to the existence of specific "corporate buildings" (such status will be determined with SQL/XML)
  3. Be headquartered in a specific city, producing bonuses for that location.
  4. Starting based on technological, social, economic, and diplomatic state.
  5. Being able to grow from starting.


Any help is appreciated.
 
Yes, you can do all that. Civ5 Database modding is actually quite nice for adding new elements like this that interact solely with Lua. And UI is entirely accessible, so you could add a Corporation info panel and have it show in city banner.
 
Yes, you can do all that. Civ5 Database modding is actually quite nice for adding new elements like this that interact solely with Lua. And UI is entirely accessible, so you could add a Corporation info panel and have it show in city banner.

Is there anything analogous (even roughly) in your Éa mod? I'm not too good with Lua.
 
Not really to corporations, no. And you might get lost in there because it is so big. But there are a dozen or so new tables created so you could look at how that is done.

But you might want to add them as simple buildings instead, analogous to wonders. You could set cost=-1 (so not buildable) and then add them to a specific city (the headquarters) via Lua with whatever criteria you want. Buildings can have diverse global effects on a civ -- just look at wonders with known effects and see how it is coded in the Buildings table.

Even so, you would still have to do some Lua to set the criteria for adding the "corporation". And then you would need Lua for any effects that can't be added by existing Buildings xml tags.
 
Once you have it added (as a building or whatever) you could also add the icon to the city banner. You would need to edit CityBannerManager.lua/xml, but it's not a very difficult modification. You could even use a different icon for the headquarters (w/ a star analogous to Civ4 holy cities and headquarters).

I made a separate set of icons for holy cities and added them this way. That's in my mod if you want to take a look.
 
Once you have it added (as a building or whatever) you could also add the icon to the city banner. You would need to edit CityBannerManager.lua/xml, but it's not a very difficult modification. You could even use a different icon for the headquarters (w/ a star analogous to Civ4 holy cities and headquarters).

I made a separate set of icons for holy cities and added them this way. That's in my mod if you want to take a look.

Thanks for the help, Pazyryk.

However, I ran into a problem. I want to create an array of all of the cities in the world in order to assess their "corporation quotient": whether their yield output would be conducive to the formation of a corporation. I would also like to incorporate civilization bonuses to corporation formation based on overall yields. Is there any way you know to create such an array of cities and match them to their owners, with the ability to create both local and global bonuses?
 
Yes, it's all just Lua tables. You can make these contain any information you want. (Indexing is a bit of a pain since cityIDs are not unique across the world, only for a given player. But that's a detail.)

One question is whether you need to "persist" information from turn to turn, or if you can calculate everything you need at the time you need it. Life is much easier in the latter case. Just look at the wiki city object page to see what kind of info you can obtain about a city. Then you make your own formula to calculate corporation quotient. Then sort the table. Then do something.

1/2 the effort is learning basic Lua coding (which is all about tables). And the other 1/2 is learning Civ5 Lua methods for extracting information and changing stuff.
 
Yes, it's all just Lua tables. You can make these contain any information you want. (Indexing is a bit of a pain since cityIDs are not unique across the world, only for a given player. But that's a detail.)

One question is whether you need to "persist" information from turn to turn, or if you can calculate everything you need at the time you need it. Life is much easier in the latter case. Just look at the wiki city object page to see what kind of info you can obtain about a city. Then you make your own formula to calculate corporation quotient. Then sort the table. Then do something.

1/2 the effort is learning basic Lua coding (which is all about tables). And the other 1/2 is learning Civ5 Lua methods for extracting information and changing stuff.

The problem is that I'm only half-good at each. :crazyeye:
 
How would it be possible to create corporations using Lua? Basically, I would like to create Lua objects that could do the following:
  1. Produce "gold", "science", "food", etc. and store these values, with the actual values of these to one's empire determined by other functions (taxation, contracts,etc.)
  2. Response to the existence of specific "corporate buildings" (such status will be determined with SQL/XML)
  3. Be headquartered in a specific city, producing bonuses for that location.
  4. Starting based on technological, social, economic, and diplomatic state.
  5. Being able to grow from starting.


Any help is appreciated.

I will be adding the ability for Corporations to spread in version 5 of my current Corporations mod. Been waiting for BNW to continue. I am open to any suggestions you may have -- it's a work in progress.

http://forums.civfanatics.com/showthread.php?p=12272233
 
Back
Top Bottom