Is this text change XML correct? What should I be looking for in the xml.log file?

Galgus

Emperor
Joined
Aug 22, 2012
Messages
1,705
I've been trying to make a virtue mod, and in the process I used some xml I'm not familiar with.

The mod isn't working, and while it could be many things I think I may have entered text in the wrong way.

I didn't see anything that seemed relevant in the xml.log: is there anything in particular I should be looking for?

Code:
         <PlayerPerks>
		<Row>
			<Type>PLAYERPERK_NH_ENERGY_FROM_CULTURE</Type>
			<Help>TXT_KEY_NH_APPLIED_AESTHETICS_HELP</Help>
		</Row>
	</PlayerPerks>

	<Policy_PGP_FreePerk>
		<Row>
			<PolicyType>POLICY_KNOWLEDGE_7</PolicyType>
	           		       [SPOILER][/SPOILER]<FreePlayerPerk>PLAYERPERK_NH_ENERGY_FROM_CULTURE</FreePlayerPerk>
		</Row>
	</Policy_PGP_FreePerk>


	<Language_en_US>
		<Update>
			<Where Description="TXT_KEY_POLICY_KNOWLEDGE_7" />
			<Set Text="Earn extra [ICON_ENERGY] Energy equal to 50% of the [ICON_CULTURE] Culture you generate." />
		</Update>
	</Language_en_US>

	<Language_en_US>
		<Row Tag="TXT_KEY_POLICY_KNOWLEDGE_7">
			<Text>Applied Aesthetics</Text>
		</Row>
	</Language_en_US>
	

	<Language_en_US>
		<Update>
			<Where Description="TXT_KEY_NH_APPLIED_AESTHETICS_NOTIFICATION" />
			<Set Text="+{@1_num}[ICON_ENERGY] from Applied Aesthetics."/>

		</Update>
	</Language_en_US>

If that isn't the issue, are these valid xml entries, or should I be using a workaroud?

Code:
       <Policy_CapitalYieldChanges>
		<Row>
			<PolicyType>POLICY_MIGHT_4</PolicyType>
			<YieldType>YIELD_PRODUCTION</YieldType>
			<Yield>4</Yield>
		</Row>
	</Policy_CapitalYieldChanges>


        <Policies>
		<Update>
			<Where Type="POLICY_MIGHT_2" />
			<Set GoldFromBarbarianCamps="400"
				 ResearchFromBarbarianCamps="200" />
		</Update>
	</Policies>

        <Policies>
		<Update>
			<Where Type="POLICY_MIGHT_1" />
			<Set GoldFromBarbarianKills="1000" />
		</Update>
	</Policies>

I kind of assumed some of that carries over from Civ 5, but if I'm wrong it would explain the errors.
 
Database.txt is what you primarily want to be looking at, not xml.log.

In this case it's probably this part:

<Language_en_US>
<Row Tag="TXT_KEY_POLICY_KNOWLEDGE_7">
<Text>Applied Aesthetics</Text>
</Row>
</Language_en_US>

You're trying to create a TXT_KEY that already exists, so the document becomes invalid.
 
By Database.txt do you mean Database.log?
_______________________________________

Would this be the proper command to replace the title of the virtue?

I'm not sure how to change those - do I need to delete the title and re-add it?

Code:
<Language_en_US>
		<Update>
			<Where Text="TXT_KEY_POLICY_MIGHT_2" />
			<Set Text="Earn 200 [ICON_RESEARCH] Science and 400 [ICON_GOLD] from  destroying alien nests." />
		</Update>
	</Language_en_US>

_____________

Edit - Nevermind the last bit.
 
Yeah, I meant Database.log.

And yes, GoldFromBarbarianKills is gone, that's pretty much what that Error tells you. At the top of most xml-files you see the table-definitions with all valid entries for these tables (which doesn't automatically mean that they all work), if something isn't defined there, then you'll get en error.

That Update-Tag is also wrong though, the correct version is:
Code:
<Language_en_US>
	<Update>
		<Where [B]Tag[/B]="TXT_KEY_POLICY_MIGHT_2" />
		<Set Text="Earn 200 [ICON_RESEARCH] Science and 400 [ICON_GOLD] from  destroying alien nests." />
	</Update>
</Language_en_US>

You can see it in the original (randomly chosen TXT_KEY):
Code:
<Row [B]Tag[/B]="TXT_KEY_LEADER_INDIA_FIRSTGREETING_2">
	<[B]Text[/B]>The prophets have led you to us. Our prayers greet you, our friend.</Text>
</Row>

As a side note (that you should not care about before you've gotten your version to work properly): A better version would be to completely replace that TXT_KEY, because the way you're doing it means that anyone who doesn't use the english Version of the game will still see the old, unchanged bonus.

If you do it like this:
Code:
<GameData>
	<!-- Replace the Default TXT_KEY with a new one -->
	<Policies>
		<Update>
			<Where Type="POLICY_MIGHT_2"/>
			<Set Description="TXT_KEY_POLICY_NH_NEW_MIGHT_2"/>
		</Update>
	</Policies>

	<!-- Create the new TXT_KEY -->
	<Language_en_US>
		<Row Tag="TXT_KEY_POLICY_NH_NEW_MIGHT_2">
			<!-- I assume you meant ICON_ENERGY, not ICON_GOLD! -->
			<Text>Earn 200 [ICON_RESEARCH] Science and 400 [ICON_ENERGY] Energy from  destroying alien nests.</Text>
		</Row>
	</Language_en_US>
</GameData>

...then the game will automatically fall back to your new, English text if you didn't add localization for the Language that other Players are using.
 
Looking back I'm not sure gold from barbarian kills was ever a thing in Civ 5, so I'll try Gold from kills instead.
_________________________________________________________________

I'll use the delete and replace method for the text, then.

How does one change the actual name of the Virtue though, not its description?
 
The "Description"-Tag is the name of the virtue.

The descriptions below the title are automatically created (Some Effects don't have an Text assigned to them, easiest method to change that is just to create a dummy-playerperk with PGP and assign it to that virtue).
 
So I should unless the effect doesn't have text or I'm changing a title, like changing Applied Metasocialogy to Applied Aesthetics, I don't need to write the text?

Does that mean that this code would be replacing the virtue's name with a description, essentially?

Code:
<GameData>
	<!-- Replace the Default TXT_KEY with a new one -->
	<Policies>
		<Update>
			<Where Type="POLICY_MIGHT_2"/>
			<Set Description="TXT_KEY_POLICY_NH_NEW_MIGHT_2"/>
		</Update>
	</Policies>

	<!-- Create the new TXT_KEY -->
	<Language_en_US>
		<Row Tag="TXT_KEY_POLICY_NH_NEW_MIGHT_2">
			<!-- I assume you meant ICON_ENERGY, not ICON_GOLD! -->
			<Text>Earn 200 [ICON_RESEARCH] Science and 400 [ICON_ENERGY] Energy from  destroying alien nests.</Text>
		</Row>
	</Language_en_US>
</GameData>
 
Yes to both.
 
The current issue seems to be coding energy from Alien nests - apparently it isn't GoldfromBarbarianCamps or EnergyfromBarbarianCamps.

I've been looking for what code gives the player energy from nests, but I haven't found it in GlobalDefines.

Do you know off the top of your head where that would be?
 
Those are set by Difficulty in HandicapInfos.xml
You'd probably need to use lua for that.
 
I'll probably do something else for that, then.
__________________________________________

I'm getting an error in the Database logs that reads:

Database::XMLSerializer (Virtues Overhaul/Virtues Overhaul.xml): Duplicate <Set> elements are not allowed.

Does this mean that setting two different values for things with multiple policies as in the below example is causing problems, or something else?

Code:
<Policies>
		<Update>
			<Where Type="POLICY_PROSPERITY_5" />
			<Set OutpostGrowthModifier="50" />
		</Update>
	</Policies>



	<Policies>
		<Update>
			<Where Type="POLICY_PROSPERITY_3" />
			<Set OutpostGrowthModifier="0" />
		</Update>
	</Policies>
 
That shouldn't cause problems. Although you can make it a lot shorter by doing it like that:

Code:
<Policies>
	<Update>
		<Where Type="POLICY_PROSPERITY_5"/>
		<Set OutpostGrowthModifier="50"/>
	</Update>
	<Update>
		<Where Type="POLICY_PROSPERITY_3"/>
		<Set OutpostGrowthModifier="0"/>
	</Update>
</Policies>

The Error that you're getting means that you've probably done something like this somewhere else in the file:

Code:
	<Update>
		<Where Type="POLICY_PROSPERITY_3"/>
		<Set OutpostGrowthModifier="0"/>
		<Set AnotherOption="9001"/>
	</Update>

...which is wrong und would need to be done like this:

Code:
	<Update>
		<Where Type="POLICY_PROSPERITY_3"/>
		<Set OutpostGrowthModifier="0"
		     AnotherOption="9001"/>
	</Update>
 
Top Bottom