Requirement not re-evaluating when city lost


Nov 6, 2021
I'm trying to add modifiers based on the number of cities a player has. This works correctly when gaining cities (as shown in game and in FireTuner):
  • At 1 city, only the Requirement for having 1 city is marked as Met, and only the Modifier for having 1 city is applied.
  • At 2 cities, the 1-city and 2-city Requirements are met, and both of their Modifiers are applied.
However, when I test losing a city by trading it to the AI, the 2-city Requirement is still marked as met and the Modifier for 2 cities is still applied, even though I only have one city.

For the modifiers, both RunOnce and Permanent are false (confirmed by FireTuner).

Here is the requirements code:
-- Requirements
INSERT INTO Requirements (RequirementId, RequirementType) VALUES

-- RequirementArguments
INSERT INTO RequirementArguments (RequirementId, Name, Value) VALUES
('ZZ_REQUIRE_1_CITY', 'Amount', 1),
('ZZ_REQUIRE_2_CITY', 'Amount', 2);
-- RequirementSets
INSERT INTO RequirementSets (RequirementSetId, RequirementSetType) VALUES

-- RequirementSetRequirements
INSERT INTO RequirementSetRequirements (RequirementSetId, RequirementId) VALUES

I believe the issue is with the Requirement still being marked as Met even when I have fewer cities. Is this just an issue with REQUIREMENT_PLAYER_HAS_AT_LEAST_NUMBER_CITIES? Like perhaps the game logic looks at the most cities you've ever had rather than your current number? If so, is there another way I can track number of cities?

Here's the Modifier code if that helps. I've tried adding the modifier two different ways (as TraitModifier or DistrictModifier), but they both behave the same.
-- Modifiers for Trait
INSERT INTO Modifiers (ModifierId, ModifierType, OwnerRequirementSetId) VALUES
-- ModifierArguments
INSERT INTO ModifierArguments (ModifierId, Name, Value) VALUES

INSERT INTO ModifierArguments (ModifierId, Name, Value) VALUES
('ZZ_MODIFIER_TRAIT_1_CITY_PROD', 'Amount', +5),
('ZZ_MODIFIER_TRAIT_2_CITY_PROD', 'Amount', +10);

-- TraitModifiers
INSERT INTO TraitModifiers (TraitType, ModifierId) VALUES
Many Modifiers and Requirements have similar Issues to this, like some Requirements that check for the owner in "OwnerRequirementSetId" AND "SubjectRequirementSetId" (not the Subject). This is due to the Hardcoded Effects and Requirements that might have only been coded for the Purpose they are made for, so the Devs might not have checked for these kind of Issues that might arise, since it's beyond what they have intended the Effects/Requirements for.

Though, you can use lua to achieve the same Goal by using PlotProperties, you can use my Real Allies Mod as reference.
Top Bottom