Really Weird Plot Yield Adjustment Problem

tman2000

Prince
Joined
Feb 11, 2025
Messages
479
I'm trying to use a culture tree unlock to change the value of tea plots from 0 gold to 15 gold.

If I use a .sql file, it works, but it will also implement the increase when a town is founded. It will double up the bonus when the modifier unlocks.

If I try to implement in the .xml file, it gives all non-resources the bonus, and all resource plots no bonus. (my theory is something is wrong with the test, so the default response when testing a resource if it's TEA returns false, but if the test never even occurs it returns true - of course I can't invert the result because then all resources, not just tea, will receive the benefit).

Code is below, please help. Mainly there's some principle I'm not understanding here.

Below - works, but will also apply the bonus when a settlement is founded:
Insert INTO TraitModifiers(TraitType, ModifierId) VALUES
('TRAIT_ENGLAND', 'MOD_ACT_OF_UNION_GOLD_BONUS');

Insert INTO Modifiers(ModifierId, ModifierType, SubjectRequirementSetId) VALUES
('MOD_ACT_OF_UNION_GOLD_BONUS', 'MOD_ACT_OF_UNION_GOLD_BONUS_TYPE', 'PLOT_HAS_TEA_REQS');

Insert INTO ModifierArguments(ModifierId, Name, Value) VALUES
('MOD_ACT_OF_UNION_GOLD_BONUS', 'YieldType', 'YIELD_GOLD'),
('MOD_ACT_OF_UNION_GOLD_BONUS', 'Amount','15');

Insert INTO DynamicModifiers(ModifierType, CollectionType, EffectType) VALUES
('MOD_ACT_OF_UNION_GOLD_BONUS_TYPE', 'COLLECTION_PLAYER_PLOT_YIELDS', 'EFFECT_PLOT_ADJUST_YIELD');

Insert INTO Types(Type, Kind) VALUES
('MOD_ACT_OF_UNION_GOLD_BONUS_TYPE', 'KIND_MODIFIER');

Insert INTO RequirementSetRequirements(RequirementSetId, RequirementId) VALUES
('PLOT_HAS_TEA_REQS', 'PLOT_HAS_TEA');

Insert INTO RequirementSets(RequirementSetId, RequirementSetType) VALUES
('PLOT_HAS_TEA_REQS','REQUIREMENTSET_TEST_ALL');

Insert INTO Requirements(RequirementId, RequirementType) VALUES ('PLOT_HAS_TEA', 'REQUIREMENT_PLOT_RESOURCE_TYPE_MATCHES');
Insert INTO RequirementArguments(RequirementId, Name, Value) VALUES ('PLOT_HAS_TEA', 'ResourceType', 'RESOURCE_TEA');

Below - applies the bonus at the appropriate time, but to all non-resource tiles (nothing special happens for tea)
<Modifier id="MOD_ACT_OF_UNION_GOLD_BONUS" collection="COLLECTION_PLAYER_PLOT_YIELDS" effect="EFFECT_PLOT_ADJUST_YIELD">
<SubjectRequirements>
<Requirement type="REQUIREMENT_PLOT_RESOURCE_TYPE_MATCHES" RequirementSetType="REQUIREMENTSET_TEST_ALL">
<Argument Name="ResourceType">RESOURCE_TEA</Argument>
</Requirement>
</SubjectRequirements>
<Argument name="Amount">15</Argument>
<Argument name="YieldType">YIELD_GOLD</Argument>
</Modifier>
 
Weird things testing this.

When I comment out the modifier arguments
Insert INTO ModifierArguments(ModifierId, Name, Value) VALUES
('MOD_ACT_OF_UNION_GOLD_BONUS', 'YieldType', 'YIELD_GOLD'),
('MOD_ACT_OF_UNION_GOLD_BONUS', 'Amount','15');
After making sure to reset the database values (and testing them).

Even with that section commented out it STILL applies the bonus, but only when town founding/growth occurs, since I renamed the modifier unlocked by the civic tree. WEIRD

Meanwhile I have NO idea why the .sql file interprets "Resource type matches tea" as "return true if not a resource" "return false if it's any resource". The same syntax, copied and pasted over, from the .xml file.
 
Two things I've learned experimenting. The reason why commenting out values from the files doesn't change the plot yields is that a previous version of the file updated the database in a previous turn and the save is remembering this. Sort of obvious in retrospect.

Another thing is that it appears that game effects will trigger all versions of that effect in the database, so even if I specify requirements and values, if other requirements using that effect, applied to the same collection, are already in the database, those other values will be triggered where the requirement applies, even if I'm only intending to apply the effect as specified in the trigger.

That's all fine. I still don't know why the requirement syntax works in the .sql file but not in the .xml
 
Back
Top Bottom