Quick Modding Questions Thread

How embarrassing to leave naked like that! I was unaware that cost was also tied to production.
 
'Cost' in buildings, districts, and units always refers to the production cost of the item. Gold Purchase "cost" is calculated by multiplying the item's direct 'Cost' value by 4. Then any modifiers for game-difficulty, TraitModifiers, BuildingModiifers, PolicyModifiers, etc. are accounted for in the final result of the gold cost.

The x4 original multiplier is set in 2 GlobalParameters.
Code:
<Replace Name="GOLD_EQUIVALENT_OTHER_YIELDS" Value="2" />
<Replace Name="GOLD_PURCHASE_MULTIPLIER" Value="2" />
Both are applied against the original 'Cost' value of an item, so 2 x 2 = 4

-------------------------------

Faith does not have a separated GlobalParameter and appears to just use the "GOLD_PURCHASE_MULTIPLIER" since purchasing buildings in the city center with Faith when you are Valleta's (?) Suzerain is always twice the 'Cost' value in the database of the building.
 
Oof. Yeah that is much more than I'm intending to do. Theocracy seems to have a Faith purchase reduction bonus. I'll use that as a template.
 
Is there an already-existing modifier for increasing the base yields of a tile adjacent to a certain district?
The Inca have:
Code:
MODIFIER_PLAYER_CITIES_ADJUST_TERRAIN_YIELD_FROM_ADJACENT_IMPROVEMENTS

And Nubia has the <Improvement_Adjacencies> for their pyramids. There's obviously stuff that improves every tile of a terrain type (like Harbor buildings can do for coastal terrain) but those don't rely on actually being adjacent to the district.
 
MODIFIER_PLAYER_ADJUST_PLOT_YIELD would probably be the simplest to use but you would need a requirement set that included an individual requirement that the plot have ImprovementX
Code:
	<Requirements>
		<Row>
			<RequirementId>PLOT_HAS_A_FARM_REQUIREMENT</RequirementId>
			<RequirementType>REQUIREMENT_PLOT_IMPROVEMENT_TYPE_MATCHES</RequirementType>
		</Row>
	</Requirements>
	<RequirementArguments>
		<Row>
			<RequirementId>PLOT_HAS_A_FARM_REQUIREMENT</RequirementId>
			<Name>ImprovementType</Name>
			<Value>IMPROVEMENT_FARM</Value>
		</Row>
	</RequirementArguments>
And a second individual requirement within the set that uses REQUIREMENT_PLOT_ADJACENT_DISTRICT_TYPE_MATCHES with Min and Max ranges like this more or less
Code:
	<RequirementArguments>
		<Row>
			<RequirementId>REQUIRES_PLOT_HAS_DISTRICT_X_WITHIN_1</RequirementId>
			<Name>DistrictType</Name>
			<Value>DISTRICT_X</Value>
		</Row>
		<Row>
			<RequirementId>REQUIRES_PLOT_HAS_DISTRICT_X_WITHIN_1</RequirementId>
			<Name>MinRange</Name>
			<Value>0</Value>
		</Row>
		<Row>
			<RequirementId>REQUIRES_PLOT_HAS_DISTRICT_X_WITHIN_1</RequirementId>
			<Name>MaxRange</Name>
			<Value>1</Value>
		</Row>
	</RequirementArguments>
Your RequirementSet would need to use a TEST_ALL method

This ought to work I would think but I have not specifically tested for it.
 
Previous example was if you want Leader X or Civ X to have an enhanced yield for Improvement X when it is adjacent to District X

If you want the improvement to always give that effect to all players then you can use the ImprovementModifiers table and follow the same logic as is used for the Temple of Artemis, except in this case you would be using the DistrictType matching instead of the BuildingType matching used to create the effect of the Temple of Artemis World Wonder.

But you might run into problems when using ImprovementModifiers to create a Plot Yield Change in that the effects might stack for multiple copies of the improvement -- ie, one copy of the improvement that qualifies might give the correct yield, but a second copy of the improvement might double the effect on all copies of the improvement that qualify, and so on for the third, fourth, fifth etc copy of the improvement.

This is not an issue for the Temple of Artemis effect because improvements don't actually "own" Amenity -- Cities do, so the amenity is given to the owning city and is not directly applied to the plot. Stacking in this case of additional Amenity for the Temple of Artemis effect within a single city is in fact the intention of the Wonder, so does not need to be addressed with Stack limits and the like.
 
Last edited:
I actually started looking into MODIFIER_PLAYER_ADJUST_PLOT_YIELD when I couldn't find anything more specific. What I'm actually trying to do is add yields to mountain tiles based off of adjacent districts (and i've already gotten the mountain tiles workable and with proper base yields, so yay!). I believe I'm able to use REQUIREMENTS_PLOT_IS_MOUNTAIN as the requirement set to limit which plots get the yield bonus. Unless I'm mistaken, I can use that in place of requiring a specific improvement, right?

And is 'REQUIREMENT_PLOT_ADJACENT_DISTRICT_TYPE_MATCHES' already in a usable requirement set? I've found a pretty good list of requirements, but the only names of requirement sets I've found are ones used by existing xml files (like the inca one). I'm not all that familiar with the TEST_ALL method as well, outside of the fact that it's used because you can't create new requirement sets from scratch. Is there a thread or example I should go check out for it? (I can also make a new thread if this ceases to be a 'quick' question)
 
REQUIREMENT_PLOT_ADJACENT_DISTRICT_TYPE_MATCHES is a RequirementType and not a RequirementID or RequirementSetID. So far as I remember it is valid in all three expansions.

REQUIREMENT_PLOT_IS_MOUNTAIN is a valid pre-existing RequirementType at least when GS is being used. I am not sure if it is valid for Vanilla or RaF. And yes you should be able to use that instead of a REQUIREMENT_PLOT_IMPROVEMENT_TYPE_MATCHES

The larger problem though is whether the game will understand and implement the yield on the Mountain plot and let city citizens be assigned to work the mountain plot(s). I can't remember at the moment whether the Inca folks actually work mountain tiles or whether its all just adjacency to mountains that they get like they did in Civ5. Nevermind -- reading comprehension is a thing I guess. You did say you had already cracked this part of the issue.

---------------------------------------

I think you should download and read my pdf file's chapter on Dynamic Modifiers and Game Effects. Or the two tutorial threads re using Modifiers that NycholusV created before he moved on from modding Civ6.

You can certainly create your own RequirementSetID and RequirmentID -- and everyone pretty much does this when adding a modifier with a set of requirements. What you cannot do is create new RequirementTypes.

Every new RequirmentSetId needs a "test" method such as this
Code:
	<RequirementSets>
		<Row>
			<RequirementSetId>MACHU_PICCHU_YIELD_MODIFIER_REQUIREMENTS</RequirementSetId>
			<RequirementSetType>REQUIREMENTSET_TEST_ANY</RequirementSetType>
		</Row>
	</RequirementSets>
Snippeted from some personal code where I am adding an additional effect via a modifier to the Macchu Picchu World Wonder.

Or here where I create a plot has Stone RequirementSet
Code:
		<Replace>
			<RequirementSetId>RESOURCE_IS_STONE</RequirementSetId>
			<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
		</Replace>

Whether you use
Code:
<RequirementSetType>REQUIREMENTSET_TEST_ANY</RequirementSetType>
or
Code:
<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
depends entirely on what you want the modifier to do. If you want a series of conditions ALL of which must be satisfied then you use "TEST_ALL" -- if you have a series of conditions any one of which being satisfied should allow the modifier to be applied then you want "TEST_ANY".
 
Last edited:
How to add cannon fire FX out of this?

upload_2020-2-17_2-35-26.png

This is what i've done so far with Carrack but no cannon flash YET. what else needs done next?
 
Spoiler :
REQUIREMENT_PLOT_ADJACENT_DISTRICT_TYPE_MATCHES is a RequirementType and not a RequirementID or RequirementSetID. So far as I remember it is valid in all three expansions.

REQUIREMENT_PLOT_IS_MOUNTAIN is a valid pre-existing RequirementType at least when GS is being used. I am not sure if it is valid for Vanilla or RaF. And yes you should be able to use that instead of a REQUIREMENT_PLOT_IMPROVEMENT_TYPE_MATCHES

The larger problem though is whether the game will understand and implement the yield on the Mountain plot and let city citizens be assigned to work the mountain plot(s). I can't remember at the moment whether the Inca folks actually work mountain tiles or whether its all just adjacency to mountains that they get like they did in Civ5. Nevermind -- reading comprehension is a thing I guess. You did say you had already cracked this part of the issue.

---------------------------------------

I think you should download and read my pdf file's chapter on Dynamic Modifiers and Game Effects. Or the two tutorial threads re using Modifiers that NycholusV created before he moved on from modding Civ6.

You can certainly create your own RequirementSetID and RequirmentID -- and everyone pretty much does this when adding a modifier with a set of requirements. What you cannot do is create new RequirementTypes.

Every new RequirmentSetId needs a "test" method such as this
Code:
    <RequirementSets>
        <Row>
            <RequirementSetId>MACHU_PICCHU_YIELD_MODIFIER_REQUIREMENTS</RequirementSetId>
            <RequirementSetType>REQUIREMENTSET_TEST_ANY</RequirementSetType>
        </Row>
    </RequirementSets>
Snippeted from some personal code where I am adding an additional effect via a modifier to the Macchu Picchu World Wonder.

Or here where I create a plot has Stone RequirementSet
Code:
        <Replace>
            <RequirementSetId>RESOURCE_IS_STONE</RequirementSetId>
            <RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
        </Replace>

Whether you use
Code:
<RequirementSetType>REQUIREMENTSET_TEST_ANY</RequirementSetType>
or
Code:
<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
depends entirely on what you want the modifier to do. If you want a series of conditions ALL of which must be satisfied then you use "TEST_ALL" -- if you have a series of conditions any one of which being satisfied should allow the modifier to be applied then you want "TEST_ANY".

Thanks very much for the help and advice. I was able to make it work perfectly! :D

The guide was suuuuuper helpful in understanding the format for all the requirement stuff. As a note though, the link in your signature seems to be broken. I was able to find you guide by searching the forums, but the link from your signature just leads me to an error page.
 
Real quick... I can't figure out how to make my mods font have color. Like the "JwF" in the JwF mods are yellow. I'm wanting to do something like that too.
 
Real quick... I can't figure out how to make my mods font have color. Like the "JwF" in the JwF mods are yellow. I'm wanting to do something like that too.
Use Font Colors in brackets surrounding the text you want to have color - [Whatever Font Color]Text you want colored[ENDCOLOR]
 
Has a way to make the parameters CIVIC_COST_PERCENT_CHANGE_AFTER_GAME_ERA', TECH_COST_PERCENT_CHANGE_AFTER_GAME_ERA', CIVIC_COST_PERCENT_CHANGE_BEFORE_GAME_ERA', and 'TECH_COST_PERCENT_BEFORE_AFTER_GAME_ERA' function for GS rulesets again?

It's really frustrating to try and balance things without that working.
 
That is maddening, but thank you for the response. I've... got a lot of thinking to do now.
 
Is anyone aware of a Requirement or Requirement-Set that checks what the current era is? I thought it'd be neat to make the ai agenda for the civ I'm making not declare war on city states after the game reaches the Industrial Era.

(I suppose I could always approximate it by requiring the civ unlock a certain tech or civic)
 
Top Bottom