Anything wrong with this bit of code?

Ankorafeonix

Chieftain
Joined
Aug 15, 2013
Messages
75
This mod was working fine up until I added a few extra things, now two of the XML files don't appear at all in my mod. Everything else works, but all changes in Policies.xml and Resources.xml don't appear in-game. Resources.xml used to work, but after the update which included adding Policies.xml, it doesn't anymore.

I've tried extracting the two files alone and loading them through a separate mod - I've tried loading without any other mods - no success, so it must be a problem within the code itself.

Could anyone have a quick look and see if something jumps out at them? I've troubleshot this issue for days and can't work it out though.

Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 3/9/2015 5:06:58 PM -->
<GameData>

	<!-- Mercantilism -->
	<Policy_BuildingClassYieldChanges>
		<Update>
			<Where PolicyType="POLICY_MERCANTILISM"/>
			<Set YieldChange="0"/>
		</Update>
	</Policy_BuildingClassYieldChanges>

	<!-- Secularism -->
	<Policy_SpecialistExtraYields>
		<Update>
			<Where PolicyType="POLICY_SECULARISM"/>
			<Set Yield="0"/>
		</Update>
	</Policy_SpecialistExtraYields>
	<Policy_CapitalYieldPerPopChanges>
		<Row>
			<PolicyType>POLICY_SECULARISM</PolicyType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>20</Yield>
		</Row>
	</Policy_CapitalYieldPerPopChanges>

	<!-- Humanism -->
	<Policy_FreeUnitClasses>
		<Row>
			<PolicyType>POLICY_HUMANISM</PolicyType>
			<UnitClassType>UNITCLASS_SCIENTIST</UnitClassType>
			<Count>1</Count>
		</Row>
	</Policy_FreeUnitClasses>

	<!-- Free Thought -->
	<Policy_ImprovementYieldChanges>
		<Update>
			<Where PolicyType="POLICY_FREE_THOUGHT"/>
			<Set Yield="0"/>
		</Update>
	</Policy_ImprovementYieldChanges>
	<Policy_BuildingClassYieldModifiers>
		<Update>
			<Where PolicyType="POLICY_FREE_THOUGHT"/>
			<Set YieldMod="0"/>
		</Update>
	</Policy_BuildingClassYieldModifiers>
	<Policy_TourismOnUnitCreation>
		<Row>
			<PolicyType>POLICY_FREE_THOUGHT</PolicyType>
			<UnitClassType>UNITCLASS_WRITER</UnitClassType>
			<Tourism>100</Tourism>
		</Row>
		<Row>
			<PolicyType>POLICY_FREE_THOUGHT</PolicyType>
			<UnitClassType>UNITCLASS_ARTIST</UnitClassType>
			<Tourism>100</Tourism>
		</Row>
		<Row>
			<PolicyType>POLICY_FREE_THOUGHT</PolicyType>
			<UnitClassType>UNITCLASS_MUSICIAN</UnitClassType>
			<Tourism>100</Tourism>
		</Row>
	</Policy_TourismOnUnitCreation>

	<!-- Sovereignty -->
	<Policy_BuildingClassProductionModifiers>
		<Row>
			<PolicyType>POLICY_SOVEREIGNTY</PolicyType>
			<BuildingClassType>BUILDINGCLASS_HOSPITAL</BuildingClassType>
			<ProductionModifier>50</ProductionModifier>
		</Row>
		<Row>
			<PolicyType>POLICY_SOVEREIGNTY</PolicyType>
			<BuildingClassType>BUILDINGCLASS_PORCELAIN_TOWER</BuildingClassType>
			<ProductionModifier>25</ProductionModifier>
		</Row>
		<Row>
			<PolicyType>POLICY_SOVEREIGNTY</PolicyType>
			<BuildingClassType>BUILDINGCLASS_HUBBLE</BuildingClassType>
			<ProductionModifier>25</ProductionModifier>
		</Row>
	</Policy_BuildingClassProductionModifiers>

	<!-- Party Leadership -->
	<Policy_CityYieldChanges>
		<Update>
			<Where YieldType="YIELD_SCIENCE"/>
			<Set Yield="0"/>
		</Update>
	</Policy_CityYieldChanges>

	<!-- Worker's Faculties -->
	<Policy_BuildingClassYieldModifiers>
		<Update>
			<Update>
				<Where PolicyType="POLICY_WORKERS_FACULTIES"/>
				<Set YieldType="YIELD_PRODUCTION"/>
			</Update>
		</Update>
	</Policy_BuildingClassYieldModifiers>

	<!-- Third Alternative -->
	<Policy_CapitalYieldChanges>
		<Update>
			<Update>
				<Where PolicyType="POLICY_THIRD_ALTERNATIVE"/>
				<Set YieldType="YIELD_GOLD"/>
			</Update>
		</Update>
	</Policy_CapitalYieldChanges>
	<Policies>
		<Update>
			<Set StrategicResourceMod="150"/>
			<Where Type="POLICY_THIRD_ALTERNATIVE"/>
		</Update>
	</Policies>

	<Policy_FreeUnitClasses>
		<Update>
			<Set UnitClassType="UNITCLASS_FOREIGNLEGION"/>
			<Where PolicyType="POLICY_CITIZENSHIP"/>
		</Update>
	</Policy_FreeUnitClasses>
	
	
	<Language_en_US>
		<!-- Mercantilism -->
		<Update>
			<Where Tag="TXT_KEY_POLICY_MERCANTILISM"/>
			<Set Text="Purchasing items in Cities requires 25% less [ICON_GOLD] Gold. [ICON_RES_PERSONELL]"/>
		</Update>

		<!-- Secularism -->
		<Update>
			<Where Tag="POLICY_SECULARISM"/>
			<Set Text="+1 [ICON_RESEARCH] Science per 5 citizens in your capital."/>
		</Update>
		
		<!-- Humanism -->
		<Update>
			<Where Tag="POLICY_HUMANISM"/>
			<Set Text="A free Great Scientist appears in your capital."/>
		</Update>
		
		<!-- Free Thought -->
		<Update>
			<Where Tag="POLICY_FREE_THOUGHT"/>
			<Set Text="Every time you earn a Great Writer, Artist, or Musician, your tourism output inceases by 100."/>
		</Update>

		<!-- Sovereignty -->
		<Update>
			<Where Tag="POLICY_SOVEREIGNTY"/>
			<Set Text="Build Hospitals 50% faster. Also build the Porcelain Tower and Hubble Telescope wonders 25% faster."/>
		</Update>

		<!-- Party Leadership -->
		<Update>
			<Where Tag="POLICY_PARTY_LEADERSHIP"/>
			<Set Text="+1 [ICON_CULTURE] Culture, [ICON_FOOD] Food, [ICON_GOLD] Gold, and [ICON_PRODUCTION] Production per city."/>
		</Update>

		<!-- Worker's Faculties -->
		<Update>
			<Where Tag="POLICY_WORKERS_FACULTIES"/>
			<Set Text="+25% [ICON_PRODUCTION] Production output from Cities with a Factory. Build Factories in half the usual time."/>
		</Update>

		<!-- Third Alternative -->
		<Update>
			<Where Tag="POLICY_THIRD_ALTERNATIVE"/>
			<Set Text="Strategic Resources provide double quantity. +5 [ICON_FOOD] Food and [ICON_GOLD] Gold in Capital."/>
		</Update>
	</Language_en_US>

</GameData>
 
One mistake will cause the entire XML file to be rejected, you have doubled up <Update> tags in the "Worker's Faculties" and "Third Alternative" sections. There may be other mistakes - logging is your friend (see the first link in my sig), it's also easier to debug complete mods rather than snippets (see second link for how to attach the complete mod) as your error may be in the mod info file, eg missing OnModActivated->UpdateDatabase entry (see third link in my sig)

HTH

W
 
Thanks whoward - simple mistake, but fixed everything! Will double-check for those double-ups in the future. Cheers!
 
Top Bottom