Quick Modding Questions Thread

Another quick question. I'm trying to make a custom repeatable project that should increase housing; for the time being, I tied it to the holy site district. Problem is, it only works once for some reason. It can repeat, but doesn't add more housing on the second run and henceforth. Any idea what am I doing wrong? Here's the xml:

Code:
    <Projects>
        <Row>
            <ProjectType>PROJECT_EXPAND_CITY</ProjectType>
            <Name>LOC_EXPAND_CITY_NAME</Name>
            <ShortName>LOC_EXPAND_CITY_SHORT_NAME</ShortName>
            <Description>LOC_EXPAND_CITY_DESCRIPTION</Description>
            <PrereqDistrict>DISTRICT_HOLY_SITE</PrereqDistrict>
            <Cost>25</Cost>
            <AdvisorType>ADVISOR_GENERIC</AdvisorType>
            <CostProgressionModel>COST_PROGRESSION_GAME_PROGRESS</CostProgressionModel>
            <CostProgressionParam1>1500</CostProgressionParam1>
            <AmenitiesWhileActive>0</AmenitiesWhileActive>
        </Row>
    </Projects>

    <ProjectCompletionModifiers>
        <Row>
            <Row ProjectType="PROJECT_EXPAND_CITY" ModifierId="PROJECT_EXPAND_CITY_HOUSING"/>
        </Row>
    </ProjectCompletionModifiers>

    <Modifiers>
        <Row ModifierId="PROJECT_EXPAND_CITY_HOUSING" ModifierType="MODIFIER_PLAYER_DISTRICTS_ADJUST_HOUSING" SubjectRequirementSetId="PLOT_IS_DISTRICT_HOLY_SITE_SET" />
    </Modifiers>

    <RequirementSetRequirements>
        <Row>
            <RequirementSetId>PLOT_IS_DISTRICT_HOLY_SITE_SET</RequirementSetId>
            <RequirementId>REQUIRES_DISTRICT_IS_HOLY_SITE</RequirementId>
        </Row>     
    </RequirementSetRequirements>

    <Requirements>
        <Row>
            <RequirementId>REQUIRES_DISTRICT_IS_HOLY_SITE</RequirementId>
            <RequirementType>REQUIREMENT_DISTRICT_TYPE_MATCHES</RequirementType>
        </Row>
    </Requirements>

    <RequirementArguments>
        <Row>
            <RequirementId>REQUIRES_DISTRICT_IS_HOLY_SITE</RequirementId>
            <Name>DistrictType</Name>
            <Value>DISTRICT_HOLY_SITE</Value>
        </Row>     
    </RequirementArguments>

    <ModifierArguments>
        <Row>
            <ModifierId>PROJECT_EXPAND_CITY_HOUSING</ModifierId>
            <Name>Amount</Name>
            <Value>1</Value>
        </Row>
    </ModifierArguments>
 
Is there a guide or template out there to create a custom Pantheon? I have been searching for a while now and nothings come up.

Also I'm sorry if this is in the wrong spot I just didn't think making a new thread would be right for simple question.
 
Is there a guide or template out there to create a custom Pantheon? I have been searching for a while now and nothings come up.

Also I'm sorry if this is in the wrong spot I just didn't think making a new thread would be right for simple question.
I would use the Beliefs.xml in your Steam\steamapps\common\Sid Meier's Civilization VI\Base\Assets\Gameplay\Data directory for examples on how the syntax on pantheons work
 
Is there a guide or template out there to create a custom Pantheon? I have been searching for a while now and nothings come up.
I would download an existing mod that already adds Pantheons to use as a template. Something like p0kiehl's Religion Expanded or Ancient Egyptian Pantheons, there are others out there as well - Gedemo just released a new one the other day here.
 
Last edited:
Is there any reason strategic resource costs + maintenance cannot be added to buildings?
EG, imagine something reminiscent of civ5 like
<Update>
<Where BuildingType="Building_FACTORY"/>
<Set>
<StrategicResource>RESOURCE_COAL</StrategicResource>
</Set>
</Update>

<Buildings_XP2>
<Row BuildingType="BUILDING_FACTORY" ResourceCost="1" ResourceMaintenanceType="RESOURCE_COAL" ResourceMaintenanceAmount="1"/>
</Buildings_XP2>

I see these traits in the unit files, do I need to update some other table to allow buildings to have strategic resource cost traits like units do?

I am brand new to civ6 modding (as of yesterday,) so while I grasp the XML/SQL the actual way to layout files in mods is still eluding me, hence I haven't just thrown this into the game and found out. Also, forgive my bad terminology.
That said, custom modifiers I still don't quite get either (working on it- does anyone know a good guide? The one in the guides section of this forum by nycholus or some such seems to link to no longer functioning site.)
 
Table definitions are now done in unified SQL files (one) for Vanilla, (one) for Rise and Fall, and (one) for Gathering Storm. The Expansions do not alter the definitions of the Vanilla game-tables as a general rule, they add new tables for the mechanics appropriate to that expansion. So for Gathering Storm there's a provided additional Buildings table for doing exactly what you are after. The SQL definition of this new table from the "Expansion2_Schema.sql" file is:
Code:
CREATE TABLE "Building_ResourceCosts" (
		"BuildingType" TEXT NOT NULL,
		"ResourceType" TEXT NOT NULL,
		"StartProductionCost" INTEGER NOT NULL,
		"PerTurnMaintenanceCost" INTEGER NOT NULL,
		PRIMARY KEY(BuildingType, ResourceType),
		FOREIGN KEY (BuildingType) REFERENCES Buildings(BuildingType) ON DELETE CASCADE ON UPDATE CASCADE,
		FOREIGN KEY (ResourceType) REFERENCES Resources(ResourceType) ON DELETE CASCADE ON UPDATE CASCADE);
You are interested mostly in column "PerTurnMaintenanceCost" if I understand correctly what you want.

The folder location for Gathering Storm xml code and the SQL schema file is
Code:
C:\Program Files (x86)\Steam\steamapps\common\Sid Meier's Civilization VI\DLC\Expansion2\Data
 
Table definitions are now done in unified SQL files (one) for Vanilla, (one) for Rise and Fall, and (one) for Gathering Storm. The Expansions do not alter the definitions of the Vanilla game-tables as a general rule, they add new tables for the mechanics appropriate to that expansion.
Oh my this is a huge help. I didn't realize they had split XP2's tables into a bunch of smaller pieces and was looking in the wrong spot. Thank you!
 
Concept: units like swordsmen upgrading into units like samurai, berserker, khevsur.
My current theory is to create a unit type, Unit_Longsword, and then
1) update the upgrades table so swords->longswords and longswords->muskets
2) update replaces table so samurai et al replace this fake longsword unit.

However, this creates some problems since (I assume) haven't defined anything about longswords and creates an error in game. I don't want to create an actual playable unit, I just want some clean way to get swords to upgrade to samurai for japan, but muskets for people without those melee UUs.

Is there another way to get the upgrade table to allow that without creating an entire new base unit?
Like multiple arguments or something- I assume that Eg Sword->Samurai->Musket would just cause some civilopedia wackiness but otherwise, since only japan unlocks the samurai, everyone else would just upgrade to muskets.
 
Concept: units like swordsmen upgrading into units like samurai, berserker, khevsur.
My current theory is to create a unit type, Unit_Longsword, and then
1) update the upgrades table so swords->longswords and longswords->muskets
2) update replaces table so samurai et al replace this fake longsword unit.
Deliverator's Steel & Thunder already does this.
 
Deliverator's Steel & Thunder already does this.
To clarify, i don't want an actual longsword unit for all civs, just the ability for civs that have a unique one to upgrade into it where everyone else can have muskets. My idea of "unit_longsword" was just to have a fake unit to let me have just one thing for swords to upgrade to since I can replace it with UUs. Like a player would never see the fact that this in between stage existed once in game.
Sort of like having an "OR" statement in the upgrade line.
 
Hi, is there any modifier that can allow an improvement to be built on a Feature (Forests) but still keep their Terrain requirements? Currently I am adding FEATURE_FOREST to the Improvement_ValidFeatures, but then that improvement would ignore the Terrain as long as their is Forest.
 
Hi, is there any modifier that can allow an improvement to be built on a Feature (Forests) but still keep their Terrain requirements? Currently I am adding FEATURE_FOREST to the Improvement_ValidFeatures, but then that improvement would ignore the Terrain as long as their is Forest.
I so happen to be reading the chapter on modifiers in LeeS amazing modding guide, and it spells out a few things that may be of use:
You can create a Requirement Set and then dictate if multiple requirements on a modifier are to be interpreted as logical AND or logical OR. I've snipped the relevant chunk in the spoiler:
Spoiler :

upload_2019-11-1_23-22-26.png

upload_2019-11-1_23-22-50.png


So presumably you could make a RequirementSetId "MySet", have it test for ALL, and then have one requirement be the forest and the other one be a requirement for the specific terrain.
If you needed something like Forest AND (Plains OR Grassland) you could probably have a requirement set for Forest+Plains and requirement set for Forest+Grass and then have both of those able to give rise to the modifier that allows the improvement in the first place.
I'm new to this modifier thing but since you can have a modifier grant a modifier it seems like the logical way forward would be:
ModifierA requires [forest and terrain A] in its requirement set, and grants Modifier X
ModifierB requires [forest and terrain B] in its requirement set, and grants Modifier X
ModifierX is essentially allowing us to "OR" A and B together, and lets you make the improvement.

EDIT The above approach is incorrect. To attach a modifier to a modifier, you need to do
<ModifierId>ModifierA</>
<name>ModifierId</>
<Value>ModifierB</>
But ModifierId and Name must be a unique pairing, so you cannot have two modifiers attached to one. What you can do, though, is just reorder the logic. Ex:
Modifier X allows you to place Improvement. Requires Modifier A.
Modifier A requires forest on the plot and modifier B.
Modifier B requires terrain1 or terrain2.
Same result, follows the rules!
 
Last edited:
Hi, thanks for the answer. I know about the Requirements and RequirementSets but the problem is I don't know if there is any ModifierType (the Effect) that affect how an improvement is built. Currently I am not aware of such. It would be wonderful if you know one.
 
Table <Improvement_ValidFeatures> essentially acts as an "over-ride" to table <Improvement_ValidTerrains> in the sense that any Feature listed within table <Improvement_ValidFeatures> will allow the improvement regardless of the underlying terrain. Table <Improvement_ValidTerrains> needs to be understood as only really applying to plots that are bare of Features.

Table <Improvement_ValidResources> needs to be understood in the same way as table <Improvement_ValidFeatures> : it is essentially an over-ride of anything listed or missing in tables <Improvement_ValidTerrains> and <Improvement_ValidFeatures> : allowing the improvement if the specified resource is on the plot and "accessible" to the player, regardless of underlying terrain or feature.

I am not at all confident you will be able to use a Modifier to over-ride this behavior set-up of the game-tables. IMPROVEMENT_COLOSSAL_HEAD for example has its valid placement rules defined within the normal "improvement placement" tables: the colossal head is disabled entirely or enabled entirely for a player via a Modifier, but this modifier merely adjusts whether a given player can construct Colossal Heads -- it does not determine where that player can place a Colossal Head. But people are always achieving game-bending that I had thought would not be possible, so I may very well be wrong on this point.
 
This might be getting outside my current understanding but I have been playing around with the (seemingly unused) table Building_ResourceCosts from GS.
Here's the table from the expansion 2 schema for reference (thanks for pointing this out @LeeS !!) :
Spoiler :

CREATE TABLE "Building_ResourceCosts" (
"BuildingType" TEXT NOT NULL,
"ResourceType" TEXT NOT NULL,
"StartProductionCost" INTEGER NOT NULL,
"PerTurnMaintenanceCost" INTEGER NOT NULL,
PRIMARY KEY(BuildingType, ResourceType),
FOREIGN KEY (BuildingType) REFERENCES Buildings(BuildingType) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (ResourceType) REFERENCES Resources(ResourceType) ON DELETE CASCADE ON UPDATE CASCADE);

Supposing I wanted a factory to cost iron, or something, I might try to add a new row like this:
Spoiler :

<Building_ResourceCosts>
<Row>
<BuildingType>BUILDING_FACTORY</BuildingType>
<ResourceType>RESOURCE_IRON</ResourceType>
<StartProductionCost>1</StartProductionCost>
<PerTurnMaintenanceCost>1</PerTurnMaintenanceCost>
</Row>
</Building_ResourceCosts>

I have found that this does seem to actually function in the game (yay!); you need the required amount of resource to begin construction, it is properly deducted; the maintenance is also properly deducted. However, it does not show up anywhere as being used; in the strategic resource bar, it correctly decrements your resource income (albeit doesn't display that any is being consumed even though it is,) and you'll get the warning if your try to make the building without the resource:
upload_2019-11-2_16-42-17.png

However, on the unit card, it doesn't show that "requires" line about needing resources like units do. Example from a knight:
Spoiler :

upload_2019-11-2_16-43-28.png


Is "hooking up" this table so it displays similar to how units work in the purview of the .dll and not something I can change? Or does this fall into UI territory? If it's inaccessible I'm happy to just throw the cost in the description and let it be.
 
You would have to re-write the tooltips UI file if I remember the correct UI file that must be re-written. You would need to re-write the GS version of the "context", though, since in Vanilla there's no resource-cost associated with units or buildings -- one iron total will be enough to construct "iron" units if a city has an encampment district, otherwise 2 iron total will be enough for a city to create "iron" units. In Vanilla a total of 2 iron will allow you to create an infinite number of units anywhere in your empire -- there is no deduction for each unit created. And obviously in Vanilla there's no deduction for constructing buildings.

For the top-ribbon display you would have to re-write the TopPanel lua file to account for the resources being eaten by buildings. if I recall correctly it is TopPanel.lua -- but again there's a different "context" used for TopPanel in GS, so you would need to re-write that context.

For Gathering Storm it's a bit more complex than just editing the original file and "Importing" this altered version from within your mod. You have to use a "ReplaceUIScript" type of action to literally tell the game to use a new filename to replace the Vanilla file for the equivalent UI "context":
Code:
		<ReplaceUIScript id="Expansion2_TopPanel" criteria="Expansion2">
			<Properties>
				<LuaContext>TopPanel</LuaContext>
				<LuaReplace>UI/Replacements/TopPanel_Expansion2.lua</LuaReplace>
			</Properties>
		</ReplaceUIScript>
So this instructs the game to replace the original "TopPanel" context and its "TopPanel.lua" file with the new version called "TopPanel_Expansion2.lua". "TopPanel_Expansion2.lua" then has a command to add the original contents of the TopPanel.lua file into the code of the replacement, so Firaxis only has to re-write those parts needed to make everything work for Gathering Storm.
 
Last edited:
You would have to re-write the tooltips UI file if I remember the correct UI file that must be re-written. You would need to re-write the GS version of the "context", though, since in Vanilla there's no resource-cost associated with units or buildings
Thanks. I'll add UI tooltips to the todo list. (do you happen to know which file that is? I see tooltips int he base directory but not in the XP2 one.)
A related issue is I adjusted the extraction rate of a resource, but it shows the old value on the tooltip, so I assume this is also static- I'm assuming I can fix that there as well.

Really enjoyed reading through your modding guide btw, it's darn near professional grade!
 
Hopefully easy qeustion. Civ Nexus6 seems to be pretty widely used on here...
@Deliverator mentions this on the page:
Installation
In order to run CivNexus6 you need to perform the following steps:
1) Create a folder called "Dummy" somewhere on your hard drive. Within it create two folders one called "Assets" (plural) and one called "Resource" (singular).
2) Now using Regedit create an entry under HKEY_CURRENT_USER\Software\Firaxis\Tools called "ToolAssetPath". Set the value to the location of your Dummy directory.
3) Now you should be able to run the CivNexus6 executable from wherever you have unzipped it.
However, when I open up regedit I see no \tools under \Firaxis:
upload_2019-11-4_16-49-26.png

Am I missing a very obvious step?
 
Top Bottom