LeeS
Imperator
Please note that this utility only works correctly for Vanilla, and only to a limited degree. It is currently under re-work and reconstruction. I cannot at this time predict when this revision and recreation will be completed
LeeS' Dummy Buildings Utilities
Spoiler download :
All the code for this utility is contained within the LeeS' Dummy Buildings Systems mod, which can be accessed and downloaded via dropbox here:
LeeS' Dummy Buildings Systems (via Dropbox)
LeeS' Dummy Buildings Systems (via Dropbox)
- The Utilities provided herein are in packaged into one mod, but it is not necessary for you to use any of the portions you do not want within your mod.
- You do not have to do anything to use one or more of the systems in the utility except:
- create a dependancy within your mod so that in order to use your mod a player needs to have downloaded and enabled this mod. See Adding the Dependancy to Your Mod
- use any desired game-tables added by this mod within the XML or SQl of your mod's files. See these descriptions of how to create the needed XML in your mod:
- Jump to the Utility Sub-System: City-Terrain Building Prereqs (terrains, resources, improvments, terrain-features, districts adjacencies, etc.)
- Jump to the Utility Sub-System: Individualized City Unit Production Modifier Buildings
- Jump to the Utility Sub-System: PreRequisite Buildings ANDS System
- add a <LoadOrder> designation somewhere between 1 and 150000 in the "action" that adds your XML/SQL files to the game's database. See Setting the Action <LoadOrder>
- Essentially, all you need to do is use any of the new game-tables within the code of your mod, and this utility-mod will implement the effects of your XML-commands via the lua files of the utility.
- You do not need to concern yourself with what happens if you only need to use one of the new XML-tables. Any that are not being used by your mod or some other mod will simply not activate themselves once a game is started or reloaded.
- So, you can use the part of the utility that hides dummy buildings without needing to use the other parts of the utility. In such cases your mod will contain all the code for what the game should do to add or remove such a dummy building to/from cities.
Why Make the utility An Entirely Seperate Mod That A User Must Also Have Enabled?
- This cures a whole host of issues with regard to mod loading order, stability of mod-loading-order, and stability of file loading-order within a given mod
- This also ensures a simpler system for you the mod-maker to "hook up to" within your mod.
- all you are doing is adding a dependancy within your mod
- don't be freaked out by the length of the step-by-step instructions on what to do in modbuddy to add such a dependancy. It is actually far more work to show you which modbuddy menus must be used than it is to add the actual dependancy.
- It allows the system to be expanded to add new capabilities without in any way disturbing your mod
- It allows a far simpler method for updates and patches for any issues found than any other method. Everybody making use of this system is always working to the same "music sheet".
Brief Description of Each of the Sub-Systems
The utility provides implementations for the following:
- A system to hide dummy buildings from the human player in the game's user interfaces.
- This system merely requires that you add dummy buildings to your mod in the manner outlined. You don't need to edit or alter any code in the files of the utility.
- Any Building which has the new column IsDummy set to "true" will be treated as a dummy building and will be hidden from the user (player) interfaces.
- obviously if you are not using dummy buildings then there is no need to hide them from the human player, but in such a case you currently have no need of this utility.
- A system to add dummy buildings to a city based on whether the city has specified terrain, resources, feature, district, etc., pre-conditions met.
- this part of the utility is based upon my older Buildings Require Local Resources Utility (Buildings Require Local Resources Utility)
- this sytem is largely expanded, includes everything provided by the previous utility, and supercedes it entirely.
- you can still use the older utility if you are currently using it, but you should adopt use of this expanded and more capable utility for any new mod.
- this newer system does not in any way affect use of the older system. they can in fact be run together at the same time
- A system for implementing a city-by-city unit production modifier effect
- A system that allows specification that all buildings within a specific list must be present in a city in order to construct a wonder, national wonder, building, or unit. Firaxis only provides for a system where if any one building from a list is present, then another building can be constructed. This system will allow you to specify that a city must for example have both a Barracks and a Market in order for Wonder_X (or some other type of building) to be built in the city.
More Details:
- All of these sytems depend in one degree or another on dummy buildings.
- The dummy buildings system adds a column to the standard Firaxis <Buildings> table. This column is called IsDummy and is a boolean flag used by other parts of the systems to know whether a given building should be treated as a dummy building by the systems.
- The other systems add entirely new game-tables, and operate based on the data entered by you for your mod for these new game-tables.
- City Terrain Prerequisites: The system for city terrain-dependant effects provides for the following, among other effects:
Spoiler utility capabilities :It will allow you to specify a city must have:
- a specific resource within its set of plots before a unit or building can be constructed in the city
- an improved copy of a specific resource within its set of plots before a unit or building can be constructed in the city
- I have not yet found a reliable method to tell within a gameplay script whether an improvement is pillaged, so this part of the utility will be satisfied even if the plot has been pillaged. This is just one of the odd loopholes the the current implementation of Civ6 lua.
- a specific resource (improved or otherwise) within its set of plots as well as a specified building already constructed in the city before a unit or building can be constructed in the city
- all of a list of buildings existing within the city before a building (or wonder) can be constructed. This is not supported by the standard <BuildingPrereqs> table.
- a specific type of terrain the city is constructed on before a unit or building can be constructed in the city
- a specific type of terrain the city is constructed on or adjacent to before a unit or building can be constructed in the city
- a specific type of terrain must be present in a tile owned by the city and within its 3-tile working radius before a unit or building to be constructed in the city
- that a terrain must not be a lake (for the case of TERRAIN_COAST)
- the city center is adjacent to a mountain, or a lake, or a river in order for a unit or building to be constructed in the city. You will also be able to specify combinations of lake and river, but this part of the utility does not support complex combinations such as Mountain+River or River+Lake but not Mountain.
- a minimum number of mountain tiles within the plots the city owns in order for a unit or building to be constructed in the city
- the city is adjacent to a specific feature in order for a unit or building to be constructed in the city
- a specific type of feature must be present in a tile owned by the city and within its 3-tile working radius before a unit or building to be constructed in the city
- a minimum number of tiles with the feature within the plots the city owns in order for a unit or building to be constructed in the city
- in the case of features specification can be made whether the plot can have an improvement or not
- the city is adjacent to a specific terrain improvement in order for a unit or building to be constructed in the city
- a specific type of terrain improvement must be present in a tile owned by the city and within its 3-tile working radius in order for a unit or building to be constructed in the city
- in the case of terrain improvements specification can be made whether the plot can have a feature (such as a Floodplain on a tile with a Farm) and the number of specified terrain improvements that the city must have can be specified.
- that a specified type of city district owned by the city meet a specified condition in order for a unit or building to be constructed in the city:
- the district must be placed adjacent to a mountain
- the district must be placed adjacent to a river
- the district must have a minimum number of adjacent mountains
- the district must be placed adjacent to another type of district
- the district must be placed adjacent to a specific type of resource
- the district must be placed adjacent to a specific type of feature
- the district must be the specific type of district and cannot be a unique replacement type of district (unique replacements are otherwise auto-included)
- the district must be placed adjacent to a hill
- the district must be placed on or adjacent to a hill
- the district must be placed adjacent to a Natural Wonder
- the district must be placed adjacent to a World Wonder
- for districts, you can also specify that the city itself must have specific number of mountain tiles that it owns
- A dummy building that you specify will be added to the city when a condition you specify is met
- You must use this dummy building only as an unlocker for constructing a "real" building/wonder in a city, or as an unlocker for constructing a unit.
- You should not give this dummy building direct effects such as a modifier or a <Building_YieldChanges> effect.
- One dummy building can be used to unlock multiple "real" buildings or units, but one "real" bulding can only ever have one dummy building as its prerequisite in table <BuildingPrereqs>
- Having more than one dummy building (or other type of building) as a unit's prerequisite in <Unit_BuildingPrereqs> may or may not have undesirable effects. I have not tested for this instance.
- The dummy building is always shown as the PrereqBuilding in table <BuildingPrereqs>
- The "real" building is always shown as the Building in table <BuildingPrereqs>
- The dummy building is always shown as the PrereqBuilding in table <Unit_BuildingPrereqs>
- note that attempting to use column NumSupported in table <Unit_BuildingPrereqs> for any unit other than the Archaeologist has bizarre results. these are not caused by this mod: they are caused by Firaxis' implementation of the table.
- The system is built as an "ORS" system. This means if you give multiple resource requirements, the code only requires any one of these resources to be present within a city's set of map-tiles in order for the dummy building to be added to the city.
- dummy buildings are always added to the city center district. the code is written to require and expect this. a building does not have to be located within the same district to act as a prerequisite for another building.
- Individualized City Unit Production Modifier Buildings: The system for City-Specific Unit-Production Modifiers is a system wherein if a city has a specified building:
- Production of specified units is increased (or decreased) by a percentage.
- The Units to be affected can be specified as:
- individual specific units
- individual specific units and any unique replacement units for them
- units of a given domain-type
- units of a given formation-type
- units of a given promotion-class
- The building that gives the affect can be a specific building, or all unique replacements for that type of building can be included.
- PreRequisite Buildings ANDS:
- Provides a tool that requires a city have all the "real" buildings within a list before a second "real" building is unlocked within that city.
- The tool automatically adds and accounts for all unique replacements and the "standard" building from within a "group" of buildings regardless of whether a unique is stated as a prerequisite, or the standard building is so stated.
- When a city has all the requisite buildings from within a list (or their unique replacement versions), then a specified dummy building is added to the city, and this acts as the prerequisite the game sees for the building we really want to have a "must have all these buildings" requirement.
Utility Sub-Systems Menu
(clicking on the topic link will take you directly to the instructions for that part of the utility)
(clicking on the topic link will take you directly to the instructions for that part of the utility)
- Jump to the Utility Sub-System: Creating and Hiding Dummy Buildings
- Jump to the Utility Sub-System: City-Terrain Building Prereqs (terrains, resources, improvments, terrain-features, districts adjacencies, etc.)
- Jump to the Utility Sub-System: Individualized City Unit Production Modifier Buildings
- Jump to the Utility Sub-System: PreRequisite Buildings ANDS System
- Jump to the Utility Sub-System: Pre-Packaged Misc Modifier Code
- Jump to the Utility Sub-System: Miscellaneous Snippets of Lua Code
- when looking through the lua code of the mod's files for useful snippets of code, you should refer here first and use the versions presented here in preference to any snippets of code from the mods files for any snippetes or functions that look useful.
- Jump to the Utility Sub-System: Topic6 (just a placeholder at the moment)
- Jump to the Utility Sub-System: Topic7 (just a placeholder at the moment)
- ModBuddy Instructions for Setting Up Your mod to use one or more of the systems:
- Adding the Dependancy to Your Mod
- This sets up the requirement within your mod that the user needs this utility mod enabled in their list of mods
- Setting the Action <LoadOrder>
- This controls the order in which the game adds mod files. You need this to ensure that your mod's files load into the game after the utility sets up the needed tables and before the final "clean-up" actions the utility makes for all buildings defined into the game database as dummy buildings.
- Adding a File-Loading Priority to Your Mod's Files
- This controls the order in which files within a single mod "action" load into the game.
- This really only applies to actions that are "UpdateDatabase" type.
- File Priority has no effect on file-loading order for files not within the same "action".
- Adding the Dependancy to Your Mod
FAQ
Spoiler :
- [Q]:Multiplayer Compatibility ?
[A]: I have no idea if or how well this mod and its systems will run in Multiplayer. - [Q]: Mod Compatibility?
[A]: UI mods:- The mod will at the moment be incompatible to almost all if not all the mods that provide a custom UI, since part of what this mod does is re-write several of the UI files to hide the dummy builings added by this mod from human-view.
- The changes to the UI files made by this mod should be relatively easy for inclusion in other mods that re-write the same files, but whether the makers of such mods are willing to provide compatibility on their end or whether I will have to try to provide compatibility "fixer" files for each such mod is a question I cannot answer yet.
- there are some issues still existing in the game's method for reloading mods when a saved game is loaded that might cause issues between this mod and some other mod. I am not sure the one bug has been fixed by Firaxis where mods would load in one order when a game was started but would load in another order when a saved game was reloaded. I am hoping ( and testing seems to indicate) these issues are resolved by making the utility a required mod for other mods via the dependancy.
- [Q]: DLC Requirements?
[A]: The utility does not depend on you having any DLC. Currently I do not have anything except the Aztec civ "DLC", so I am building the mod to be free of such dependancies. - [Q]: What happens if some other mod over-writes the changes you are making to the UI files, and this utility's changes are no longer applied to those UI pop-up panels?
[A]: Then you will be able to see the various dummy buildngs other mods add to the game, both in the civilopedia and in the various city-views and mouse tool-tips. There is no other actual effect than a bit more clutter in the mouse tips, the civilopedia, etc.
Future Expansion of the Systems
- Any future expansion to add more capability will be performed as stand-alone additional "systems", but will be rolled into the utility mod. New exapansions of the system will not therefore affect your mod in any way. This approach must be used in order to not create compatibility issues with existing mods that are using the current systems
- Updates to the current systems will only be made to cure any bugs or incorrect performances discovered within the existing systems.
Credits
credit where credit is due. I just have to work up who to credit at the moment
- q/ @notque for help with the AI favored items code.
- @Magil (I think) for advice on using a DistrictModifier to create a city production effect when a city has a particular building.
A Few Notes on Code Examples
- I've generally used code examples taken directly from the Buildings Are Fun mod, but the way the files are structured within the mod are not always reflected by the way I show the examples in this thread.
- What makes sense in my head for organizing the xml files within a mod is not the same as what makes sense for demonstrating the same code as an example of how to code something.
Posting Comments Re: the Modifier System provided by Firaxis
- The Dynamic Modifiers and the Game Effects as created for Civ6 can do a lot. They cannot however do much if any of this.
- This is well-hackneyed territory already explored in other civ6 modding threads.
- Please refrain from adding comments to the thread about how a modifier can do all this. They are neither productive to the intent of this utility, nor helpful to other modders who are interested in the effects this utility and its systems can provide.
Moderator Action: Moved to Civ 6 - Utilities Forum.
--Ozbenno
Last edited: