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

Problem Modding Social Policies

Discussion in 'Civ5 - Creation & Customization' started by loppnessmonsta, Nov 27, 2013.

  1. loppnessmonsta

    loppnessmonsta Chieftain

    Joined:
    Nov 27, 2013
    Messages:
    19
    I've been working on this mod for weeks now and I'm stuck. My tooltips update fine, but the actual changes don't work.

    This is my PolicyUpdates file:
    Spoiler :
    <GameData>
    <Policies>
    <Update>
    <Where PolicyType="POLICY_HONOR"/>
    <Set CultureFromKills="100"/>
    </Update>
    <!--<Update>
    <Where PolicyType="POLICY_HONOR"/>
    <Set CultureFromBarbarianKills="200"/>
    </Update>-->
    <Update>
    <Where PolicyType="POLICY_CULTURAL_CENTERS"/>
    <Set GreatWriterRateModifier="25"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_CULTURAL_CENTERS"/>
    <Set GreatArtistRateModifier="25"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_CULTURAL_CENTERS"/>
    <Set GreatMusicianRateModifier="25"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_AESTHETICS"/>
    <Set GreatWriterRateModifier="0"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_AESTHETICS"/>
    <Set GreatArtistRateModifier="0"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_AESTHETICS"/>
    <Set GreatMusicianRateModifier="0"/>
    </Update>
    </Policies>
    <Policy_BuildingClassProductionModifiers>
    <Update>
    <Where PolicyType="POLICY_HONOR"/>
    <Set BuildingClassType="BUILDINGCLASS_BARRACKS" ProductionModifier="50"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_HONOR"/>
    <Set BuildingClassType="BUILDINGCLASS_ARMORY" ProductionModifier="50"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_HONOR"/>
    <Set BuildingClassType="BUILDINGCLASS_MILITARY_ACADEMY" ProductionModifier="50"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_PROFESSIONAL_ARMY"/>
    <Set BuildingClassType="BUILDINGCLASS_CONSTABLE" ProductionModifier="50"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_PROFESSIONAL_ARMY"/>
    <Set BuildingClassType="BUILDINGCLASS_POLICE_STATION" ProductionModifier="50"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_AESTHETICS"/>
    <Set BuildingClassType="BUILDINGCLASS_MONUMENT" ProductionModifier="50"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_AESTHETICS"/>
    <Set BuildingClassType="BUILDINGCLASS_AMPHITHEATER" ProductionModifier="50"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_AESTHETICS"/>
    <Set BuildingClassType="BUILDINGCLASS_OPERA_HOUSE" ProductionModifier="50"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_AESTHETICS"/>
    <Set BuildingClassType="BUILDINGCLASS_MUSEUM" ProductionModifier="50"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_AESTHETICS"/>
    <Set BuildingClassType="BUILDINGCLASS_BROADCAST_TOWER" ProductionModifier="50"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_PROFESSIONAL_ARMY"/>
    <Set BuildingClassType="BUILDINGCLASS_BARRACKS" ProductionModifier="0"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_PROFESSIONAL_ARMY"/>
    <Set BuildingClassType="BUILDINGCLASS_ARMORY" ProductionModifier="0"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_PROFESSIONAL_ARMY"/>
    <Set BuildingClassType="BUILDINGCLASS_MILITARY_ACADEMY" ProductionModifier="0"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_CULTURAL_CENTERS"/>
    <Set BuildingClassType="BUILDINGCLASS_MONUMENT" ProductionModifier="0"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_CULTURAL_CENTERS"/>
    <Set BuildingClassType="BUILDINGCLASS_AMPHITHEATER" ProductionModifier="0"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_CULTURAL_CENTERS"/>
    <Set BuildingClassType="BUILDINGCLASS_OPERA_HOUSE" ProductionModifier="0"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_CULTURAL_CENTERS"/>
    <Set BuildingClassType="BUILDINGCLASS_MUSEUM" ProductionModifier="0"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_CULTURAL_CENTERS"/>
    <Set BuildingClassType="BUILDINGCLASS_BROADCAST_TOWER" ProductionModifier="0"/>
    </Update>
    </Policy_BuildingClassProductionModifiers>
    <Policy_BuildingClassHappiness>
    <Update>
    <Where PolicyType="POLICY_PROFESSIONAL_ARMY"/>
    <Set BuildingClassType="BUILDINGCLASS_CONSTABLE" Happiness="1"/>
    </Update>
    <Update>
    <Where PolicyType="POLICY_PROFESSIONAL_ARMY"/>
    <Set BuildingClassType="BUILDINGCLASS_POLICE_STATION" Happiness="1"/>
    </Update>
    </Policy_BuildingClassHappiness>
    </GameData>


    The mod has other files, but doesn't throw any visible errors and most of it works. The only problem is that the changes from my Update files don't take effect. In particular, the CultureFromKills (easiest to test). I checked the database log and found nothing related to this.

    From this I can only surmise that I have done something wrong in my syntax that causes the file to just not load, but for the life of me I can't figure out what. I've had the BuildingClassType in the WHERE line, but that didn't work either, though I guess I may have had other errors at the time that may have broken it. I dunno. Could use some fresh eyes.
     
  2. PawelS

    PawelS Ancient Druid

    Joined:
    Dec 11, 2003
    Messages:
    2,803
    Location:
    Poland
    1. There is no PolicyType column in Policies table, it's just Type. So you need to change PolicyType to Type in all places where you update the Policies table.

    2. The way you're making changes to Policy_BuildingClassProductionModifiers and Policy_BuildingClassHappiness tables is not right. Things you're trying to change don't exist, so you need to add new rows instead of updating existing ones. So instead of

    Code:
    <Update>
    <Where PolicyType="POLICY_HONOR"/>
    <Set BuildingClassType="BUILDINGCLASS_BARRACKS" ProductionModifier="50"/>
    </Update>
    
    It should be:
    Code:
    <Row>
    <PolicyType>POLICY_HONOR</PolicyType>
    <BuildingClassType>BUILDINGCLASS_BARRACKS</BuildingClassType>
    <ProductionModifier>50</ProductionModifier>
    </Row>
    
     
  3. loppnessmonsta

    loppnessmonsta Chieftain

    Joined:
    Nov 27, 2013
    Messages:
    19
    Ah, I see. Also, I had it as Type before but was looking through the files and saw it use PolicyType in a few spots, so thought that might be it. Obviously not.

    Thanks!
     
  4. loppnessmonsta

    loppnessmonsta Chieftain

    Joined:
    Nov 27, 2013
    Messages:
    19
    Secondary question: is there a way to give each opener a bonus that only activates in combination with another opener? like faithfromkills if you adopt honor and piety, etc.
     
  5. JFD

    JFD Kathigitarkh

    Joined:
    Oct 19, 2010
    Messages:
    9,122
    Location:
    The Kingdom of New Zealand
    You can do that through lua. Something like this would work:

    Code:
    function BranchCombinations(playerID, policyBranchTypeID)
    	local iPlayer = Players[playerID]
    	if policyBranchTypeID == GameInfoTypes["POLICY_BRANCH_TRADITION"] then
    		if iPlayer:HasPolicy(GameInfoTypes["POLICY_LIBERTY_OPENER"]) then
    			--Do stuff for Tradition + Liberty
    		elseif iPlayer:HasPolicy(GameInfoTypes["POLICY_PIETY_OPENER"]) then
    			--Do stuff for Tradition + Piety
    		--etc.
    		end
    	elseif policyBranchTypeID == GameInfoTypes["POLICY_BRANCH_LIBERTY"] then
    		if iPlayer:HasPolicy(GameInfoTypes["POLICY_PIETY_OPENER"]) then
    			--Do stuff for Liberty + Piety
    		--etc.
    		end
    	--etc.
    	end
    end
    GameEvents.PlayerAdoptPolicyBranch.Add(BranchCombinations)
    I'm not sure about achieving the FaithfromKills effect you want, but there are plenty of things you could come up with that would work.
     
  6. loppnessmonsta

    loppnessmonsta Chieftain

    Joined:
    Nov 27, 2013
    Messages:
    19
    Hmm. I don't know much about LUA so I think that's beyond me. I thought of something else I could do, though, but I'm not sure it will work. There's no FaithFromKills column in the Policy table, that I can see. Is there a way to add it to the table?
     
  7. loppnessmonsta

    loppnessmonsta Chieftain

    Joined:
    Nov 27, 2013
    Messages:
    19
    Also, is there a way to give city-states the StarAlongOcean bias? I tried this:

    but I get
    as an error so i guess it comes back to learning how to add stuff to tables, if possible.
     
  8. snarko

    snarko DLLer

    Joined:
    Dec 9, 2003
    Messages:
    1,512
    Location:
    Sweden
    You can't just add columns to tables and hope they work. If you add columns you have to write the code which DOES something with the column as well (which means lua or c++ code).


    As for the error, it's caused by incorrect XML.
    <Table name="MinorCiv_Start_Along_Ocean">
    Here you are making a new table.

    <MinorCivTraits>
    ...
    <MinorStartAlongOcean>True</MinorStartAlongOcean>
    Here you are setting MinorStartAlongOcean for a different table than the one you just added. The MinorCivTraits table does not have a column called that. The MinorCiv_Start_Along_Ocean table does.
     

Share This Page