1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Defensive Strength Policy (RESOLVED)

Discussion in 'Mod Creation Help' started by SocialMechanic, Oct 28, 2019.

  1. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    88
    Having an issue with a policy I'm trying to make.
    I'm trying to get a policy to provide defensive strength to every city the player has with high population size
    Code:
       
    <Types>
           <Row Type="POLICY_SM_TALL14" Kind="KIND_POLICY" />
       </Types>
       <Policies>
          <Row PolicyType="POLICY_SM_TALL14" Name="LOC_POLICY_SM_TALL14_NAME" Description="LOC_POLICY_SM_TALL14_DESCRIPTION" PrereqCivic="CIVIC_NATIONALISM" GovernmentSlotType="SLOT_MILITARY" />
       </Policies>
       <PolicyModifiers>
           <Row PolicyType="POLICY_SM_TALL14" ModifierId="POLICY_SM_TALL14A_MODIFIER" />
           <Row PolicyType="POLICY_SM_TALL14" ModifierId="POLICY_SM_TALL14B_MODIFIER" />
       </PolicyModifiers>
       <Modifiers>
          <Row ModifierId ="POLICY_SM_TALL14A_MODIFIER" ModifierType="MODIFIER_PLAYER_CITIES_ADJUST_OUTER_DEFENSE" SubjectRequirementSetId="SM_TALL14A_REQUIREMENT" />
          <Row ModifierId ="POLICY_SM_TALL14B_MODIFIER" ModifierType="MODIFIER_PLAYER_CITIES_ADJUST_OUTER_DEFENSE" SubjectRequirementSetId="SM_TALL14B_REQUIREMENT" />
       </Modifiers>
       <ModifierArguments>
           <Row ModifierId="POLICY_SM_TALL14A_MODIFIER" Name="Amount" Value="1" />
           <Row ModifierId="POLICY_SM_TALL14B_MODIFIER" Name="Amount" Value="2" />
       </ModifierArguments>
       <RequirementSets>
           <Row RequirementSetId="SM_TALL14A_REQUIREMENT" RequirementSetType="REQUIREMENTSET_TEST_ALL" />
           <Row RequirementSetId="SM_TALL14B_REQUIREMENT" RequirementSetType="REQUIREMENTSET_TEST_ALL" />
       </RequirementSets>
       <RequirementSetRequirements>
           <Row RequirementSetId="SM_TALL14A_REQUIREMENT" RequirementId="SM_TALL14A_REQUIREMENTID" />
           <Row RequirementSetId="SM_TALL14B_REQUIREMENT" RequirementId="SM_TALL14B_REQUIREMENTID" />
       </RequirementSetRequirements>
       <Requirements>
           <Row RequirementId="SM_TALL14A_REQUIREMENTID" RequirementType="REQUIREMENT_CITY_HAS_X_POPULATION" />
           <Row RequirementId="SM_TALL14B_REQUIREMENTID" RequirementType="REQUIREMENT_CITY_HAS_X_POPULATION" />
       </Requirements>
       <RequirementArguments>
           <Row RequirementId="SM_TALL14A_REQUIREMENTID" Name="Amount" Value="10" />
           <Row RequirementId="SM_TALL14B_REQUIREMENTID" Name="Amount" Value="15" />
       </RequirementArguments>
    
    As you can see, I'm trying to get a city to provide a +1 defensive strength bonus if it has a pop of 10 or greater, and then another +2 defensive strength if it has a pop of 15 or greater (total of +3).
    This is only part of the code, actually, because I also have a +3 for 20 pop cities and +4 for 25 pop cities (a total of +6 and +10 respectively).
    But I tested it and it isn't working at all. Any reason why?
     
  2. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,630
    Location:
    Illinois, USA
    The more I look at it the more I think the problem is in the divergence between "MODIFIER_PLAYER_CITIES_ADJUST_OUTER_DEFENSE" and "REQUIREMENT_CITY_HAS_X_POPULATION"

    The Stadium-10 and Stadium-20 requirements are tied to a specific District (ie, the Entertainment Complex) instead of just to "Cities", and are also tied to a tourism effect instead of a defense-strength effect. There's a third example of "REQUIREMENT_CITY_HAS_X_POPULATION" but I didn't chase down exactly what it is actually tied to (a District or a City directly). The RequirementID on the third example Firaxis used is something like Requires_High_Population.
     
  3. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    88
    I've tried linking to the district type of city center and that didn't work either, so maybe this isn't possible?
     
  4. Laurana Kanan

    Laurana Kanan Don’t underestimate who I am.

    Joined:
    Apr 10, 2014
    Messages:
    2,058
    Gender:
    Female
    Location:
    Near the Greatest Snow on Earth
    You might try using COLLECTION_OWNER CollectionType instead of the default COLLECTION_PLAYER_CITIES for that ModifierType?
     
  5. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    88
    I tried it with the following and it didn't work:
    Code:
    <Types>
            <Row Type="SM_CITIES_ADJUST_OUTER_DEFENSE" Kind="KIND_MODIFIER"/>
        </Types>
        <DynamicModifiers>
            <Row>
                <ModifierType>SM_CITIES_ADJUST_OUTER_DEFENSE</ModifierType>
                <CollectionType>COLLECTION_OWNER</CollectionType>
                <EffectType>EFFECT_ADJUST_CITY_OUTER_DEFENSE</EffectType>
            </Row>
        </DynamicModifiers>
        <Types>
            <Row Type="POLICY_SM_TALL14" Kind="KIND_POLICY" />
        </Types>
        <Policies>
            <Row PolicyType="POLICY_SM_TALL14" Name="LOC_POLICY_SM_TALL14_NAME" Description="LOC_POLICY_SM_TALL14_DESCRIPTION" PrereqCivic="CIVIC_NATIONALISM" GovernmentSlotType="SLOT_MILITARY" />
        </Policies>
        <PolicyModifiers>
            <Row PolicyType="POLICY_SM_TALL14" ModifierId="POLICY_SM_TALL14A_MODIFIER" />
            <Row PolicyType="POLICY_SM_TALL14" ModifierId="POLICY_SM_TALL14B_MODIFIER" />
        </PolicyModifiers>
        <Modifiers>
            <Row ModifierId ="POLICY_SM_TALL14A_MODIFIER" ModifierType="SM_CITIES_ADJUST_OUTER_DEFENSE" SubjectRequirementSetId="SM_TALL14A_REQUIREMENT" />
            <Row ModifierId ="POLICY_SM_TALL14B_MODIFIER" ModifierType="SM_CITIES_ADJUST_OUTER_DEFENSE" SubjectRequirementSetId="SM_TALL14B_REQUIREMENT" />
        </Modifiers>
        <ModifierArguments>
            <Row ModifierId="POLICY_SM_TALL14A_MODIFIER" Name="Amount" Value="1" />
            <Row ModifierId="POLICY_SM_TALL14B_MODIFIER" Name="Amount" Value="2" />
        </ModifierArguments>
        <RequirementSets>
            <Row RequirementSetId="SM_TALL14A_REQUIREMENT" RequirementSetType="REQUIREMENTSET_TEST_ALL" />
            <Row RequirementSetId="SM_TALL14B_REQUIREMENT" RequirementSetType="REQUIREMENTSET_TEST_ALL" />
        </RequirementSets>
        <RequirementSetRequirements>
            <Row RequirementSetId="SM_TALL14A_REQUIREMENT" RequirementId="SM_TALL14A_REQUIREMENTID" />
            <Row RequirementSetId="SM_TALL14B_REQUIREMENT" RequirementId="SM_TALL14B_REQUIREMENTID" />
        </RequirementSetRequirements>
        <Requirements>
            <Row RequirementId="SM_TALL14A_REQUIREMENTID" RequirementType="REQUIREMENT_CITY_HAS_X_POPULATION" />
            <Row RequirementId="SM_TALL14B_REQUIREMENTID" RequirementType="REQUIREMENT_CITY_HAS_X_POPULATION" />
        </Requirements>
        <RequirementArguments>
            <Row RequirementId="SM_TALL14A_REQUIREMENTID" Name="Amount" Value="10" />
            <Row RequirementId="SM_TALL14B_REQUIREMENTID" Name="Amount" Value="15" />
        </RequirementArguments>
    
     
  6. Laurana Kanan

    Laurana Kanan Don’t underestimate who I am.

    Joined:
    Apr 10, 2014
    Messages:
    2,058
    Gender:
    Female
    Location:
    Near the Greatest Snow on Earth
    Oh, I guess I misread somewhere and thought you were linking it to a district. COLLECTION_PLAYER_CITIES would be what you wanted after all. Just to clarify, your mod is loading w/o any errors in the logs, correct? Also, are you checking cities that have walls for the effect? Not in the same context as your mod (I had the modifiers attached to buildings), but I've used this EffectType & RequirementType before and haven't had any issues.

    I won't be near a computer for awhile, but if you want to upload your mod, perhaps Lee or someone else can look at it further before I get back.
     
  7. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    88
    Yes, its loading and every other policy are working as intended. It's just this one.
    I was using the "Bastions" military policy as a guide since it also gives City Defense Strength (I'm not sure if that answers your wall question).
     
  8. Laurana Kanan

    Laurana Kanan Don’t underestimate who I am.

    Joined:
    Apr 10, 2014
    Messages:
    2,058
    Gender:
    Female
    Location:
    Near the Greatest Snow on Earth
    I mean, do you have at least ancient walls in your test cities. Otherwise the effect won't show.
     
  9. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    88
    Ooooooh, no I do not. I'll test that now.
    EDIT: Yes, the policy only seems to work if walls are in the city.
    Thank you!
     
    Laurana Kanan likes this.
  10. Laurana Kanan

    Laurana Kanan Don’t underestimate who I am.

    Joined:
    Apr 10, 2014
    Messages:
    2,058
    Gender:
    Female
    Location:
    Near the Greatest Snow on Earth
    Yes, because that is the "Outer Defense". :D
     
  11. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    88
    Is there an "Inner Defense"? lol Because I would still like to have the bonus to apply regardless.
     
  12. Laurana Kanan

    Laurana Kanan Don’t underestimate who I am.

    Joined:
    Apr 10, 2014
    Messages:
    2,058
    Gender:
    Female
    Location:
    Near the Greatest Snow on Earth
    EFFECT_ADJUST_CITY_INNER_DEFENSE. It lists as Palace Guard in the combat preview.
     
  13. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    88
    Oh wow. I was sort of joking but I'll give it a shot! lol Thank you!
     
  14. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    88
    This didn't work actually... I changed it to "MODIFIER_PLAYER_CITIES_ADJUST_INNER_DEFENSE" and I also tried it before and after walls and it didn't work
     
  15. Laurana Kanan

    Laurana Kanan Don’t underestimate who I am.

    Joined:
    Apr 10, 2014
    Messages:
    2,058
    Gender:
    Female
    Location:
    Near the Greatest Snow on Earth
    It doesn't matter whether you have walls or not, I use this effect in one of my mods w/o issue. Without looking at your updated code, I can't really say what the issue is. However, if you look at one of Victor's governor promotions, Redoubt, it'll give you an idea how to set it up.
     
  16. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    88
    This is the code:
    Code:
    <Types>
            <Row Type="POLICY_SM_TALL14" Kind="KIND_POLICY" />
        </Types>
        <Policies>
            <Row PolicyType="POLICY_SM_TALL14" Name="LOC_POLICY_SM_TALL14_NAME" Description="LOC_POLICY_SM_TALL14_DESCRIPTION" PrereqCivic="CIVIC_NATIONALISM" GovernmentSlotType="SLOT_MILITARY" />
        </Policies>
        <PolicyModifiers>
            <Row PolicyType="POLICY_SM_TALL14" ModifierId="POLICY_SM_TALL14A_MODIFIER" />
            <Row PolicyType="POLICY_SM_TALL14" ModifierId="POLICY_SM_TALL14B_MODIFIER" />
        </PolicyModifiers>
        <Modifiers>
            <Row ModifierId ="POLICY_SM_TALL14A_MODIFIER" ModifierType="MODIFIER_PLAYER_CITIES_ADJUST_INNER_DEFENSE" SubjectRequirementSetId="SM_TALL14A_REQUIREMENT" />
            <Row ModifierId ="POLICY_SM_TALL14B_MODIFIER" ModifierType="MODIFIER_PLAYER_CITIES_ADJUST_INNER_DEFENSE" SubjectRequirementSetId="SM_TALL14B_REQUIREMENT" />
        </Modifiers>
        <ModifierArguments>
            <Row ModifierId="POLICY_SM_TALL14A_MODIFIER" Name="Amount" Value="1" />
            <Row ModifierId="POLICY_SM_TALL14B_MODIFIER" Name="Amount" Value="2" />
        </ModifierArguments>
        <RequirementSets>
            <Row RequirementSetId="SM_TALL14A_REQUIREMENT" RequirementSetType="REQUIREMENTSET_TEST_ALL" />
            <Row RequirementSetId="SM_TALL14B_REQUIREMENT" RequirementSetType="REQUIREMENTSET_TEST_ALL" />
        </RequirementSets>
        <RequirementSetRequirements>
            <Row RequirementSetId="SM_TALL14A_REQUIREMENT" RequirementId="SM_TALL14A_REQUIREMENTID" />
            <Row RequirementSetId="SM_TALL14B_REQUIREMENT" RequirementId="SM_TALL14B_REQUIREMENTID" />
        </RequirementSetRequirements>
        <Requirements>
            <Row RequirementId="SM_TALL14A_REQUIREMENTID" RequirementType="REQUIREMENT_CITY_HAS_X_POPULATION" />
            <Row RequirementId="SM_TALL14B_REQUIREMENTID" RequirementType="REQUIREMENT_CITY_HAS_X_POPULATION" />
        </Requirements>
        <RequirementArguments>
            <Row RequirementId="SM_TALL14A_REQUIREMENTID" Name="Amount" Value="10" />
            <Row RequirementId="SM_TALL14B_REQUIREMENTID" Name="Amount" Value="15" />
        </RequirementArguments>
     

Share This Page