Change Yields for Improvements without replacing the Improvement

KingPhantom

Chieftain
Joined
Feb 19, 2018
Messages
22
Location
Switzerland
Hi Community

Is it possible to change the improvements yields bonus with the modifiers that i dont have to replace the improvement?

There is no "ImprovementReplace" like the "DistrictReplace" tags. So a "better" farm is another improvement to the standard farm.

But i would like to edit the yields of the farms of a civ (added to the TraitType like a district or a building).

Anyone an idea? Thank you!
 
Hi Community

Is it possible to change the improvements yields bonus with the modifiers that i dont have to replace the improvement?

There is no "ImprovementReplace" like the "DistrictReplace" tags. So a "better" farm is another improvement to the standard farm.

But i would like to edit the yields of the farms of a civ (added to the TraitType like a district or a building).

Anyone an idea? Thank you!


I think you can use Nubia as a base for this. She gets bonuses from Mines over Strategic Resources.

Nubia uses the modifier MODIFIER_PLAYER_ADJUST_PLOT_YIELD.

If you are using a SQL tool you can see how it is set up with this query:

Code:
select * from civilizationtraits
left join traits on civilizationtraits.TraitType = traits.TraitType
left join traitmodifiers on traitmodifiers.TraitType = CIVILIZATIONtraits.TraitType
left join modifiers on modifiers.ModifierId = traitmodifiers.ModifierId
left join modifierarguments on modifierarguments.ModifierId = modifiers.modifierid
where civilizationtraits.civilizationtype like '%NUBIA%' ;

But basically MODIFIER_PLAYER_ADJUST_PLOT_YIELD requires you to create a RequirementSet that specifies what kind of plot to increase. There is probably one for Farms. If not you'll need to create one.
 
cool. thank you. i read through the 300+ modifiers a couple of time and found some which makes sense to me but not that one. the input of nubia is great. i learned the most about civ modding by reading through the DLC because they are basicly mods with everything in it. dont know why i missed nubia...

i will try it without sql first. avoided it through the whole mod so far.

i found a modifierinput named "ImprovementType" as one trait from the vanilla game effct the "IMPROVEMENT_BARB_CAMPS". i think it should be possible to strap something like that together...

"easiest civ to mod"... :D
 
This is how I made a civ with plantations that give extra production (follow the PLANTATION_PRODUCTION items). Essentially I gave them a modifier that gives plots the desired extra yield, with a restriction that says the plot has to have the improvement in question.

Code:
INSERT INTO TraitModifiers           
        (TraitType,                                                    ModifierId)
VALUES    ('TRAIT_NEM_MELHORAMENTOS',                        'NEM_MELHORAMENTOS_MODIFIER_BUILDERS'),
        ('TRAIT_NEM_MELHORAMENTOS',                        'NEM_MELHORAMENTOS_MODIFIER_PLANTATION_PRODUCTION');
--------------------------------------------------------------------------------------------------------------------------
-- Modifiers
--------------------------------------------------------------------------------------------------------------------------
INSERT INTO Modifiers   
        (ModifierId,                                                ModifierType,                                        SubjectRequirementSetId)
VALUES    ('NEM_MELHORAMENTOS_MODIFIER_BUILDERS',                        'MODIFIER_PLAYER_UNITS_ADJUST_BUILDER_CHARGES',        'UNIT_IS_BUILDER'),
        ('NEM_MELHORAMENTOS_MODIFIER_PLANTATION_PRODUCTION',        'MODIFIER_PLAYER_ADJUST_PLOT_YIELD',        'PLOT_HAS_PLANTATION_REQUIREMENTS');


--------------------------------------------------------------------------------------------------------------------------
-- ModifierArguments
--------------------------------------------------------------------------------------------------------------------------
INSERT INTO ModifierArguments
        (ModifierId,                                                Name,                            Value)
VALUES    ('NEM_MELHORAMENTOS_MODIFIER_BUILDERS',                        'Amount',            '1'),
        ('NEM_MELHORAMENTOS_MODIFIER_PLANTATION_PRODUCTION',                        'YieldType',            'YIELD_PRODUCTION'),
        ('NEM_MELHORAMENTOS_MODIFIER_PLANTATION_PRODUCTION',                        'Amount',            '2');

INSERT INTO RequirementSets
        (RequirementSetId,                                            RequirementSetType)
VALUES    ('PLOT_HAS_PLANTATION_REQUIREMENTS',                            'REQUIREMENTSET_TEST_ALL');

INSERT INTO RequirementSetRequirements
        (RequirementSetId,                                            RequirementId)
VALUES    ('PLOT_HAS_PLANTATION_REQUIREMENTS',                        'REQUIREMENT_PLOT_HAS_PLANTATION');

INSERT INTO Requirements
        ('RequirementId',                                            'RequirementType')
VALUES    ('REQUIREMENT_PLOT_HAS_PLANTATION',                            'REQUIREMENT_PLOT_IMPROVEMENT_TYPE_MATCHES');

INSERT INTO RequirementArguments
        (RequirementId,                                                Name,                Value)
VALUES    ('REQUIREMENT_PLOT_HAS_PLANTATION',                            'ImprovementType',    'IMPROVEMENT_PLANTATION');
 
cool. thank you. i read through the 300+ modifiers a couple of time and found some which makes sense to me but not that one. the input of nubia is great. i learned the most about civ modding by reading through the DLC because they are basicly mods with everything in it. dont know why i missed nubia...

i will try it without sql first. avoided it through the whole mod so far.

i found a modifierinput named "ImprovementType" as one trait from the vanilla game effct the "IMPROVEMENT_BARB_CAMPS". i think it should be possible to strap something like that together...

"easiest civ to mod"... :D


If you use a tool like SQLite Studio you can make this somewhat easier on yourself by learning to use Join queries. For example here is what I see in that tool when I search for Traits related to Arabia (only the highlighted bit of code runs):

upload_2018-2-21_21-6-3.png



It takes a little practice but once you get used to reading abilities this way it becomes very easy to duplicate them to create new abilities. For example above I can see that the Modifier TRAIT_GUARANTEE_ONE_PROPHET takes one Argument (GreatPersonClassType). TRAIT_SCIENCE_PER_FOREIGN_CITY_FOLLOWING_RELIGION takes 4 arguments. By scrolling to the left I could see other details like what Trait the Modifier hooks to, what the Description field is for editing the text, and so on.
 
worked perfect. thank you. i can use my basic mysql skills :)

@Imnimo:
Thank you for your input... MODIFIER_PLAYER_ADJUST_PLOT_YIELD worked perfect.

Now im testing in adjusting the HOUSING of the farms... just for this trait. So i tested it with MODIFIER_SINGLE_CITY_ADJUST_IMPROVEMENT_HOUSING. but every modifier which uses this in the vanilla game uses a Tech Requirement... i'm doing the same Farm Requirement as for MODIFIER_PLAYER_ADJUST_PLOT_YIELD... but it doesnt work. and i found no other modifier that i can use for that.

any ideas? :)
 
worked perfect. thank you. i can use my basic mysql skills :)

@Imnimo:
Thank you for your input... MODIFIER_PLAYER_ADJUST_PLOT_YIELD worked perfect.

Now im testing in adjusting the HOUSING of the farms... just for this trait. So i tested it with MODIFIER_SINGLE_CITY_ADJUST_IMPROVEMENT_HOUSING. but every modifier which uses this in the vanilla game uses a Tech Requirement... i'm doing the same Farm Requirement as for MODIFIER_PLAYER_ADJUST_PLOT_YIELD... but it doesnt work. and i found no other modifier that i can use for that.

any ideas? :)

If we look at the modifiers.xml file, we can see what sort of Collection each modifier applies to:

Code:
        <Row>
            <ModifierType>MODIFIER_PLAYER_ADJUST_PLOT_YIELD</ModifierType>
            <CollectionType>COLLECTION_PLAYER_PLOT_YIELDS</CollectionType>
            <EffectType>EFFECT_ADJUST_PLOT_YIELD</EffectType>
        </Row>

Code:
        <Row>
            <ModifierType>MODIFIER_SINGLE_CITY_ADJUST_IMPROVEMENT_HOUSING</ModifierType>
            <CollectionType>COLLECTION_OWNER</CollectionType>
            <EffectType>EFFECT_ADJUST_IMPROVEMENT_HOUSING</EffectType>
        </Row>

Maybe there's a way to find out exactly what each collection type means, but I don't know what it is. I just make an educated guess based on the name. The first one looks like it applies to plots, but the second one doesn't, it looks like it applies to its 'owner', which in this case is an improvement (If we look in improvements.xml, we can see it applied to Stepwell), so we can't apply a plot requirement to it. I'm not sure how to make this effect work, though. Maybe you could make a new modifier that applies the EFFECT_ADJUST_IMPROVEMENT_HOUSING to a different collection type, but I've had mixed luck with that sort of approach.
 
ive checked the effects but i have no idea... sometimes i think its logical... just amount for housing... but this is civ6...
 
i got it. i'm able to edit the housing of a farm.

i added a new custom modifier and added the collection type from the MODIFIER_PLAYER_ADJUST_PLOT_YIELD to bring it away from "COLLECTION_OWNER" and to the player

here is the whole code for editing the farm food, production and housing. everything is added to the +1 food and +0.5 housing of a normal farm. the improvement and his tooltip remain the same as vanilla... but i think thats the same with nubia's mine production bonus. its not mentioned in the builders action tooltip.

thank you imnion for the tipp with the effect and custom modifier.

<Types>
<Row>
<Type>MODIFIER_PLAYER_CITY_ADJUST_IMPROVEMENT_HOUSING</Type>
<Kind>KIND_MODIFIER</Kind>
</Row>
</Types>

<DynamicModifiers>
<Row>
<ModifierType>MODIFIER_PLAYER_CITY_ADJUST_IMPROVEMENT_HOUSING</ModifierType>
<CollectionType>COLLECTION_PLAYER_PLOT_YIELDS</CollectionType>
<EffectType>EFFECT_ADJUST_IMPROVEMENT_HOUSING</EffectType>
</Row>
</DynamicModifiers>

<Modifiers>
<Row>
<ModifierId>TRAIT_IMPROVEMENT_FARM_FOOD</ModifierId>
<ModifierType>MODIFIER_PLAYER_ADJUST_PLOT_YIELD</ModifierType>
<SubjectRequirementSetId>PLOT_HAS_IMPROVEMENT_FARM_REQUIREMENTS</SubjectRequirementSetId>
</Row>
<Row>
<ModifierId>TRAIT_IMPROVEMENT_FARM_PRODUCTION</ModifierId>
<ModifierType>MODIFIER_PLAYER_ADJUST_PLOT_YIELD</ModifierType>
<SubjectRequirementSetId>PLOT_HAS_IMPROVEMENT_FARM_REQUIREMENTS</SubjectRequirementSetId>
</Row>
<Row>
<ModifierId>TRAIT_IMPROVEMENT_FARM_HOUSING</ModifierId>
<ModifierType>MODIFIER_PLAYER_CITY_ADJUST_IMPROVEMENT_HOUSING</ModifierType>
<SubjectRequirementSetId>PLOT_HAS_IMPROVEMENT_FARM_REQUIREMENTS</SubjectRequirementSetId>
</Row>
</Modifiers>

<ModifierArguments>
<Row>
<ModifierId>TRAIT_IMPROVEMENT_FARM_FOOD</ModifierId>
<Name>YieldType</Name>
<Value>YIELD_FOOD</Value>
</Row>
<Row>
<ModifierId>TRAIT_IMPROVEMENT_FARM_FOOD</ModifierId>
<Name>Amount</Name>
<Value>1</Value>
</Row>
<Row>
<ModifierId>TRAIT_IMPROVEMENT_FARM_PRODUCTION</ModifierId>
<Name>YieldType</Name>
<Value>YIELD_PRODUCTION</Value>
</Row>
<Row>
<ModifierId>TRAIT_IMPROVEMENT_FARM_PRODUCTION</ModifierId>
<Name>Amount</Name>
<Value>1</Value>
</Row>
<Row>
<ModifierId>TRAIT_IMPROVEMENT_FARM_HOUSING</ModifierId>
<Name>Amount</Name>
<Value>10</Value> <!-- DIRECT VALUE. IT WILL INCREASE BY 10 TO 10.5 -->
</Row>
</ModifierArguments>

<RequirementSets>
<Row>
<RequirementSetId>PLOT_HAS_IMPROVEMENT_FARM_REQUIREMENTS</RequirementSetId>
<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
</Row>
</RequirementSets>
<RequirementSetRequirements>
<Row>
<RequirementSetId>PLOT_HAS_IMPROVEMENT_FARM_REQUIREMENTS</RequirementSetId>
<RequirementId>REQUIRES_PLOT_HAS_FARM</RequirementId>
</Row>
</RequirementSetRequirements>
 
Back
Top Bottom