Another spot-the-coding-error thread

rezaf

Warlord
Joined
Dec 3, 2003
Messages
179
Well, I'm trying to get my feet wet doing some basic Civ5 modding.

I managed to change a few yields in various terrain related files, but somehow the game fails to acknowledge the following file:

Code:
<GameData>
	<Improvements>
		<Row>
			<Type>IMPROVEMENT_LANDMARK</Type>
			<Description>TXT_KEY_IMPROVEMENT_LANDMARK</Description>
			<Civilopedia>TXT_KEY_CIV5_IMPROVEMENTS_LANDMARK_TEXT</Civilopedia>
			<ArtDefineTag>ART_DEF_IMPROVEMENT_MONOLITH_EURO</ArtDefineTag>
			<Culture>8</Culture>
			<BuildableOnResources>true</BuildableOnResources>
			<PillageGold>30</PillageGold>
			<CreatedByGreatPerson>true</CreatedByGreatPerson>
			<PortraitIndex>36</PortraitIndex>
			<IconAtlas>TERRAIN_ATLAS</IconAtlas>
		</Row>
	</Improvements>
	<Improvement_Yields>
		<Row>
			<ImprovementType>IMPROVEMENT_FARM</ImprovementType>
			<YieldType>YIELD_FOOD</YieldType>
			<Yield>1</Yield>
		</Row>
		<Row>
			<ImprovementType>IMPROVEMENT_TRADING_POST</ImprovementType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>3</Yield>
		</Row>
		<Row>
			<ImprovementType>IMPROVEMENT_LUMBERMILL</ImprovementType>
			<YieldType>YIELD_PRODUCTION</YieldType>
			<Yield>1</Yield>
		</Row>
		<Row>
			<ImprovementType>IMPROVEMENT_CITY_RUINS</ImprovementType>
			<YieldType>YIELD_PRODUCTION</YieldType>
			<Yield>1</Yield>
		</Row>
		<Row>
			<ImprovementType>IMPROVEMENT_CITY_RUINS</ImprovementType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>1</Yield>
		</Row>
		<Row>
			<ImprovementType>IMPROVEMENT_CITY_RUINS</ImprovementType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
		<Row>
			<ImprovementType>IMPROVEMENT_ACADEMY</ImprovementType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>8</Yield>
		</Row>
		<Row>
			<ImprovementType>IMPROVEMENT_CUSTOMS_HOUSE</ImprovementType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>8</Yield>
		</Row>
		<Row>
			<ImprovementType>IMPROVEMENT_MANUFACTORY</ImprovementType>
			<YieldType>YIELD_PRODUCTION</YieldType>
			<Yield>8</Yield>
		</Row>
	</Improvement_Yields>
</GameData>

I'm probably making some stupid straight forward mistake here, but somehow I'm unable to spot it.
Would someone kindly point out the obvious flaw in my code?
Thanks in advance.
_____
rezaf
 
I'm rather new to this, myself (I posted a similar thread within seconds of yours :p) but one thing I note is the "row" tags. Aren't those supposed to be "update" tags? I'm fairly certain you also don't need to put down any properties that you aren't updating, as well, and I think at least a couple of those are already at default values.

Of course, as I'm learning in all aspects of modding, I could be very VERY wrong :confused:
 
If you're just making changes to the existing XML, then just do:

<Update>
<Set Yield="X"/>
<Where YieldType="YIELD_Y" ImprovementType="IMPROVEMENT_Z"/>
</Update>

This should work, but I haven't done anything with multiple conditions updates just yet, so it -might- be wrong.
 
I had massive problems getting anything to work using the update method.

I think I have a basic understanding how it's supposed to work - I actually do a little programming at work and have a good basic understanding of SQL, so this isn't too different - but somehow, if I use the update method, none of my changes are applied to the game and none of the log files seem to be able to tell me why.

Which is why I switched to using the Row tags - appearently they just overwrite whatever rows are there, which is fine in this case.

Like I explained in the op, everything works as it should in the other files I touched, just not this code.

I'm at a loss here. :(
_____
rezaf
 
if you are adding new data then you would use the <row> tags, if you are changing existing data then you would use the <update> tags.
 
You might want to take a peek at the thread I made at the same time as yours here.
That solved my <update> problems for units. I'm assuming it applies to improvements and buildings, as well, in that a long list of updates per one <where x=> tag won't work.

Edit:
Page 22 and 23 of Kael's guide may also be of great help. I probably wouldn't have had problems if I looked there first!
 
if you are adding new data then you would use the <row> tags, if you are changing existing data then you would use the <update> tags.

This.

For example, there is already an improvement caleed "IMPROVEMENT_LANDMARK". If all you wanted to do was change it's culture and pillagegold values, you would use:

Code:
<GameData>
	<Improvements>
		<Update>
			<Where Type="IMPROVEMENT_LANDMARK" />
			<Set Culture="8" PillageGold="30" />
		</Update>
	</Improvements>
</GameData>

:)
 
Ok, sorry for the somewhat late reply, but I had to do some stuff other than playing/modding Civ5. ;)

I'm not entirely sure why it works with the Yields rows and stuff and not with the improvements, but anyway, I changed the improvement modifications according to DasGruntLord's explanation and got the mod to work.

Thanks everybody.
_____
rezaf
 
Top Bottom