LeeS
Imperator
Dummy Buildings in Civ6
- Dummy Buildings are alive and well in Civ6, and while their use will probably be less widespread than it was in Civ5, some effects that cannot currently be done via the Modifiers system with its Requirements Sets and & etc. wil be accomplishable with dummy buildings.
- Use of a Dummy Buildng for the most part will require a combination of the xml to create the building, and some lua to implement adding the building to a city center when the correct conditions are met.
- The xml required is not particularly hard, but there will be 3 components needed, each loaded into the game from a different set of commands within the modinfo file. Sorry, but there's no way around this at the moment because of the database system Firaxis chose to implement for Civ6.
- You will need the following three elements in three different xml files to implement a dummy building into the game's database:
- Definition of the Dummy Building:
For a Dummy we will call "BUILDING_DUMBO". We will place the code into a file called DumboBuilding.xml
Code:<GameInfo> <Types> <Row Type="BUILDING_DUMBO" Kind="KIND_BUILDING" /> </Types> <Buildings> <Row BuildingType="BUILDING_DUMBO" Name="LOC_BUILDING_DUMBO_NAME" PrereqDistrict="DISTRICT_CITY_CENTER" Cost="1" EnabledByReligion="true" /> </Buildings> </GameInfo>
Code:<Components> <UpdateDatabase id="Dummy_XML"> <Items> <File>DumboBuilding.xml</File> </Items> </UpdateDatabase> </Components>
- We use EnabledByReligion="true" so that the game is faked into thinking the building can only be acquired when a specific religious belief is adopted, but we then also never specify the belief. This results in a building a player cannot build or purchase.
- We do not specify a purchase type of yield, again to keep the building from becoming acquirable via 'normal' methods.
- We cannot use InternalOnly="true" because while this allows us the other advantages we are looking for, once we place such a building into a city, we are unable to remove it from the city via an lua script if we would like our code to be able to do so.
- Definition of the Dummy Building's Icon
We will place the code into a file called DumboBuildingIcons.xml
Code:<GameData> <IconDefinitions> <Row Name="ICON_BUILDING_DUMBO" Atlas="ICON_ATLAS_BUILDINGS" Index="0"/> <Row Name="ICON_BUILDING_DUMBO_FOW" Atlas="ICON_ATLAS_BUILDINGS_FOW" Index="0"/> </IconDefinitions> </GameData>
Code:<Components> <Icons id="Dummy_ICONS"> <Items> <File>DumboBuildingIcons.xml</File> </Items> </Icons> </Components>
- We want to define the Icon so we do not get the ugly question mark in-game related to this dummy building.
- Note that I am borrowing the monument's icon. we can do this. In fact, we can re-use a pre-existing icon as many times as we want.
- Note also that the name of the icon string and the name of the building must conform to the patterns given of
Code:
ICON_ + Building-Name-As-Used-in-Table-<Buildings> and ICON_ + Building-Name-As-Used-in-Table-<Buildings> + _FOW
- Definition of the Dummy Building's Name
We will place the code into a file called DumboBuildingText.xml
Code:<GameData> <LocalizedText> <Row Tag="LOC_BUILDING_DUMBO_NAME" Language="en_US"> <Text>Dumbo</Text> </Row> </LocalizedText> </GameData>
Code:<Components> <LocalizedText id="Dummy_Text"> <Items> <File>DumboBuildingText.xml</File> </Items> </LocalizedText> </Components>
- Definition of the Dummy Building:
- Lua for adding a dummy building to a city.
We will place the code into a file called DumboBuilding.lua, but I am not going to attempt to show all the lua code that would be necessary to fully create an lua script for adding a dummy building. I am currently in the process of testing a dynamic system that allows dummy buildings to be linked to whether or not a city has for example revealed Aluminum within the working confines of the city's plots, and to add a dummy to the city when this is the case. I will link from here to that mod once I have done a bit more testing and ensured the system is not creating any wierd unforeseen bugs.
What I am presenting here is two basic functions that can be tucked into an lua file and used as needed. in this particular example, along with other code, they'd be included within file DumboBuilding.lua
- Adding a dummy to a city:
You need to send the city pointer-object as argument pCity and the building's index # as the argument for iBuilding
Code:function PlaceBuildingInCityCenter(pCity, iBuilding) local iCityPlotIndex = Map.GetPlot(pCity:GetX(), pCity:GetY()):GetIndex() if not pCity:GetBuildings():HasBuilding(iBuilding) then pCity:GetBuildQueue():CreateIncompleteBuilding(iBuilding, iCityPlotIndex, 100); end end
- Removing a dummy from a city:
You need to send the city pointer-object as argument pCity and the building's index # as the argument for iBuilding
Code:function RemoveBuildingFromCityCenter(pCity, iBuilding) if pCity:GetBuildings():HasBuilding(iBuilding) then pCity:GetBuildings():RemoveBuilding(iBuilding); end end
Code:<Components> <GameplayScripts id="Dummy_LUA"> <Items> <File>DumboBuilding.lua</File> </Items> </GameplayScripts> </Components>
- Adding a dummy to a city:
- In any lua script, you can get a building's index # via this:
Code:local iBuilding = GameInfo.Buildings["BUILDING_DUMBO"].Index
Now for the bad news, because Firaxis there always is some:
- The dummy building will show in the city list of "Buildings and Wonders" view
- If you remove a building via lua from a city, the building does not disappear from the list of buildings in the city's "Buildngs and Wonders" view. The building is actually gone, but the Icon of the Building and its description remain.
- In order to eliminate the building from the list shown in the city's list, you have to save and reload the game. Civ5 graphics not update is alive and well in even more permutations in civ6 than it was in civ5.
- Adding and removing the building via lua acts correctly and the Building performs correctly as a Prereq for another building, etc., if that is what you are after. It is just that the display is not friendly to the modder.
Last edited: