• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

ishar21

Sergeant
89 Badges
Dec 23, 2012
57
2
  • Semper Fi
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Heir to the Throne
  • King Arthur II
  • Magicka
  • March of the Eagles
  • Victoria: Revolutions
  • Cities in Motion 2
  • Sword of the Stars
  • Sword of the Stars II
  • Stellaris: Synthetic Dawn
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Crusader Kings II: Reapers Due
  • Pillars of Eternity
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Conquest of Paradise
  • Crusader Kings II: Charlemagne
  • Crusader Kings II
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • A Game of Dwarves
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Darkest Hour
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Europa Universalis III Complete
  • Divine Wind
  • Europa Universalis IV
  • Crusader Kings II: Conclave
  • Stellaris
  • Crusader Kings II: Horse Lords
  • Stellaris: Galaxy Edition
  • Crusader Kings II: Way of Life
  • Stellaris: Galaxy Edition
  • Mount & Blade: With Fire and Sword
  • Mount & Blade: Warband
  • 500k Club
  • War of the Roses
  • Warlock: Master of the Arcane
  • Teleglitch: Die More Edition
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Stellaris: Nemesis
[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.

Known Issues:
  • If you run the script, I didn't account for special characters in mod archive names (e.g. flogi's techmod.zip). As a work around, if you modify the zip name and reference in the .mod file, it will work just fine.
  • Localization is absolutely terrible and based on a combination of google translate and string substitution (e.g. "Tu hablas {}?").
  • It ignores bloodline related bonuses to build times / build costs.

  • Generated a version for 3.2.1; seems to work fine and didn't require any script changes.
  • Script updated, see ck2autobuild-19-1a.zip. I really should look before I leap. In previous release it was impossible to actually get the "max discount" flag.
  • Script updated, see ck2autobuild-19-1.zip. I fixed an issue related to build cost/time modifiers. Unless a building takes a few centuries to build the time/cost can now be reduced to 1. This is to match what the CK2 does (in the build window) if you have really high build time/cost modifiers. Unlikely to apply in Vanilla, but applies to some mods.
  • Script updated, see ck2autobuild-18-12.zip. I fixed some issues with bulk_update being dumb, and fixed numerous issues associated with trying to properly check event_modifiers to build times. I implemented artifacts. I wrote code for bloodlines, but turned it off when I realized there was no simple way to compare bloodline types (e.g. detect if a character has any builder bloodline) without using flags.
  • Initial release for 3.0. No script updates necessary for basic functionality, though it ignores bloodline related building speed/cost bonuses. Prerequisites are checked, so figured I'd release before diving into parsing the bloodline related stuff.
  • Updated 7/26/2018 with minor changes to the python script; namely some edge cases with reading archive files in other mods as well as issues with mods that had buildings with no build costs. See ck2autobuild-18-7.zip.
  • Updated 4/22/2018 with really minor changes to the python script; there was an issue with the way it was generating decisions that came up. Updates to the releases to follow, but for now please use dist_ab-18-4.zip.
  • 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 3.2.1)

Mod DB Download Links:

CK2 3.2.1
Various Minimods + Vanilla

CK2 3.1.0
Various Minimods + Vanilla

CK2 3.0.1 [Updated 19-1]
Various Minimods + Vanilla [19-1]

Script for creating your own:
19-1


A 'release' version is attached and git links are provided 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.

Main Repo:
https://gitlab.com/jeremy.kackley/ck2autobuild

CK2Lib Repo: (to avoid shared code between AB and my other projects)
https://gitlab.com/jeremy.kackley/ck2lib

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, more or less.
  • As of the latest version, it should re-enable itself on your dynastic heir when you die with your settings preserved.

Some Screenshots:
eXeMleh.png
Baron/County Baron vassal options
hxs44U1.png
"Select Building for Construction" event notification...
Txp95Wv.png
Placeholder buildings (and workers camp) which will be removed when building is completed.
qPjJKeL.png
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.
 

Attachments

  • DanHHoE.png
    DanHHoE.png
    4 MB · Views: 1.012
  • cbrhknC.png
    cbrhknC.png
    1,1 MB · Views: 890
  • JNIukv3.png
    JNIukv3.png
    1,2 MB · Views: 665
  • dist_ab_1_6_15.rar
    138,9 KB · Views: 60
  • autobuild-dist for 2.3.4 version 1.zip
    157,2 KB · Views: 30
  • AutoBuild-CK2 2.4.4-version1.zip
    158,3 KB · Views: 41
  • AutoBuild 16-12 (CK2 2.6).zip
    198,2 KB · Views: 9
  • AutoBuild 17-1 (CK2 2.6).zip
    210,4 KB · Views: 12
  • AutoBuild 17-1c (CK2 2.6).zip
    211,7 KB · Views: 8
  • AutoBuild 17-1c hotfix (CK2 2.6).zip
    190,2 KB · Views: 10
  • AutoBuild 17-1d (CK2 2.6).zip
    235,2 KB · Views: 17
  • AB 17-1d Fix.zip
    237,8 KB · Views: 23
  • dist_ab-17-2.zip
    321,7 KB · Views: 60
  • dist_ab-18-4.zip
    319,7 KB · Views: 83
  • ck2autobuild-18-7.zip
    167,1 KB · Views: 59
  • ck2autobuild-18-12.zip
    246,1 KB · Views: 16
  • ck2autobuild-19-1.zip
    246,4 KB · Views: 9
  • ck2autobuild-19-1a.zip
    247 KB · Views: 213
Last edited:
Been looking for something like this for ages! Unfortunately I can't seem to get this to work, maybe I'm not installing it correctly? I have it in my mod directory, and I also have it activated but I can't seem to get anything like it to show up in my decision in-game as in your screenshots.
 
yep im going through the same issue, but I think we have to type event .... something.1 or .0
which shoudl activate it, went through the mod cant seem to find which one activates it or not. It very similar to one of those cheat mods :(
 
Hmmm its weird... I tried using the submod for Elder Kings that was included and it actually seems to have worked. I had a CTD about a year into a new game, but I'm not sure that was the cause of it.
 
i think we missing something or the file is missing something, hope someone can make something similar to the EUIV Ledger which lists all citys n castles etc and can build.

Heres a clue a mod for EUIV very similar to this:

"Finally got the new MEIOU to work, so i thought i would update my auto-build mod. Just tested it ingame and it works fine. Relies on a popup event at the beginning of the game in order to unlock the cultural decisions. From there on, it spends 1 magistrate and some gold to build buildings. Adds a 1-year cooldown to simulate the build time.

Just unrar and paste to your meiou folder."

Thing is to find the popup event in the code :/
 
I got it working:D

the .mod file was pointing to the .zip instead of the directory. so just remove that .zip and it should come up:D

So far no crashes as yet, mod is PERFECT
 
Sorry guys I got tied up in real life for awhile. Sorry for the slow response.

It sounds like everyone got it working though?

If installed correctly, there should be an intrigue decision "Open Automatic Building Menu."

I apologise for the apparent snafu with the .mod file; keeping the directory as a .zip file and pointing the mod at it seems to work for me.

Perhaps you extracted both zip files, instead of just the _dist.zip file? I'll probably switch to the more traditional folder method for future releases to keep things simpler.
 
Last edited:
Updated first post, added the 'minimods' bundle to ModDB, and there is no more .zip ness, so should eliminate the problems you were having.

I don't think there have been any significant changes, though I did change one of the spammerier events ("Your advisors are meeting to decide what to build" to be hidden) and I think I fixed an issue with the AGOT minimod.
 
Last edited:
Heyho. I realy love your mod. It´s for me one of the "must have" mods. Thank you for your great work!

I wanted to download the newest version for the Lux Invicta v06k2 but the download doesnt work for me. Does it got deleted? Or just waiting for permission?
Do you have maybe a alternative download source?
 
I downloaded AutoBuild Vanilla 2.2.1, and used it, but it shows many problems.
Place holder buildings in some provinces do not disappear even though the day shown in the province state has been long passed.
When I only set enable building county baron vassals, it only seems to build buildings in my direct holdings. There was a baron vassal holding that had some buildings available to build and I still had enough gold, but nothing was auto built in that baron holding.
In one of my direct vassal province, the place holder buildings did not disappear and I was not able to build anything manually anymore in that province.
 
First, thanks for trying it and the bug report.

Place holder buildings in some provinces do not disappear even though the day shown in the province state has been long passed.

Could you give me a specific example so I can try to replicate it? I haven't noticed this happening.

When I only set enable building county baron vassals, it only seems to build buildings in my direct holdings. There was a baron vassal holding that had some buildings available to build and I still had enough gold, but nothing was auto built in that baron holding.

There was a bug introduced by adding the 'all vassals' option that broke direct vassals and county barons. I got direct vassals working, but I'm unsure about county barons. I haven't uploaded the fix yet, but I will soon. (I literally discovered the bug and started working on it over the weekend)

In one of my direct vassal province, the place holder buildings did not disappear and I was not able to build anything manually anymore in that province.

The placeholder buildings in and of themselves should not affect your ability to manually build things one way or another. Not sure whats going on in the situation you describe. Could you provide a screenshot and/or specifics?