Build Restrictions Module Preview

Prof. Garfield

Deity
Supporter
Joined
Mar 6, 2004
Messages
4,366
Location
Ontario
I'm putting together a sort of Lua template, which is to say a collection of useful modules that are already joined together to form a basis for scenario building (or converting) with Lua.

One of those modules is a module to automatically produce production restrictions available through civ.scen.onCanBuild. If you'd like features included in such a module, now would be a good time to ask.

I'm using Imperialism II as a testing scenario, since Imperialism has a lot of very natural building restrictions.

I've done a few things in this example/test. One thing of note is that I have a field that only allows a unit to be built if no units in a list can be built in that city. I changed the Militia unit so all tribes can build it, but the British and French can only build it in cities where they can't build their Riflemen/Voltigeurs. Another field makes it so Marines can only be built in cities that can also build either a Rifleman or a Voltigeur. So the French can build Marines in Brest, but the British can't, if they capture it, all with a relatively simple condition.

Freighters need a Steel Mill and World Port in the city.

Steel Mills need a size 8 city to be produced, and the city must have a bank. Grand Railway stations must have 2 of World Port, Factory, Light Industry.

canBuildSettings.lua is the file where the build restrictions are defined.
 

Attachments

  • ImperialismCanBuild.zip
    1.1 MB · Views: 245
Does everything that is included in this module work as best as you know? I'd like to use it for Cold War.
 
Does everything that is included in this module work as best as you know? I'd like to use it for Cold War.

Download my Lua Code Library and take the module from there. More features were added, and things were fixed. The imperialism file there will also have more examples.
 
Top Bottom