[MiniMod] AutoBuild Buildings in Holdings (and Generator Script)
Generated minimod to automatically select buildings to build in your holdings. I didn't want to make it an complete cheat, and in trying to do so I ended up with a slightly convoluted scheme which currently appears to function.
I don't think there are any huge outstanding issues, though in particular, various MiniMods might have issues that need to be discovered and worked through; though none were glaringly obvious.
Adding this to an in-progress game should not cause any problems; since it does create events, removing it might do so, though you can disable it (via config menu), and wait a few months, and all queued events should have went away.
Note that the script is currently only guaranteed to be compatible with python 2.7. Also note that it requires the python library
Jinja2 to run.
Updates:
- Uploaded generated files for 2.7; so far script updates have not necessary with new patch.
- Updated 2/4/2017 with changes to how it determines build_time and build_cost modifiers. It now parses technology.txt, job_actions, and event_modifiers and attempts to check for the total build_time/build_cost modifier from all sources before it starts building something. Due to the large number of possible combinations, it maps the number found to a evenly distributed 10 point scale based on the theoretical max modifier (which is usually 99% based off a chancellor with crazy stats.) Also added support for parsing zipped mods (e.g. steam mods) when considering what minimods to generate. This version also added a requirement of the python jinja2 library. Attached as dist_ab-17-2.zip
- Updated 1/11/2017 with a hotfix for 17-1d. My internal changes introduced issues with ports being built in the wrong places and re-enabling autobuild after disabling it. Steam / ModDB links below are updated. Script attached as AB 17-1d Fix.zip.
- Updated 1/11/2017 with more internal changes. Did lots of things to make the files smaller. It certainly generates minimods faster (down to seconds again after creeping up to minutes for some of the bigger mods.) I did some experiments with control flow tracking through logging and dramatically reduced the number of scope blocks so it should execute faster. In theory. Attached as AutoBuild 17-1d (CK2 2.6).zip.
- Updated 1/7/2017 with a hotfix to the previous file. I forgot a tab character and well, that's pretty bad news in python. Worse, in this case, it lead to a logic error that I didn't notice for half a day. Whee. Fix attached as AutoBuild 17-1c hotfix (CK2 2.6).zip.
- Updated 1/7/2017 mostly with back end changes to take advantage of new modding features and generate shorter, better mod code. Attached as AutoBuild 17-1c (CK2 2.6).zip. A consolidated zip with the minimods regenerated with 17-1c is available at ModDB and linked below.
- Updated 1/2/2017 to fix an issue that only seemed to effect the Elder Kings minimod. Note that 17-1 (attached as AutoBuild 17-1 (CK2 2.6).zip) is a fairly major rewrite of the internals of the script (and to a lesser extend, the generated mini mod files) in preparation for a future design overhaul.
- Updated 12/26/16 for general compatibility with 2.6. Added support for hospitals, fixed trade posts and family palaces. Menu is now sorted, and more important options are at the top. Fixed various minor issues/edge cases with other mods. Available as (AutoBuild 16-12 (CK2 2.6).zip)
- Updated 8/22/15 for general compatibility with 2.4.4. Script attached (AutoBuild-CK2 2.4.4-version1.zip)
- Updated on 5/12/15 to fix an issue with double billing and one with the AGOT 0.9.5.
- Updated on 1/6/15 to fix issue with pagans and prestige. dist_ab_1_6_15.rar
- Generated for Vanilla 2.3 autobuild-dist for 2.3.4 version 1.zip
- Generated for Vanilla 2.2.1 and versions for various existent mods.
- Now ignores buildings with 0 build time. This pertains to odd buildings in the AGOT mod, but shoudln't affect any other mods.
- Now uses location = { port = yes } to avoid trying to construct buildings with port = yes in the definition in landlocked provinces.
- Updated for 2.2; in my limited testing it seems to work (understands prestige, has prestige reserves). The script itself *should* be backwards compatible but no effort was made to ensure that. See ModDB for a MiniMod downloads.
- Found a silly bug (tabbing error) in script that invalidated all potential blocks. Attached script is fixed version, minimod downloads are updated as well.
- The mods no longer use the .zip file bit; they are now regular directories (like most mods) which should simplify installation a bit.
Steam Links:
Vanilla (CK2 2.7)
Mod DB Download Links:
CK2 2.7
Various Minimods + Vanilla [17-2]
CK2 2.6
Various Minimods + Vanilla [17-2]
Variousl MiniMods + Vanilla [17-1e]
Various Minimods + Vanilla [17-1d]
Various MiniMods + Vanilla [17-1c]
Vanilla 2.6
Warhammer 1.02
Castles Expanded 23-0-3
Castles Expanded No Tech 23-0-3
Middle Earth Project 0.7
CK2Plus 4.05.4b
Lux Invicta 0 6k11
HIP RD 2016-11-25
WTWSMS 0.9.9.1
AGOT 1.3.2
Elder Kings 2.0
CK2 2.4
Vanilla 2.4
CK2+ 3.11
HIP
Warhammer
Your Personal Castle
WTWSMS
CK2 2.3.4
Vanilla 2.3.4
AGOT 0.9.6
COTC 0.10.1
AutoBuild WTWSMS 0.9.5
AutoBuild Flogi's TechMod
CK2 2.3
Vanilla 2.3
AutoBuild [HIP 2014-12-18] CK2 2.3
AutoBuild NMIH Alpha phase 0.0.7.x (CK2 2.3)
AutoBuild Diadochi Kings 0.2.3 (CKII v2.3)
AutoBuild CK2Plus 2.3
AutoBuild Flogi's Technology & Buildings Mod
AutoBuild Witcher Kings
AutoBuild After the End 0.4
AutoBuild [HIP 2015-01-24]
AutoBuild AGOT 0.9.2
AutoBuild Project Augustus
AutoBuild When the World Stopped Making Sense
CK2 2.2.1
ck2 Vanilla 2.2.1
AGOT 0.9
Diadochi_Kings 0.2.2
HIP - CM - 2014-11-19
Lux Invicta v06k2
NMIH 0.0.6.x Alpha
MiniMod for CK2 Vanilla 2.2
MiniMod for CK2 Vanilla 2.1.6
Script attached below for the technically minded; shouldn't mess up anything by default though you will almost certainly have to configure some directories (such as your CK2 installation directory). See above links for downloading the minimods.
Technically speaking
- Parses vanilla buildings + mod added buildings (excludes vanilla buildings if mod replaces the building directory...)
- Generates a decision that honors wealth, prestige, technology, prerequisite, and potential requirements, and selects buildings.
- Generates a configuration menu to enable/disable auto building (per character), set gold reserves, and enable/disable building buildings in vassal baron or county baron holdings.
- A province modifier lets you know how long until the current building is built.
- Placeholder buildings are used to store/communicate what is being build, but do not currently 'block' building the building or other buildings; and do not provide any stats.
- The placeholder is replaced by an event, and if the building that was under construction was built in the meantime, it's cost is refunded.
- Local Construction cost/time reductions are honored (though this is hard coded at the moment, and will not honor mod modifications to the vanilla max reduction of the construction technology (25%).
- As of the latest version, it should re-enable itself on your dynastic heir when you die with your settings preserved.
Some Screenshots:
View attachment 112112
Baron/County Baron vassal options
View attachment 112113
"Select Building for Construction" event notification...
View attachment 112115
Placeholder buildings (and workers camp) which will be removed when building is completed.
View attachment 112116
Modifier displaying that something is being auto-built in the province, and how long until it is completed.
It is, admittedly, somewhat convoluted. I welcome any idea's to simplify (or optimize) it; for some mods (lux invicta, for example) the generated events are quite large, but for the vast majority they are fairly small. I also welcome any other feedback, feature requests, or bug reports.