Unhandled Exception caused by policy adoption

Starrynite120

Prince
Joined
Jul 15, 2015
Messages
472
I have an unhandled exception being caused reliably by adoptiong policy 9 or 10 from any of the trees (not the ninth or tenth policy, but the policies with the ID numbers 9 and 10). I am reproducing this crash repeatedly, and am not sure what I can do about it. Any suggestions? I did redo the whole virtue tree and have an lua script running for that is related to policies, but some of the policies that are causing the crash do not have anything triggered in the lua.

I'm at a loss, and don't want to just dump the mod, so if anyone could help me that would be greatly appreciated.
 
When you "redid the whole virtue tree" were you deleting or inserting into the Virtues table? If there are "gaps" in the IDs of the table (ie: 0, 1, 3, 4...) it can cause problems.
 
Hmm. I redid the position of each virtue and the connections between them, and I changed the effects of all of them. I can take a look at it. It could make sense I messed something up on 9 and 10 cause I copy and pasted.

This is what I've got for the knowledge tree. The others are similar.

Code:
	<Policy_CityYieldChanges>
		<Row>
			<PolicyType>POLICY_KNOWLEDGE_6</PolicyType>
			<YieldType>YIELD_CULTURE</YieldType>
			<Yield>1</Yield>
		</Row>
	</Policy_CityYieldChanges>

	<PlayerPerks_BuildingYieldEffects>
		<Row>
			<PlayerPerkType>PLAYERPERK_KNOWLEDGE_14</PlayerPerkType>
			<BuildingClassType>BUILDINGCLASS_LIBRARY_SERVER</BuildingClassType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<FlatYield>5</FlatYield>
		</Row>
	</PlayerPerks_BuildingYieldEffects>

	<Policy_SpecialistExtraYields>
		<Row>
			<PolicyType>POLICY_KNOWLEDGE_15</PolicyType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>2</Yield>
		</Row>
	</Policy_SpecialistExtraYields>

	<Policy_FreeUnitClasses>
		<Row>
			<PolicyType>POLICY_KNOWLEDGE_3</PolicyType>
			<UnitClassType>UNITCLASS_LASERCOM_SATELLITE</UnitClassType>
			<Count>1</Count>
		</Row>
	</Policy_FreeUnitClasses>

	<PlayerPerks_OrbitedCityYieldEffects>
		<Row>
			<PlayerPerkType>PLAYERPERK_KNOWLEDGE_9</PlayerPerkType>
			<YieldType>YIELD_ENERGY</YieldType>
			<PercentYield>10</PercentYield>
		</Row>
		<Row>
			<PlayerPerkType>PLAYERPERK_KNOWLEDGE_9</PlayerPerkType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<PercentYield>15</PercentYield>
		</Row>
	</PlayerPerks_OrbitedCityYieldEffects>

	<Policy_CapitalYieldModifiers>
		<Row>
			<PolicyType>POLICY_KNOWLEDGE_5</PolicyType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>10</Yield>
		</Row>
	</Policy_CapitalYieldModifiers>

	<Policies>
		<Update>
			<Where Type="POLICY_KNOWLEDGE_1" />
			<Set ExplorerExpeditionCharges="2"
				 HealthToScience="0"
				 GridY="0" GridX="3"
				 Description="TXT_KEY_STARRYNITE_POLICY_KNOWLEDGE_1"
				 PolicyDepthType="POLICY_DEPTH_MODERATE" />
		</Update>
		<Update>
			<Where Type="POLICY_KNOWLEDGE_2" />
			<Set ResearchFromExpeditions="35"
				 GridY="1" GridX="1"
				 Description="TXT_KEY_STARRYNITE_POLICY_KNOWLEDGE_2"
				 PolicyDepthType="POLICY_DEPTH_MODERATE" />
		</Update>
		<Update>
			<Where Type="POLICY_KNOWLEDGE_3" />
			<Set GridY="2" GridX="1"
				 Description="TXT_KEY_STARRYNITE_POLICY_KNOWLEDGE_3"
				 PolicyDepthType="POLICY_DEPTH_MODERATE" />
		</Update>
		<Update>
			<Where Type="POLICY_KNOWLEDGE_4" />
			<Set GridY="1" GridX="5"
				 Description="TXT_KEY_STARRYNITE_POLICY_KNOWLEDGE_4"
				 PolicyDepthType="POLICY_DEPTH_MODERATE" />
		</Update>
		<Update>
			<Where Type="POLICY_KNOWLEDGE_5" />
			<Set HealthToCulture="0"
				 GridY="2" GridX="5"
				 Description="TXT_KEY_STARRYNITE_POLICY_KNOWLEDGE_5"
				 PolicyDepthType="POLICY_DEPTH_MODERATE"/>
		</Update>
		<Update>
			<Where Type="POLICY_KNOWLEDGE_6" />
			<Set NumCitiesPolicyCostDiscount="50"
				 PolicyCostModifier="0"
				 GridY="0" GridX="1"
				 Description="TXT_KEY_STARRYNITE_POLICY_KNOWLEDGE_6"
				 PolicyDepthType="POLICY_DEPTH_DEVOTED" />
		</Update>
		<Update>
			<Where Type="POLICY_KNOWLEDGE_7" />
			<Set HealthToCulture="100"
				 CovertOpsCounterIntelModifier="0"
				 GridY="0" GridX="5"
				 Description="TXT_KEY_STARRYNITE_POLICY_KNOWLEDGE_7"
				 PolicyDepthType="POLICY_DEPTH_DEVOTED" />
		</Update>
		<Update>
			<Where Type="POLICY_KNOWLEDGE_8" />
			<Set CulturePerTechResearched="50"
				 HealthPerXPopulation="0"
				 GridY="1" GridX="3"
				 Description="TXT_KEY_STARRYNITE_POLICY_KNOWLEDGE_8"
				 PolicyDepthType="POLICY_DEPTH_DEVOTED"/>
		</Update>
		<Update>
			<Where Type="POLICY_KNOWLEDGE_9" />
			<Set NumCitiesResearchCostDiscount="0"
				 GridY="2" GridX="1"
				 Description="TXT_KEY_STARRYNITE_POLICY_KNOWLEDGE_9"
				 PolicyDepthType="POLICY_DEPTH_DEVOTED"/>
		</Update>
		<Update>
			<Where Type="POLICY_KNOWLEDGE_10" />
			<Set HealthToScience="10"
				 NumCitiesPolicyCostDiscount="0"
				 GridY="2" GridX="5"
				 Description="TXT_KEY_STARRYNITE_POLICY_KNOWLEDGE_10"
				 PolicyDepthType="POLICY_DEPTH_DEVOTED" />
		</Update>
		<Update>
			<Where Type="POLICY_KNOWLEDGE_11" />
			<Set NumCitiesResearchCostDiscount="50"
				 GridY="0" GridX="1"
				 Description="TXT_KEY_STARRYNITE_POLICY_KNOWLEDGE_11"
				 PolicyDepthType="POLICY_DEPTH_EXTREME" />
		</Update>
		<Update>
			<Where Type="POLICY_KNOWLEDGE_12" />
			<Set LeafTechResearchModifier="0"
				 NumFreeTechs="1"
				 GridY="0" GridX="5"
				 Description="TXT_KEY_STARRYNITE_POLICY_KNOWLEDGE_12"
				 PolicyDepthType="POLICY_DEPTH_EXTREME"/>
		</Update>
		<Update>
			<Where Type="POLICY_KNOWLEDGE_13" />
			<Set PercentCultureRateToResearch="15"
				 NumFreeCovertAgents="0"
				 GridY="1" GridX="3"
				 Description="TXT_KEY_STARRYNITE_POLICY_KNOWLEDGE_13"
				 PolicyDepthType="POLICY_DEPTH_EXTREME"/>
		</Update>
		<Update>
			<Where Type="POLICY_KNOWLEDGE_14" />
			<Set PercentCultureRateToResearch="0"
				 GridY="2" GridX="1"
				 Description="TXT_KEY_STARRYNITE_POLICY_KNOWLEDGE_14"
				 PolicyDepthType="POLICY_DEPTH_EXTREME" />
		</Update>
		<Update>
			<Where Type="POLICY_KNOWLEDGE_15" />
			<Set CulturePerWonder="0"
				 GridY="2" GridX="5"
				 Description="TXT_KEY_STARRYNITE_POLICY_KNOWLEDGE_15"
				 PolicyDepthType="POLICY_DEPTH_EXTREME"/>
		</Update>
		<Update>
			<Where Type="POLICY_KNOWLEDGE_KICKER_1"/>
			<Set ExtraHealth="7"/>
		</Update>
		<Update>
			<Where Type="POLICY_KNOWLEDGE_KICKER_2"/>
			<Set ResearchModPerExtraConnectedTech="15"/>
		</Update>
		<Update>
			<Where Type="POLICY_KNOWLEDGE_KICKER_3"/>
			<Set NumFreeTechs="0"
				 UnhealthMod="10"/>
		</Update>
	</Policies>
	<Policy_PrereqORPolicies>
		<Row>
			<PrereqPolicy>POLICY_KNOWLEDGE_1</PrereqPolicy>
			<PolicyType>POLICY_KNOWLEDGE_2</PolicyType>
		</Row>
		<Row>
			<PrereqPolicy>POLICY_KNOWLEDGE_1</PrereqPolicy>
			<PolicyType>POLICY_KNOWLEDGE_4</PolicyType>
		</Row>
		<Row>
			<PrereqPolicy>POLICY_KNOWLEDGE_2</PrereqPolicy>
			<PolicyType>POLICY_KNOWLEDGE_3</PolicyType>
		</Row>
		<Row>
			<PrereqPolicy>POLICY_KNOWLEDGE_4</PrereqPolicy>
			<PolicyType>POLICY_KNOWLEDGE_5</PolicyType>
		</Row>
		<Row>
			<PrereqPolicy>POLICY_KNOWLEDGE_3</PrereqPolicy>
			<PolicyType>POLICY_KNOWLEDGE_6</PolicyType>
		</Row>
		<Row>
			<PrereqPolicy>POLICY_KNOWLEDGE_5</PrereqPolicy>
			<PolicyType>POLICY_KNOWLEDGE_7</PolicyType>
		</Row>
		<Row>
			<PrereqPolicy>POLICY_KNOWLEDGE_6</PrereqPolicy>
			<PolicyType>POLICY_KNOWLEDGE_8</PolicyType>
		</Row>
		<Row>
			<PrereqPolicy>POLICY_KNOWLEDGE_7</PrereqPolicy>
			<PolicyType>POLICY_KNOWLEDGE_8</PolicyType>
		</Row>
		<Row>
			<PrereqPolicy>POLICY_KNOWLEDGE_8</PrereqPolicy>
			<PolicyType>POLICY_KNOWLEDGE_10</PolicyType>
		</Row>
		<Row>
			<PrereqPolicy>POLICY_KNOWLEDGE_8</PrereqPolicy>
			<PolicyType>POLICY_KNOWLEDGE_9</PolicyType>
		</Row>
		<Row>
			<PrereqPolicy>POLICY_KNOWLEDGE_9</PrereqPolicy>
			<PolicyType>POLICY_KNOWLEDGE_11</PolicyType>
		</Row>
		<Row>
			<PrereqPolicy>POLICY_KNOWLEDGE_10</PrereqPolicy>
			<PolicyType>POLICY_KNOWLEDGE_12</PolicyType>
		</Row>
		<Row>
			<PrereqPolicy>POLICY_KNOWLEDGE_11</PrereqPolicy>
			<PolicyType>POLICY_KNOWLEDGE_13</PolicyType>
		</Row>
		<Row>
			<PrereqPolicy>POLICY_KNOWLEDGE_12</PrereqPolicy>
			<PolicyType>POLICY_KNOWLEDGE_13</PolicyType>
		</Row>
		<Row>
			<PrereqPolicy>POLICY_KNOWLEDGE_11</PrereqPolicy>
			<PolicyType>POLICY_KNOWLEDGE_14</PolicyType>
		</Row>
		<Row>
			<PrereqPolicy>POLICY_KNOWLEDGE_12</PrereqPolicy>
			<PolicyType>POLICY_KNOWLEDGE_15</PolicyType>
		</Row>
	</Policy_PrereqORPolicies>

	<!--Affinity Gain-->
	<PlayerPerks>
		<Row>
			<Type>PLAYERPERK_KNOWLEDGE_4</Type>
			<Help>Earn 20 [ICON_CULTURE] Culture from finishing Expeditions.[NEWLINE][ICON_BULLET]Gain 3 [ICON_HARMONY] Harmony.</Help>
		</Row>
		<Row>
			<Type>PLAYERPERK_KNOWLEDGE_5</Type>
			<Help>Gain 15 [ICON_RESEARCH] Science for each population in your [ICON_CAPITAL] Capital. Bonus doubles at 10 [ICON_CITIZEN] Population and triples at 20 [ICON_CITIZEN] Population.[NEWLINE][ICON_BULLET]Gain 5 [ICON_HARMONY] Harmony.</Help>
		</Row>
		<Row>
			<Type>PLAYERPERK_KNOWLEDGE_7</Type>
			<Help>Gain 7 [ICON_HARMONY] Harmony.</Help>
		</Row>
		<Row>
			<Type>PLAYERPERK_KNOWLEDGE_10</Type>
			<Help>Gain 10 [ICON_HARMONY] Harmony.</Help>
		</Row>
		<Row>
			<Type>PLAYERPERK_KNOWLEDGE_12</Type>
			<Help>Gain 12 [ICON_HARMONY] Harmony.</Help>
		</Row>
		<Row>
			<Type>PLAYERPERK_KNOWLEDGE_15</Type>
			<Help>[ICON_BULLET]Gain 15 [ICON_HARMONY] Harmony.</Help>
		</Row>
		<Row>
			<Type>PLAYERPERK_KNOWLEDGE_2</Type>
			<Help>Gain 3 [ICON_SUPREMACY] Supremacy.</Help>
		</Row>
		<Row>
			<Type>PLAYERPERK_KNOWLEDGE_3</Type>
			<Help>Gain 5 [ICON_SUPREMACY] Supremacy.</Help>
		</Row>
		<Row>
			<Type>PLAYERPERK_KNOWLEDGE_6</Type>
			<Help>Gain 7 [ICON_SUPREMACY] Supremacy.</Help>
		</Row>
		<Row>
			<Type>PLAYERPERK_KNOWLEDGE_9</Type>
			<Help>+15% [ICON_RESEARCH] Science and +10% [ICON_ENERGY] Energy for Cities in [ICON_ORBITAL_RANGE] Effect Range of a friendly Orbital Unit.[NEWLINE][ICON_BULLET]Gain 10 [ICON_SUPREMACY] Supremacy.</Help>
		</Row>
		<Row>
			<Type>PLAYERPERK_KNOWLEDGE_11</Type>
			<Help>Gain 50 [ICON_RESEARCH] Science per city.[NEWLINE][ICON_BULLET]Gain 12 [ICON_SUPREMACY] Supremacy.</Help>
		</Row>
		<Row>
			<Type>PLAYERPERK_KNOWLEDGE_14</Type>
			<Help>[ICON_BULLET]Gain 15 [ICON_SUPREMACY] Supremacy.</Help>
		</Row>
		<Row>
			<Type>PLAYERPERK_KNOWLEDGE_8</Type>
			<Help>Gain 50 [ICON_CULTURE] Culture when you research a new Technology.</Help>
		</Row>
	</PlayerPerks>

	<Policy_PGP_FreePerk>
		<Row>
			<PolicyType>POLICY_KNOWLEDGE_4</PolicyType>
			<FreePlayerPerk>PLAYERPERK_KNOWLEDGE_4</FreePlayerPerk>
		</Row>
		<Row>
			<PolicyType>POLICY_KNOWLEDGE_5</PolicyType>
			<FreePlayerPerk>PLAYERPERK_KNOWLEDGE_5</FreePlayerPerk>
		</Row>
		<Row>
			<PolicyType>POLICY_KNOWLEDGE_7</PolicyType>
			<FreePlayerPerk>PLAYERPERK_KNOWLEDGE_7</FreePlayerPerk>
		</Row>
		<Row>
			<PolicyType>POLICY_KNOWLEDGE_10</PolicyType>
			<FreePlayerPerk>PLAYERPERK_KNOWLEDGE_10</FreePlayerPerk>
		</Row>
		<Row>
			<PolicyType>POLICY_KNOWLEDGE_12</PolicyType>
			<FreePlayerPerk>PLAYERPERK_KNOWLEDGE_12</FreePlayerPerk>
		</Row>
		<Row>
			<PolicyType>POLICY_KNOWLEDGE_15</PolicyType>
			<FreePlayerPerk>PLAYERPERK_KNOWLEDGE_15</FreePlayerPerk>
		</Row>
		<Row>
			<PolicyType>POLICY_KNOWLEDGE_2</PolicyType>
			<FreePlayerPerk>PLAYERPERK_KNOWLEDGE_2</FreePlayerPerk>
		</Row>
		<Row>
			<PolicyType>POLICY_KNOWLEDGE_3</PolicyType>
			<FreePlayerPerk>PLAYERPERK_KNOWLEDGE_3</FreePlayerPerk>
		</Row>
		<Row>
			<PolicyType>POLICY_KNOWLEDGE_6</PolicyType>
			<FreePlayerPerk>PLAYERPERK_KNOWLEDGE_6</FreePlayerPerk>
		</Row>
		<Row>
			<PolicyType>POLICY_KNOWLEDGE_9</PolicyType>
			<FreePlayerPerk>PLAYERPERK_KNOWLEDGE_9</FreePlayerPerk>
		</Row>
		<Row>
			<PolicyType>POLICY_KNOWLEDGE_11</PolicyType>
			<FreePlayerPerk>PLAYERPERK_KNOWLEDGE_11</FreePlayerPerk>
		</Row>
		<Row>
			<PolicyType>POLICY_KNOWLEDGE_14</PolicyType>
			<FreePlayerPerk>PLAYERPERK_KNOWLEDGE_14</FreePlayerPerk>
		</Row>
		<Row>
			<PolicyType>POLICY_KNOWLEDGE_8</PolicyType>
			<FreePlayerPerk>PLAYERPERK_KNOWLEDGE_8</FreePlayerPerk>
		</Row>
	</Policy_PGP_FreePerk>
 
Since you just did update statements on the Policies table your indexes should be fine. So that is not likely to be the cause.

But for clarification -- the policies with indexes (aka IDs) of 9 and 10 are MIGHT_10 and MIGHT_11, not Knowledge. Is it the Knowledge or the Might Virtues that are causing problems?

A good area to look at next would be the lua code you have running on policy adoption. Something about those specific policies may be causing a corner case that leads to the crash. Are there any errors in your lua log?
 
POLICY_KNOWLEDGE_9 and POLICY_KNOWLEDGE_10, as well as 9 and 10 of industry and prosperity cause the crash.

Firetuner showed some errors on a script, but I removed that script and the crash still happened and firetuner did not show any errors once it was removed.
 
I identified the source of the problem, this was a sneaky one. The issue was with gaining affinity levels. Policies currently grant affinity, and policies 9 and 10 of each tree would result in the player gaining an affinity level which resulted in a crash. I'll have to see what exactly about affinity is causing it, but I should be able to fix it now that I know what the problem is.
 
So it turns out what I'm having difficulty with is deleting the original affinity level perks. When I do something like this

Code:
DELETE FROM Affinity_Perks;

None of the perks display on the affinity wheel and there's a weird graphical error. When I do something like this

Code:
	<Affinity_Perks>
		<Delete>
			<ID>0</ID>
	                <PlayerPerk>PLAYERPERK_AFFINITY_TRADER_MIASMA_IMMUNITY</PlayerPerk>
			<HarmonyLevelNeeded>2</HarmonyLevelNeeded>
		</Delete>
	</Affinity_Perks>

I get an unhandled exception error and the game crashes. How do I go about getting rid of affinity perks if these aren't working? Rather, why would I be getting these problems? Cause I took both of those examples from mods where they are functioning properly, they just didn't work when I tried to use them.

I should also probably mention that I am just trying to remove some perks without replacing them. I guess that could be part of the problem, but I'm not sure.
 
The Affinity_Perks table needs to have sequential IDs or it will cause problems. If you delete any row from that table you'll need to manually reset the IDs to avoid gaps.
 
So I'm still a bit stumped. I get what you're saying with the ID, but I can't seem to get it working. I gave the delete command in an SQL file, and then I put this in an XML file which loads after the delete command.

Code:
	<Affinity_Perks>
		<Row>
			<ID>0</ID>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_PURITY_1</PlayerPerk>
			<PurityLevelNeeded>1</PurityLevelNeeded>
		</Row>
		<Row>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_PURITY_4</PlayerPerk>
			<PurityLevelNeeded>4</PurityLevelNeeded>
		</Row>
		<Row>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_PURITY_7</PlayerPerk>
			<PurityLevelNeeded>7</PurityLevelNeeded>
		</Row>
		<Row>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_PURITY_10</PlayerPerk>
			<PurityLevelNeeded>10</PurityLevelNeeded>
		</Row>
		<Row>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_PURITY_12</PlayerPerk>
			<PurityLevelNeeded>12</PurityLevelNeeded>
		</Row>
		<Row>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_PURITY_15</PlayerPerk>
			<PurityLevelNeeded>15</PurityLevelNeeded>
		</Row>
		<Row>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_SUPREMACY_1</PlayerPerk>
			<SupremacyLevelNeeded>1</SupremacyLevelNeeded>
		</Row>
		<Row>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_SUPREMACY_4</PlayerPerk>
			<SupremacyLevelNeeded>4</SupremacyLevelNeeded>
		</Row>
		<Row>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_SUPREMACY_7</PlayerPerk>
			<SupremacyLevelNeeded>7</SupremacyLevelNeeded>
		</Row>
		<Row>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_SUPREMACY_10</PlayerPerk>
			<SupremacyLevelNeeded>10</SupremacyLevelNeeded>
		</Row>
		<Row>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_SUPREMACY_12</PlayerPerk>
			<SupremacyLevelNeeded>12</SupremacyLevelNeeded>
		</Row>
		<Row>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_SUPREMACY_15</PlayerPerk>
			<SupremacyLevelNeeded>15</SupremacyLevelNeeded>
		</Row>
		<Row>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_HARMONY_1</PlayerPerk>
			<HarmonyLevelNeeded>1</HarmonyLevelNeeded>
		</Row>
		<Row>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_HARMONY_4</PlayerPerk>
			<HarmonyLevelNeeded>4</HarmonyLevelNeeded>
		</Row>
		<Row>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_HARMONY_7</PlayerPerk>
			<HarmonyLevelNeeded>7</HarmonyLevelNeeded>
		</Row>
		<Row>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_HARMONY_10</PlayerPerk>
			<HarmonyLevelNeeded>10</HarmonyLevelNeeded>
		</Row>
		<Row>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_HARMONY_12</PlayerPerk>
			<HarmonyLevelNeeded>12</HarmonyLevelNeeded>
		</Row>
		<Row>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_HARMONY_15</PlayerPerk>
			<HarmonyLevelNeeded>15</HarmonyLevelNeeded>
		</Row>
	</Affinity_Perks>
 
Use Sqlite Manager (or Sqlite Spy) to check what the IDs are in the database. I don't think the IDs will auto increment from 0 as you expect.
 
Hmm. I took a look at the program and I'm not quite sure how to use it. May I ask how you got the affinity changes to work in Echoes of Earth?
 
Assuming that adding perks doesn't cause any problems, I'm thinking I could just reorganize where the existing perks are and then just change what they do, and then add in the extra perks that I want to be in.
 
In Echoes of Earth I deleted the Affinity Perks table and then hard-coded the IDs of the rows I inserted to be 0, 1, 2, 3...

With respect to Sqlite Manager, it is a Firefox plug in you can download for free. You're going to want to "Connect to database" then go to your:

C:\Users\<USER_NAME>\Documents\my games\Sid Meier's Civilization Beyond Earth\cache

And open the debug database. If you do that after starting a game with your mod you'll be able to see what the values in various tables are and verify that your mod's XML is loading as you expect. It is a huge help in debugging issues.
 
So I looked up the ID numbers the way you described and I found them, and I put them in like this after deleting everything else

Code:
		<Row>
			<ID>24</ID>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_HARMONY_1</PlayerPerk>
			<HarmonyLevelNeeded>1</HarmonyLevelNeeded>
		</Row>
		<Row>
			<ID>25</ID>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_HARMONY_10</PlayerPerk>
			<HarmonyLevelNeeded>10</HarmonyLevelNeeded>
		</Row>
		<Row>
			<ID>26</ID>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_HARMONY_12</PlayerPerk>
			<HarmonyLevelNeeded>12</HarmonyLevelNeeded>
		</Row>
		<Row>
			<ID>27</ID>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_HARMONY_15</PlayerPerk>
			<HarmonyLevelNeeded>15</HarmonyLevelNeeded>
		</Row>
		<Row>
			<ID>28</ID>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_HARMONY_4</PlayerPerk>
			<HarmonyLevelNeeded>4</HarmonyLevelNeeded>
		</Row>
		<Row>
			<ID>29</ID>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_HARMONY_7</PlayerPerk>
			<HarmonyLevelNeeded>7</HarmonyLevelNeeded>
		</Row>
		<Row>
			<ID>30</ID>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_PURITY_1</PlayerPerk>
			<PurityLevelNeeded>1</PurityLevelNeeded>
		</Row>
		<Row>
			<ID>31</ID>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_PURITY_10</PlayerPerk>
			<PurityLevelNeeded>10</PurityLevelNeeded>
		</Row>
		<Row>
			<ID>32</ID>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_PURITY_12</PlayerPerk>
			<PurityLevelNeeded>12</PurityLevelNeeded>
		</Row>
		<Row>
			<ID>33</ID>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_PURITY_15</PlayerPerk>
			<PurityLevelNeeded>15</PurityLevelNeeded>
		</Row>
		<Row>
			<ID>34</ID>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_PURITY_4</PlayerPerk>
			<PurityLevelNeeded>4</PurityLevelNeeded>
		</Row>
		<Row>
			<ID>35</ID>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_PURITY_7</PlayerPerk>
			<PurityLevelNeeded>7</PurityLevelNeeded>
		</Row>
		<Row>
			<ID>36</ID>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_SUPREMACY_1</PlayerPerk>
			<SupremacyLevelNeeded>1</SupremacyLevelNeeded>
		</Row>
		<Row>
			<ID>37</ID>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_SUPREMACY_10</PlayerPerk>
			<SupremacyLevelNeeded>10</SupremacyLevelNeeded>
		</Row>
		<Row>
			<ID>38</ID>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_SUPREMACY_12</PlayerPerk>
			<SupremacyLevelNeeded>12</SupremacyLevelNeeded>
		</Row>
		<Row>
			<ID>39</ID>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_SUPREMACY_15</PlayerPerk>
			<SupremacyLevelNeeded>15</SupremacyLevelNeeded>
		</Row>
		<Row>
			<ID>40</ID>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_SUPREMACY_4</PlayerPerk>
			<SupremacyLevelNeeded>4</SupremacyLevelNeeded>
		</Row>
		<Row>
			<ID>41</ID>
			<PlayerPerk>PLAYERPERK_STARRYNITE_AFFINITY_SUPREMACY_7</PlayerPerk>
			<SupremacyLevelNeeded>7</SupremacyLevelNeeded>
		</Row>

This didn't work though, it still had the same bug.
 
Since I'm having so much difficulty getting this to work, and am not quite as skilled with hard coding it as you did, so I'm thinking it could just be easier to edit the existing playerperks to do what I want, and add in any extras I need. There shouldn't be any problem with adding or editing perks as long as I don't delete right?
 
If you delete everything you have to start with 0, not with 24 (or any other number). Anything you delete is gone and leaves a gap.

But either way, don't add the ids manually, it will just cause problems. Instead, let SQL remap the IDs for you:
http://forums.civfanatics.com/showthread.php?t=395922

Code:
CREATE TABLE IDRemapper ( id INTEGER PRIMARY KEY AUTOINCREMENT, Type TEXT );
INSERT INTO IDRemapper (Type) SELECT Type FROM Policies;
UPDATE Policies SET ID =	( SELECT IDRemapper.id-1 FROM IDRemapper WHERE Policies.Type = IDRemapper.Type);
DROP TABLE IDRemapper;

Make sure that file loads AFTER the file where you made the changes to your virtues.
 
Ryika, I realized my problem from the original post was with affinity perks. Though the code you posted works when adapted to affinities, I confirmed it by looking at the debug database, but I am still getting the problem of a graphical error where none of the perks appear on the wheel. Not a clue why.
 
Back
Top Bottom