Quick Modding Questions Thread

I've looked through the Guides & References section but I haven't found a more in-depth explanation of various attributes in the game's XML code.

I have now tinkered a lot with MODIFIERS and REQUIREMENTS but still find it difficult to execute intuitively easy changes and conditions for them.

Is there an explanation anywhere for MODIFIER attributes like:
Permanent, RunOnce, NewOnly, and stack limits?

Or for REQUIREMENTS attributes like:
Reverse, Persistent, etc?

And why does some modifiers only work with some requirements?
For e.g. the Conquistadors requirements of having a religious unit on the same plot seems to work for the modifier increasing combat strength, but not for the modifier increasing the unit's attack range.
 
I've looked through the Guides & References section but I haven't found a more in-depth explanation of various attributes in the game's XML code.

I have now tinkered a lot with MODIFIERS and REQUIREMENTS but still find it difficult to execute intuitively easy changes and conditions for them.

Is there an explanation anywhere for MODIFIER attributes like:
Permanent, RunOnce, NewOnly, and stack limits?

Or for REQUIREMENTS attributes like:
Reverse, Persistent, etc?

And why does some modifiers only work with some requirements?
For e.g. the Conquistadors requirements of having a religious unit on the same plot seems to work for the modifier increasing combat strength, but not for the modifier increasing the unit's attack range.
Don't know much about these parameters as I haven't had to deal with them in my mods, except RunOnce and Permanent. And I don't know these 2 perfectly either, except that they are used with modifiers from great people and the like, where the game runs a script that attaches a modifier to a district or something, these modifiers are RunOnce=true and Permanent=true. Modifiers are RunOnce=false by default, which means that the modifier will update every turn and see if conditions has changed. Permanent=true works with modifiers of the type "attach modifier to target", which great people modifiers are. Modifiers that are connected to a district or whatever by using "attach modifier to target", I think they go away after every turn. Normally they are refreshed because the modifier is RunOnce=false and will run at the start of every turn. But in the case of great people modifiers that's not possible because the great people disappear when activated.

Edit: and stack limit parameter I will guess refers to how many times a modifier can be applied to the same target, for example if you have a policy with a modifier that give +5 strength to all units, and a government building with the same modifier giving +5 strength to all units, I would think that setting stacklimit to 1 prevents both sources from applying, so that total strength increases by +5 rather than +10.

I also think the conquistador requirement should work with other modifiertypes like the increase range one. What code did you use?
 
Last edited:
@Knasp - Take a look through Lee's Modding Guide. It's the most up to date resource and fairly comprehensive.
Just ignore everything in the current version of the guide relating to how to Download the SDK and Assets packages from Steam.

Because the latest (and really quite organizationally and visually dreadful) version of the Steam Interface has completely invalidated it.
 
Thanks for replies! I think I understand RunOnce and Permanent better now.

So a modifier by default will stick around every turn that its owner exists and the effect will only apply if the requirements are met during each turn.

By setting RunOnce = true, the modifier will not stick around for any subsequent turns, once it has been run.

By setting Permanent = true, the modifier's effect will remain for any following turn(s), once the modifier has run. But if RunOnce isn't true, does the modifier accumulate new effects every turn? Or is the old effect removed every turn anyway?

Still curious about the other attributes, especially regarding Requirements.
 
By setting RunOnce = true, the modifier will not stick around for any subsequent turns, once it has been run.
By setting Permanent = true, the modifier's effect will remain for any following turn(s), once the modifier has run. But if RunOnce isn't true, does the modifier accumulate new effects every turn? Or is the old effect removed every turn anyway?
All modifiers are internally attached to their owners all the time, until conditions (e.g. requirements) change and then they are detached.
Usual way is that modifier is attached and its effects are active, then it is detached and its effects are gone. You can change this using those extra features.
RunOnce - simple, it is executed once. It could be attached later again, but it will not be executed. There is no stacking or accumulating of effects, never.
Permanent - the effect of the modifier is permanent; I don't remember now, but I think it just cannot be detached, even if conditions are no longer met.
 
I was wondering if the following is possible:
I'm trying to get a Governor promotion to award the player an envoy when they complete the construction of a district in the city.
It seems that the effect is specific and I'm scrolling through the available effects and requirements and not really finding anything that would allow it to work.
Any ideas?

EDIT: I suppose my main question is how do you get an effect to occur upon the completion of something? I know there are effects that are specific (like faith upon building completion), but I suppose I'm trying to find out if there is a requirement type for the completion of a building or district of whatever...
 
Last edited:
Acropolis given an envoy when completed. It used the modifiertype MODIFIER_PLAYER_GRANT_INFLUENCE_TOKEN. You can try to attach that to other districts, but put as requirement "city has governor X promotion"
I did the following and it didn't work:
Code:
<DistrictModifiers>
        <Row DistrictType="DISTRICT_CAMPUS" ModifierId="CIVIC_AWARD_ONE_INFLUENCE_TOKEN" SubjectRequirementSetId="SM_CITY_HAS_GOVERNOR_PROMOTION_WATER_WORKS"/>
        <Row DistrictType="DISTRICT_COMMERCIAL_HUB" ModifierId="CIVIC_AWARD_ONE_INFLUENCE_TOKEN" SubjectRequirementSetId="SM_CITY_HAS_GOVERNOR_PROMOTION_WATER_WORKS"/>
        <Row DistrictType="DISTRICT_HARBOR" ModifierId="CIVIC_AWARD_ONE_INFLUENCE_TOKEN" SubjectRequirementSetId="SM_CITY_HAS_GOVERNOR_PROMOTION_WATER_WORKS"/>
        <Row DistrictType="DISTRICT_HOLY_SITE" ModifierId="CIVIC_AWARD_ONE_INFLUENCE_TOKEN" SubjectRequirementSetId="SM_CITY_HAS_GOVERNOR_PROMOTION_WATER_WORKS"/>
        <Row DistrictType="DISTRICT_THEATER" ModifierId="CIVIC_AWARD_ONE_INFLUENCE_TOKEN" SubjectRequirementSetId="SM_CITY_HAS_GOVERNOR_PROMOTION_WATER_WORKS"/>
        <Row DistrictType="DISTRICT_INDUSTRIAL_ZONE" ModifierId="CIVIC_AWARD_ONE_INFLUENCE_TOKEN" SubjectRequirementSetId="SM_CITY_HAS_GOVERNOR_PROMOTION_WATER_WORKS"/>
    </DistrictModifiers>
    <RequirementSets>
        <Row RequirementSetId="SM_CITY_HAS_GOVERNOR_PROMOTION_WATER_WORKS" RequirementSetType="REQUIREMENTSET_TEST_ALL"/>
    </RequirementSets>
    <RequirementSetRequirements>
        <Row RequirementSetId="SM_CITY_HAS_GOVERNOR_PROMOTION_WATER_WORKS" RequirementId="SM_WATER_WORKS_PROMO_RID"/>
    </RequirementSetRequirements>
    <Requirements>
        <Row RequirementId="SM_WATER_WORKS_PROMO_RID" RequirementType="REQUIREMENT_CITY_HAS_SPECIFIC_GOVERNOR_PROMOTION_TYPE"/>
    </Requirements>
    <RequirementArguments>
        <Row RequirementId="SM_WATER_WORKS_PROMO_RID" Name="Established" Value="true"/>
        <Row RequirementId="SM_WATER_WORKS_PROMO_RID" Name="GovernorPromotionType" Value="GOVERNOR_PROMOTION_WATER_WORKS"/>
    </RequirementArguments>
Did I do something wrong?
 
Oh. Apparently the DistrictModifiers table has no space for SubjectRequirements:
Code:
[3766498.097] [Gameplay] ERROR: table DistrictModifiers has no column named SubjectRequirementSetId
[3766498.097] [Gameplay]: In Query - insert into DistrictModifiers('DistrictType', 'ModifierId', 'SubjectRequirementSetId') values (?, ?, ?);
[3766498.097] [Gameplay]: In XMLSerializer while updating table DistrictModifiers from file Gameplay.xml.
[3766499.541] [Gameplay]: Validating Foreign Key Constraints...
[3766499.580] [Gameplay]: Passed Validation.
Is there any other way to attach a prereq to it?
 
I don't know if I'm understanding correctly, but let me check,
So, I should just create a Modifier ID within in the modifier table with the correct Modifier Type (which I'm going to assume is "MODIFIER_PLAYER_GRANT_INFLUENCE_TOKEN" since the "Districts.xml" doesn't say what it is) and then create a Subject Requirement Set ID that includes two Requirement IDs (one for the required governor promo and one for the appropriate district type, which will be the hardest part for me because I haven't been able to find a requirement based on district completion)?

EDIT: OMG Or do you just mean making another row in the District Modifier table and add another Modifier ID to an existing District :lol: ?
Okay, I think I feel ya. I'll test it and see what happens.
 
Last edited:
Okay, so I got another question xD
I'm trying to get a governor promotion to produce a Loyalty Bomb (Loyalty Attack) when a Wonder is completed.
Code:
    <Types>
        <Row Type="SM_WONDER_LOYALTY_BOMB" Kind="KIND_MODIFIER"/>
    </Types>
    <DynamicModifiers>
        <Row ModifierType="SM_WONDER_LOYALTY_BOMB" CollectionType="COLLECTION_OWNER" EffectType="EFFECT_ADJUST_CITY_IDENTITY_PRESSURE"/>
    </DynamicModifiers>
    <GovernorPromotionModifiers>
        <Delete GovernorPromotionType="GOVERNOR_PROMOTION_RESOURCE_MANAGER_INDUSTRIALIST"/>
        <Row GovernorPromotionType="GOVERNOR_PROMOTION_RESOURCE_MANAGER_INDUSTRIALIST" ModifierId="SM_WONDER_LOYALTY_BOMB_ID"/>
    </GovernorPromotionModifiers>
    <Modifiers>
        <Row ModifierId="SM_WONDER_LOYALTY_BOMB_ID" ModifierType="SM_WONDER_LOYALTY_BOMB" RunOnce="true" Permanent="true" SubjectRequirementSetId="SM_CITY_BUILDS_WONDER"/>
    </Modifiers>
    <ModifierArguments>
        <Row ModifierId="SM_WONDER_LOYALTY_BOMB_ID" Name="Amount" Value="100"/>
    </ModifierArguments>
    <RequirementSets>
        <Row RequirementSetId="SM_CITY_BUILDS_WONDER" RequirementSetType="REQUIREMENTSET_TEST_ALL"/>
    </RequirementSets>
    <RequirementSetRequirements>
        <Row RequirementSetId="SM_CITY_BUILDS_WONDER" RequirementId="SM_CITY_BUILDS_WONDER_ID"/>
    </RequirementSetRequirements>
    <Requirements>
        <Row RequirementId="SM_CITY_BUILDS_WONDER_ID" RequirementType="REQUIREMENT_PLAYER_BUILT_NEW_WONDER"/>
    </Requirements>
I've also tried the "EFFECT_GRANT_CITY_LOYALTY" effect type but that doesn't work either.
Any ideas?
 
And why does some modifiers only work with some requirements?
For e.g. the Conquistadors requirements of having a religious unit on the same plot seems to work for the modifier increasing combat strength, but not for the modifier increasing the unit's attack range.
I figured out how the Requirements were working thanks to your suggestions above.

The problem was that "REQUIREMENT_PLOT_UNIT_TYPE_MATCHES" only works if the unit owning the modifier moves onto the required unit's plot, not the other way around. And also the requirement didn't work if the support unit was being escorted and they moved together. It did however trigger by locking and then unlocking a escort-formation. I incorrectly assumed that the requirement would be met simply whenever the unit type would be present on the same plot, but that wasn't the case. I also tried adding Persistent = true and aslo tried with Triggered = true to see if that changed anything, but I couldn't see any difference.

On the other hand it was possible to get: "REQUIREMENT_PLOT_NEARBY_UNIT_TAG_MATCHES" to work, but only if using the modifier: "MODIFIER_PLAYER_UNITS_GRANT_ABILITY". The requirement couldn't be used directly with the modifier affecting attack range or combat strength.
 
Last edited:
I am having trouble getting diacritics and accented letters to show up properly in text ["English (United States)" language]. For example, if I'm trying to make a religion name that has an "ë" in it, that letter shows up as a .notdef glyph in-game.

Code:
<GameData>
<LocalizedText>
        <Row Tag="LOC_RELIGION_OROME_NAME" Language="en_US">
            <Text>Oromë</Text>
        </Row>
</LocalizedText>
</GameData>

For me, the above religion name shows up as "Orom☒" in-game. However, if I just choose a custom religion in-game and type out Oromë using the alt-code, it displays fine. This leads me to think it's something that I'm doing wrong in the mod. I've analyzed other peoples' mods which use diacritics and display fine and I can't see any difference in the code they used compared to mine, and I feel like I'm missing something!

Does anything special have to be done to get diacritics/accented letters to appear properly in text from a mod?
 
Last edited:
Back
Top Bottom