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

Help with adding new Policy Branch

Discussion in 'Civ5 - Creation & Customization' started by Jiska, May 19, 2019.

  1. Jiska

    Jiska Chieftain

    Joined:
    Apr 23, 2016
    Messages:
    77
    Hey all. I've been banging my head against a wall for a couple of days now...

    So I added some Policies:
    Code:
    <PolicyBranchTypes>
            <Row>
                <Type>POLICY_BRANCH_CIVICS</Type>
                <Description>TXT_KEY_POLICY_BRANCH_CIVICS</Description>
                <Help>TXT_KEY_POLICY_BRANCH_CIVICS_HELP</Help>
                <Title>TXT_KEY_CIVICS_TITLE</Title>
            </Row>
        </PolicyBranchTypes>
        <Policies>
            <Row>
                <Type>POLICY_CIVICS</Type>
                <Description>TXT_KEYPOLICY_CIVICS</Description>
                <Civilopedia>TXT_KEY_POLICY_CIVICS_TEXT</Civilopedia>
                <Help>TXT_KEY_POLICY_CIVICS_HELP</Help>
            </Row>
           
            <Row>
                <Type>CIVIC_DEMOCRACY</Type>
                <Description>TXT_KEY_CIVIC_DEMOCRACY</Description>
                <Civilopedia>TXT_KEY_PCIVIC_DEMOCRACY_TEXT</Civilopedia>
                <Help>TXT_KEY_CIVIC_DEMOCRACY_HELP</Help>
                <PolicyBranchType>POLICY_BRANCH_CIVICS</PolicyBranchType>
                <CultureCost>10</CultureCost>
                <GridX>10</GridX>
                <GridY>1</GridY>
                <PortraitIndex>6</PortraitIndex>
                <IconAtlas>POLICY_ATLAS_EXP2</IconAtlas>
                <IconAtlasAchieved>POLICY_A_ATLAS_EXP2</IconAtlasAchieved>
            </Row>
            <Row>
                <Type>CIVIC_PLUTOCRACY</Type>
                <Description>TXT_KEY_CIVIC_PLUTOCRACY</Description>
                <Civilopedia>TXT_KEY_PCIVIC_PLUTOCRACY_TEXT</Civilopedia>
                <Help>TXT_KEY_CIVIC_PLUTOCRACY_HELP</Help>
                <PolicyBranchType>POLICY_BRANCH_CIVICS</PolicyBranchType>
                <CultureCost>10</CultureCost>
                <GridX>12</GridX>
                <GridY>1</GridY>
                <PortraitIndex>6</PortraitIndex>
                <IconAtlas>POLICY_ATLAS_EXP2</IconAtlas>
                <IconAtlasAchieved>POLICY_A_ATLAS_EXP2</IconAtlasAchieved>
            </Row>
            <Row>
                <Type>CIVIC_OLIGARCHY</Type>
                <Description>TXT_KEY_CIVIC_OLIGARCHY</Description>
                <Civilopedia>TXT_KEY_PCIVIC_OLIGARCHY_TEXT</Civilopedia>
                <Help>TXT_KEY_CIVIC_OLIGARCHY_HELP</Help>
                <PolicyBranchType>POLICY_BRANCH_CIVICS</PolicyBranchType>
                <CultureCost>10</CultureCost>
                <GridX>14</GridX>
                <GridY>1</GridY>
                <PortraitIndex>6</PortraitIndex>
                <IconAtlas>POLICY_ATLAS_EXP2</IconAtlas>
                <IconAtlasAchieved>POLICY_A_ATLAS_EXP2</IconAtlasAchieved>
            </Row>
            <Row>
                <Type>CIVIC_MONARCHY</Type>
                <Description>TXT_KEY_CIVIC_MONARCHY</Description>
                <Civilopedia>TXT_KEY_PCIVIC_MONARCHY_TEXT</Civilopedia>
                <Help>TXT_KEY_CIVIC_MONARCHY_HELP</Help>
                <PolicyBranchType>POLICY_BRANCH_CIVICS</PolicyBranchType>
                <CultureCost>10</CultureCost>
                <GridX>16</GridX>
                <GridY>1</GridY>
                <PortraitIndex>6</PortraitIndex>
                <IconAtlas>POLICY_ATLAS_EXP2</IconAtlas>
                <IconAtlasAchieved>POLICY_A_ATLAS_EXP2</IconAtlasAchieved>
            </Row>
    
    
            <Row>
                <Type>CIVIC_EMPIRE</Type>
                <Description>TXT_KEY_CIVIC_EMPIRE</Description>
                <Civilopedia>TXT_KEY_PCIVIC_EMPIRE_TEXT</Civilopedia>
                <Help>TXT_KEY_CIVIC_EMPIRE_HELP</Help>
                <PolicyBranchType>POLICY_BRANCH_CIVICS</PolicyBranchType>
                <CultureCost>10</CultureCost>
                <GridX>7</GridX>
                <GridY>2</GridY>
                <PortraitIndex>6</PortraitIndex>
                <IconAtlas>POLICY_ATLAS_EXP2</IconAtlas>
                <IconAtlasAchieved>POLICY_A_ATLAS_EXP2</IconAtlasAchieved>
            </Row>
            <Row>
                <Type>CIVIC_ASSEMBLAGE</Type>
                <Description>TXT_KEY_CIVIC_ASSEMBLAGE</Description>
                <Civilopedia>TXT_KEY_PCIVIC_ASSEMBLAGE_TEXT</Civilopedia>
                <Help>TXT_KEY_CIVIC_ASSEMBLAGE_HELP</Help>
                <PolicyBranchType>POLICY_BRANCH_CIVICS</PolicyBranchType>
                <CultureCost>10</CultureCost>
                <GridX>9</GridX>
                <GridY>2</GridY>
                <PortraitIndex>6</PortraitIndex>
                <IconAtlas>POLICY_ATLAS_EXP2</IconAtlas>
                <IconAtlasAchieved>POLICY_A_ATLAS_EXP2</IconAtlasAchieved>
            </Row>
            <Row>
                <Type>CIVIC_SCHOLASTICISM</Type>
                <Description>TXT_KEY_CIVIC_SCHOLASTICISM</Description>
                <Civilopedia>TXT_KEY_PCIVIC_SCHOLASTICISM_TEXT</Civilopedia>
                <Help>TXT_KEY_CIVIC_SCHOLASTICISM_HELP</Help>
                <PolicyBranchType>POLICY_BRANCH_CIVICS</PolicyBranchType>
                <CultureCost>10</CultureCost>
                <GridX>11</GridX>
                <GridY>2</GridY>
                <PortraitIndex>6</PortraitIndex>
                <IconAtlas>POLICY_ATLAS_EXP2</IconAtlas>
                <IconAtlasAchieved>POLICY_A_ATLAS_EXP2</IconAtlasAchieved>
            </Row>
            <Row>
                <Type>CIVIC_ARISTOCRACY</Type>
                <Description>TXT_KEY_CIVIC_ARISTOCRACY</Description>
                <Civilopedia>TXT_KEY_PCIVIC_ARISTOCRACY_TEXT</Civilopedia>
                <Help>TXT_KEY_CIVIC_ARISTOCRACY_HELP</Help>
                <PolicyBranchType>POLICY_BRANCH_CIVICS</PolicyBranchType>
                <CultureCost>10</CultureCost>
                <GridX>13</GridX>
                <GridY>2</GridY>
                <PortraitIndex>6</PortraitIndex>
                <IconAtlas>POLICY_ATLAS_EXP2</IconAtlas>
                <IconAtlasAchieved>POLICY_A_ATLAS_EXP2</IconAtlasAchieved>
            </Row>
            <Row>
                <Type>CIVIC_MERCANTILISM</Type>
                <Description>TXT_KEY_CIVIC_MERCANTILISM</Description>
                <Civilopedia>TXT_KEY_PCIVIC_MERCANTILISM_TEXT</Civilopedia>
                <Help>TXT_KEY_CIVIC_MERCANTILISM_HELP</Help>
                <PolicyBranchType>POLICY_BRANCH_CIVICS</PolicyBranchType>
                <CultureCost>10</CultureCost>
                <GridX>15</GridX>
                <GridY>2</GridY>
                <PortraitIndex>6</PortraitIndex>
                <IconAtlas>POLICY_ATLAS_EXP2</IconAtlas>
                <IconAtlasAchieved>POLICY_A_ATLAS_EXP2</IconAtlasAchieved>
            </Row>
            <Row>
                <Type>CIVIC_PLURALISM</Type>
                <Description>TXT_KEY_CIVIC_PLURALISM</Description>
                <Civilopedia>TXT_KEY_PCIVIC_PLURALISM_TEXT</Civilopedia>
                <Help>TXT_KEY_CIVIC_PLURALISM_HELP</Help>
                <PolicyBranchType>POLICY_BRANCH_CIVICS</PolicyBranchType>
                <CultureCost>10</CultureCost>
                <GridX>17</GridX>
                <GridY>2</GridY>
                <PortraitIndex>6</PortraitIndex>
                <IconAtlas>POLICY_ATLAS_EXP2</IconAtlas>
                <IconAtlasAchieved>POLICY_A_ATLAS_EXP2</IconAtlasAchieved>
            </Row>
            <Row>
                <Type>CIVIC_REPRESENTATION</Type>
                <Description>TXT_KEY_CIVIC_REPRESENTATION</Description>
                <Civilopedia>TXT_KEY_PCIVIC_REPRESENTATION_TEXT</Civilopedia>
                <Help>TXT_KEY_CIVIC_REPRESENTATION_HELP</Help>
                <PolicyBranchType>POLICY_BRANCH_CIVICS</PolicyBranchType>
                <CultureCost>10</CultureCost>
                <GridX>19</GridX>
                <GridY>2</GridY>
                <PortraitIndex>6</PortraitIndex>
                <IconAtlas>POLICY_ATLAS_EXP2</IconAtlas>
                <IconAtlasAchieved>POLICY_A_ATLAS_EXP2</IconAtlasAchieved>
            </Row>
        </Policies>
    
        <Policy_PrereqPolicies>
            <Row>
                <PolicyType>CIVIC_EMPIRE</PolicyType>
                <PrereqPolicy>CIVIC_MONARCHY</PrereqPolicy>
            </Row>
            <Row>
                <PolicyType>CIVIC_ASSEMBLAGE</PolicyType>
                <PrereqPolicy>CIVIC_MONARCHY</PrereqPolicy>
            </Row>
            <Row>
                <PolicyType>CIVIC_SCHOLASTICISM</PolicyType>
                <PrereqPolicy>CIVIC_MONARCHY</PrereqPolicy>
            </Row>
            <Row>
                <PolicyType>CIVIC_SCHOLASTICISM</PolicyType>
                <PrereqPolicy>CIVIC_OLIGARCHY</PrereqPolicy>
            </Row>
            <Row>
                <PolicyType>CIVIC_MERCANTILISM</PolicyType>
                <PrereqPolicy>CIVIC_OLIGARCHY</PrereqPolicy>
            </Row>
            <Row>
                <PolicyType>CIVIC_MERCANTILISM</PolicyType>
                <PrereqPolicy>CIVIC_PLUTOCRACY</PrereqPolicy>
            </Row>
            <Row>
                <PolicyType>CIVIC_ARISTOCRACY</PolicyType>
                <PrereqPolicy>CIVIC_PLUTOCRACY</PrereqPolicy>
            </Row>
            <Row>
                <PolicyType>CIVIC_ARISTOCRACY</PolicyType>
                <PrereqPolicy>CIVIC_DEMOCRACY</PrereqPolicy>
            </Row>
            <Row>
                <PolicyType>CIVIC_PLURALISM</PolicyType>
                <PrereqPolicy>CIVIC_DEMOCRACY</PrereqPolicy>
            </Row>
            <Row>
                <PolicyType>CIVIC_REPRESENTATION</PolicyType>
                <PrereqPolicy>CIVIC_DEMOCRACY</PrereqPolicy>
            </Row>
        </Policy_PrereqPolicies>
    And I messed around with the SocialPolicyPopup, adding Instance and Pipe Managers for my branch, and a new panel to put my Policies in. So far, so good. The problem is that the Policies are locked, and I can't find a way to unlock them. The first tier should be unlocked by default, I assume, because they don't have prereqs. However, they're locked in-game and

    Code:
    Players[0]:SetPolicyBranchUnlocked(GameInfoTypes["POLICY_BRANCH_CIVICS"])
    Doesn't unlock them. I tried setting their prereq to be the opener policy, but this doesn't work. I'm pretty tired, so I don't think I'm explaining this very well, I'm just kind of hoping WHoward will show up knowing exactly what's wrong without any more info.

    In case whoever's reading this DOES need more info, the mod is here: https://drive.google.com/open?id=1wGcRBYEv6TiimT9vEKIs47vT5pNdaqxO

    Really hoping someone can help me out with this. If you need more info lmk
     
  2. ThanOscar

    ThanOscar Chieftain

    Joined:
    Feb 13, 2019
    Messages:
    41
    i believe <PolicyBranchTypes> has a <FreePolicy> which is the thing that actually gives the "dummy" policy when you open the branch. Try Specifying it
     
  3. Jiska

    Jiska Chieftain

    Joined:
    Apr 23, 2016
    Messages:
    77
    No luck with adding <FreePolicy> to my branch... It seems when I set

    Players[0]:SetPolicyBranchUnlocked("GameInfoTypes[POLICY_CIVICS]", true)

    It actually seems to be unlocked tradition. Does this mean the game isn't recognizing my new branch? Do I have to edit the const char* ms_V0PolicyBranchTags[10] = in the dLL?
     
  4. ThanOscar

    ThanOscar Chieftain

    Joined:
    Feb 13, 2019
    Messages:
    41
    Not at all, i had added custom policies branches of my own and seen mods that did so, they just will not be visible in the SocialPolicyPopup as its extremely hardcoded. Players[0]:SetPolicyBranchUnlocked("GameInfoTypes[POLICY_CIVICS]", true) is also using the id of the civics policy instead of the policy branch, so that is not going to work. Try for one using IGE and in the policies panel see if your branch appears
     
  5. Jiska

    Jiska Chieftain

    Joined:
    Apr 23, 2016
    Messages:
    77
    Last edited: May 20, 2019
  6. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,290
    Location:
    Illinois, USA
    Code:
    "GameInfoTypes[POLICY_CIVICS]"
    would not retrieve the ID # of the policy or policy-branch anyway. It would be treated as direct text-string, which it is because of the leading and trailing " characters. So the result within lua is a nil value, which causes the method
    Code:
    Players[0]:SetPolicyBranchUnlocked("GameInfoTypes[POLICY_CIVICS]", true)
    to unlock the default (ie, ID # 0) Policy Branch -- which is POLICY_BRANCH_TRADITION.

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

    Fixing the text string issue and stating as
    Code:
    Players[0]:SetPolicyBranchUnlocked(GameInfoTypes["POLICY_CIVICS"], true)
    would also not behave properly because you would be attempting to unlock a Policy Branch with an ID # that matched to whatever ID # POLICY_CIVICS is assigned by the game -- and this ID # is highly unlikely to match to any ID # of a valid Policy Branch defined within table <PolicyBranchTypes>.
     
  7. Jiska

    Jiska Chieftain

    Joined:
    Apr 23, 2016
    Messages:
    77

Share This Page