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

Basic Policy Problem (RESOLVED)

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

  1. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    86
    Are there common problems with creating policies? Because, I created one that actually shows up in the Civic tree. However, once I research the Civic to use it (The Enlightenment in this case), it isn't among my other policies and the policy it is intended to replace doesn't go away...
    Code:
     
        <Types>
            <Row Type="POLICY_SM_TALL1" Kind="KIND_POLICY" />
        </Types>
    
        <Policies>
            <Row PolicyType="POLICY_SM_TALL1" Name="LOC_POLICY_SM_TALL1_NAME" Description="LOC_POLICY_SM_TALL1_DESCRIPTION" PrereqCivic="CIVIC_THE_ENLIGHTENMENT" GovernmentSlotType="SLOT_ECONOMIC" />
        </Policies>
    
        <ObsoletePolicies>
            <Row PolicyType="POLICY_SM_TALL1" ObsoletePolicy="POLICY_CIVIL_PRESTIGE" />
        </ObsoletePolicies>
    
        <PolicyModifiers>
            <Row PolicyType="POLICY_SM_TALL1" ModifierId="POLICY_SM_TALL1A_MODIFIER"/>
            <Row PolicyType="POLICY_SM_TALL1" ModifierId="POLICY_SM_TALL1B_MODIFIER"/>
            <Row PolicyType="POLICY_SM_TALL1" ModifierId="POLICY_SM_TALL1C_MODIFIER"/>
        </PolicyModifiers>
    
        <Modifiers>
            <Row ModifierId="POLICY_SM_TALL1A_MODIFIER" ModifierType="MODIFIER_PLAYER_CITIES_ADJUST_CITY_YIELD_CHANGE" />
            <Row ModifierId="POLICY_SM_TALL1B_MODIFIER" ModifierType="MODIFIER_PLAYER_CITIES_ADJUST_POLICY_AMENITY" />
            <Row ModifierId="POLICY_SM_TALL1C_MODIFIER" ModifierType="MODIFIER_PLAYER_CITIES_ADJUST_POLICY_HOUSING" />
            <Row>
                <ModifierId>POLICY_SM_TALL1B_MODIFIER</ModifierId>
                <ModifierType>MODIFIER_PLAYER_CITIES_ADJUST_POLICY_AMENITY</ModifierType>
                <SubjectRequirementSetId>CITY_HAS_3_TITLE_GOVERNOR_REQUIREMENTS</SubjectRequirementSetId>
            </Row>
            <Row>
                <ModifierId>POLICY_SM_TALL1C_MODIFIER</ModifierId>
                <ModifierType>MODIFIER_PLAYER_CITIES_ADJUST_POLICY_HOUSING</ModifierType>
                <SubjectRequirementSetId>CITY_HAS_3_TITLE_GOVERNOR_REQUIREMENTS</SubjectRequirementSetId>
            </Row>
        </Modifiers>
    
        <ModifierArguments>
            <Row ModifierId="POLICY_SM_TALL1A_MODIFIER" Name="YieldType" Value="YIELD_FOOD" />
            <Row ModifierId="POLICY_SM_TALL1A_MODIFIER" Name="Amount" Value="2" />
            <Row ModifierId="POLICY_SM_TALL1B_MODIFIER" Name="Amount" Value="2" />
            <Row ModifierId="POLICY_SM_TALL1C_MODIFIER" Name="Amount" Value="2" />
        </ModifierArguments>
    
        <RequirementSets>
            <Row>
                <RequirementSetId>CITY_HAS_3_TITLE_GOVERNOR_REQUIREMENTS</RequirementSetId>
                <RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
            </Row>
        </RequirementSets>
        <RequirementSetRequirements>
            <Row>
                <RequirementSetId>CITY_HAS_3_TITLE_GOVERNOR_REQUIREMENTS</RequirementSetId>
                <RequirementId>REQUIRES_CITY_HAS_3_TITLE_GOVERNOR</RequirementId>
            </Row>
        </RequirementSetRequirements>
        <Requirements>
            <Row>
                <RequirementId>REQUIRES_CITY_HAS_3_TITLE_GOVERNOR</RequirementId>
                <RequirementType>REQUIREMENT_CITY_HAS_GOVERNOR_WITH_X_TITLES</RequirementType>
            </Row>
        </Requirements>
        <RequirementArguments>
            <Row>
                <RequirementId>REQUIRES_CITY_HAS_3_TITLE_GOVERNOR</RequirementId>
                <Name>Established</Name>
                <Value>true</Value>
            </Row>
            <Row>
                <RequirementId>REQUIRES_CITY_HAS_3_TITLE_GOVERNOR</RequirementId>
                <Name>Amount</Name>
                <Value>3</Value>
            </Row>
        </RequirementArguments>
     
    Last edited: Oct 13, 2019
  2. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,603
    Location:
    Illinois, USA
    Your code has two rows in table <Modifiers> where ModifierId="POLICY_SM_TALL1B_MODIFIER" and where ModifierId="POLICY_SM_TALL1C_MODIFIER". These two mistakes both violate the Unique Constraint requirements of table <Modifiers>. There can ever only be one row within the <Modifiers> table that has a given designation for the ModifierId column. Violation of this rule causes the game to cease reading anything further from within the same file upon encountering the first such fatal coding error.

    Database.log will be showing an error message for a Unique Constraint violation.

    You also have mismatches between this
    Code:
    <SubjectRequirementSetId>CITY_HAS_3_TITLE_GOVERNOR_REQUIREMENTS</SubjectRequirementSetId>
    and this
    Code:
        <RequirementSets>
            <Row>
                <RequirementSetId>CITY_HAS_5_TITLE_GOVERNOR_REQUIREMENTS</RequirementSetId>
                <RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
            </Row>
        </RequirementSets>
    Parts of your code are using "HAS_5_TITLE" and other parts are using "HAS_3_TITLE" which ought to be throwing the requirement sets and the individual requirements within it into chaos if not causing an invalid reference error. Except that none if it is being read into the game's database as yet since your fatal syntax errors for Uniqueness Violations is occurring before the definition of the requirement sets and the individual requirements.

    Long story short is you need to fix the syntax and mismatch errors before you can know whether or not the policy card is being implemented completely and correctly by the game.

    -----------------------------

    CIVIC_THE_ENLIGHTENMENT is a renaissance era civic. POLICY_CIVIL_PRESTIGE is a medieval era policy enabled by CIVIC_CIVIL_SERVICE (at least it is for Rise and Fall). This is telling the game that POLICY_CIVIL_PRESTIGE will make POLICY_SM_TALL1 obsolete
    Code:
        <ObsoletePolicies>
            <Row PolicyType="POLICY_SM_TALL1" ObsoletePolicy="POLICY_CIVIL_PRESTIGE" />
        </ObsoletePolicies>
    Careful reading of the game's Vanilla XPAC "Poliocies.xml" file shows that the Policies which occur later in the Civics Tree are always the ones shown in the table as the "ObsoletePolicy".
    Code:
    	<ObsoletePolicies>
    		<!-- Ancient Era-->
    		<Row PolicyType="POLICY_DISCIPLINE" ObsoletePolicy="POLICY_NATIVE_CONQUEST"/>
    POLICY_NATIVE_CONQUEST is an Industrial Era policy which replaces (makes obsolete) POLICY_DISCIPLINE, which is an Ancient Era policy.
     
    Last edited: Oct 13, 2019
  3. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    86
    1) I have no clue what any of that means. Do you mean that I need multiple Modifier tables? Because you can't have two rows with the same Mod Id?
    2) Yeah, that was a silly flook I fixed.
    3) Oh so I have them backwards???? OOPS!!!
     
  4. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,603
    Location:
    Illinois, USA
    Each designation you give for a ModifierId "name" within table <Modifiers> has to be unique to all other ModifierId "names" already given. You cannot have the repeats you have here since you have already given the game that "name" of ModifierId :
    Code:
            <Row>
                <ModifierId>POLICY_SM_TALL1B_MODIFIER</ModifierId>
                <ModifierType>MODIFIER_PLAYER_CITIES_ADJUST_POLICY_AMENITY</ModifierType>
                <SubjectRequirementSetId>CITY_HAS_3_TITLE_GOVERNOR_REQUIREMENTS</SubjectRequirementSetId>
            </Row>
    You already told the game there was a ModifierId called "POLICY_SM_TALL1B_MODIFIER" here in this line earlier
    Code:
     <Row ModifierId="POLICY_SM_TALL1B_MODIFIER" ModifierType="MODIFIER_PLAYER_CITIES_ADJUST_POLICY_AMENITY" />
     
  5. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    86
    Oh, nvm Lee. I see what you are saying. DUH! I can't believe I missed that. Thank you for your help!!!
     

Share This Page