Need Help with Building Override Code

1SDANi

The Fading Memory
Joined
Oct 27, 2014
Messages
3,072
So I'm working on changing the Monument to look like a different building and making a new monument for various reasons, but I've found my code is not working. After an hour of being stumped, I've decided to come here for help.

My code:
Spoiler :
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 7/20/2015 6:04:07 PM -->
<GameData>
	<Buildings>
		<Update>
			<Where Type="BUILDING_MONUMENT"/>
			<Set Culture="1" IconAtlas="TECH_ATLAS_1" PortraitIndex="0" Cost="20"/>
		</Update>
		
		<Row>
			<Type>BUILDING_REAL_MONUMENT</Type>
			<BuildingClass>BUILDINGCLASS_MONUMENT</BuildingClass>
			<PrereqTech>TECH_POTTERY</PrereqTech>
			<FreeStartEra>ERA_MEDIEVAL</FreeStartEra>
			<Cost>40</Cost>
			<GoldMaintenance>1</GoldMaintenance>
			<Help>TXT_KEY_BUILDING_REAL_MONUMENT_STRATEGY</Help>
			<Description>TXT_KEY_BUILDING_REAL_MONUMENT_DESC</Description>
			<Civilopedia>TXT_KEY_BUILDING_REAL_MONUMENT_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_REAL_MONUMENT_STRATEGY</Strategy>
			<ArtDefineTag>MONUMENT</ArtDefineTag>
			<MinAreaSize>-1</MinAreaSize>
			<Culture>2</Culture>
			<HurryCostModifier>40</HurryCostModifier>
			<IconAtlas>BW_ATLAS_1</IconAtlas>
			<NeverCapture>true</NeverCapture>
			<PortraitIndex>21</PortraitIndex>
		</Row>
		
	</Buildings>
	<Language_en_US>
		<Update>
			<Where Tag="TXT_KEY_BUILDING_MONUMENT_PEDIA"/>
			<Set Text="A Potter's House is a structure home to the necessities for making Pottery. Staple utilities stored inside of it include paints, clay and a Pit Kiln."/>
		</Update>

		<Update>
			<Where Tag="TXT_KEY_BUILDING_MONUMENT_STRATEGY"/>
			<Set Text="The Potter's House increases the [ICON_CULTURE] Culture of a city, speeding the growth of the city's territory and the civilization's acquisition of Social Policies."/>
		</Update>

		<Update>
			<Where Tag="TXT_KEY_BUILDING_MONUMENT_DESC"/>
			<Set Text="Potter's House"/>
		</Update>

		<Row>
			<Where Tag="TXT_KEY_BUILDING_REAL_MONUMENT_PEDIA"/>
			<Set Text="A monument is a structure built to commemorate an important person, event, deity, or concept. The more important monuments are usually constructed near the center of the city, by the ruler's palace, or near the city's main gates. Monuments come in all shapes and sizes, from the Great Sphinx of Giza, Egypt, to the Statue of Liberty in New York City, USA, to Nelson's Column in London, England. The best of them imbue the city's inhabitants with a great feeling of civic and national pride. "/>
		</Row>

		<Row>
			<Where Tag="TXT_KEY_BUILDING_REAL_MONUMENT_STRATEGY"/>
			<Set Text="The Monument increases the [ICON_CULTURE] Culture of a city, speeding the growth of the city's territory and the civilization's acquisition of Social Policies."/>
		</Row>

		<Row>
			<Where Tag="TXT_KEY_BUILDING_REAL_MONUMENT_DESC"/>
			<Set Text="Monument"/>
		</Row>
	</Language_en_US>
</GameData>

Database.log results:
Spoiler :
Code:
[145579.343] no such column: Culture
[145579.343] In Query - UPDATE Buildings SET "Culture" = ?, "IconAtlas" = ?, "PortraitIndex" = ?, "Cost" = ? WHERE "Type" = ?;
[145579.343] Database::XMLSerializer (Potter's House.xml): There was an error executing the update statement! See Database.log for details.
[145579.343] In XMLSerializer while updating table Buildings from file Potter's House.xml.
[145579.343] column Type is not unique
[145579.343] While executing - 'insert into BuildingClasses('Type', 'DefaultBuilding', 'Description') values (?, ?, ?);'
 
Use of column "Culture" is only valid in Vanilla, and is no good in G&K and BNW

You also have an error coming from a portion of your code that you did not show but is being generated (and causing complete file failure) because you have repeated a <Type> dsignation within table <BuildingClasses>
 
I showed all of the code in the mod. Maybe it's another mod doing the type thing.

As for using Culture, I guess that's what I get for not checking the DLC files. Thanks!
 
Fixed the culture part, but that strange Type error persists.

Here's all of the code in the XML file:

Spoiler :
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 7/20/2015 6:04:07 PM -->
<GameData>
	<Buildings>
		<Update>
			<Where Type="BUILDING_MONUMENT"/>
			<Set PrereqTech="TECH_POTTERY" IconAtlas="TECH_ATLAS_1" PortraitIndex="0"/>
		</Update>
		
		<Row>
			<Type>BUILDING_REAL_MONUMENT</Type>
			<BuildingClass>BUILDINGCLASS_MONUMENT</BuildingClass>
			<PrereqTech>TECH_AGRICULTURE</PrereqTech>
			<FreeStartEra>ERA_MEDIEVAL</FreeStartEra>
			<Cost>20</Cost>
			<GoldMaintenance>1</GoldMaintenance>
			<Help>TXT_KEY_BUILDING_REAL_MONUMENT_STRATEGY</Help>
			<Description>TXT_KEY_BUILDING_REAL_MONUMENT_DESC</Description>
			<Civilopedia>TXT_KEY_BUILDING_REAL_MONUMENT_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_REAL_MONUMENT_STRATEGY</Strategy>
			<ArtDefineTag>MONUMENT</ArtDefineTag>
			<MinAreaSize>-1</MinAreaSize>
			<HurryCostModifier>40</HurryCostModifier>
			<IconAtlas>TECH_ATLAS_1</IconAtlas>
			<NeverCapture>true</NeverCapture>
			<PortraitIndex>0</PortraitIndex>
		</Row>
		
	</Buildings>

	<Building_YieldChanges>
		<Row>
			<BuildingType>BUILDING_REAL_MONUMENT</BuildingType>
			<YieldType>YIELD_CULTURE</YieldType>
			<Yield>1</Yield>
		</Row>
	</Building_YieldChanges>
		
	<Language_en_US>
		<Update>
			<Where Tag="TXT_KEY_BUILDING_MONUMENT_PEDIA"/>
			<Set Text="A Potter's House is a structure home to the necessities for making Pottery. Staple utilities stored inside of it include paints, clay and a Pit Kiln."/>
		</Update>

		<Update>
			<Where Tag="TXT_KEY_BUILDING_MONUMENT_STRATEGY"/>
			<Set Text="The Potter's House increases the [ICON_CULTURE] Culture of a city, speeding the growth of the city's territory and the civilization's acquisition of Social Policies."/>
		</Update>

		<Update>
			<Where Tag="TXT_KEY_BUILDING_MONUMENT_DESC"/>
			<Set Text="Potter's House"/>
		</Update>

		<Row>
			<Where Tag="TXT_KEY_BUILDING_REAL_MONUMENT_PEDIA"/>
			<Set Text="A monument is a structure built to commemorate an important person, event, deity, or concept. The more important monuments are usually constructed near the center of the city, by the ruler's palace, or near the city's main gates. Monuments come in all shapes and sizes, from the Great Sphinx of Giza, Egypt, to the Statue of Liberty in New York City, USA, to Nelson's Column in London, England. The best of them imbue the city's inhabitants with a great feeling of civic and national pride. "/>
		</Row>

		<Row>
			<Where Tag="TXT_KEY_BUILDING_REAL_MONUMENT_STRATEGY"/>
			<Set Text="The Monument increases the [ICON_CULTURE] Culture of a city, speeding the growth of the city's territory and the civilization's acquisition of Social Policies."/>
		</Row>

		<Row>
			<Where Tag="TXT_KEY_BUILDING_REAL_MONUMENT_DESC"/>
			<Set Text="Monument"/>
		</Row>
	</Language_en_US>
</GameData>

Error as always:
Spoiler :
Code:
[148652.125] column Type is not unique
[148652.125] While executing - 'insert into Improvements('Type', 'Description', 'Civilopedia', 'ArtDefineTag', 'PillageGold', 'PortraitIndex', 'IconAtlas', 'RequiresFeature', 'RequiresFlatlands') values (?, ?, ?, ?, ?, ?, ?, ?, ?);'
[148652.125] In XMLSerializer while inserting row into table insert into Improvements('Type', 'Description', 'Civilopedia', 'ArtDefineTag', 'PillageGold', 'PortraitIndex', 'IconAtlas', 'RequiresFeature', 'RequiresFlatlands') with  values (IMPROVEMENT_FOREST_FARM, TXT_KEY_IMPROVEMENT_FOREST_FARM, TXT_KEY_CIV5_IMPROVEMENTS_FOREST_FARM_TEXT, ART_DEF_IMPROVEMENT_PLANTATION, 20, 22, TERRAIN_ATLAS, 1, 1, ).
[148652.125] In XMLSerializer while updating table Improvements from file Forest Farm.xml.
[148652.125] column Type is not unique
[148652.125] table Language_en_US has no column named Where
[148652.125] In Query - insert into Language_en_US('Where', 'Set') values (?, ?);
[148652.125] In XMLSerializer while updating table Language_en_US from file Potter's House.xml.
[148652.125] column Type is not unique
[148652.125] While executing - 'insert into BuildingClasses('Type', 'DefaultBuilding', 'Description') values (?, ?, ?);'
[148652.125] In XMLSerializer while inserting row into table insert into BuildingClasses('Type', 'DefaultBuilding', 'Description') with  values (BUILDINGCLASS_SMELTER, BUILDING_SMELTER, TXT_KEY_BUILDING_SMELTER, ).
[148652.125] In XMLSerializer while updating table BuildingClasses from file Early Production Fix.xml.
[148652.125] column Type is not unique
[148652.125] columns Language, Tag are not unique
[148652.125] While executing - 'insert into Language_EN_US('Tag', 'Text') values (?, ?);'
[148652.125] In XMLSerializer while inserting row into table insert into Language_EN_US('Tag', 'Text') with  values (TXT_KEY_BUILDING_SMELTER, Smelter, ).
[148652.125] In XMLSerializer while updating table Language_EN_US from file Text.xml.
[148652.125] columns Language, Tag are not unique

This time I put all of the parts that end in .125 just in case it helps.
 
This report indicates that "Type" error is not coming from your building code, but rather some kind of code for a new improvement. I've colored red the parts that tell you that:
Code:
[148652.125] column Type is not unique
[148652.125] While executing - [COLOR="red"]'insert into Improvements[/COLOR]('Type', 'Description', 'Civilopedia', 'ArtDefineTag', 'PillageGold', 'PortraitIndex', 'IconAtlas', 'RequiresFeature', 'RequiresFlatlands') values (?, ?, ?, ?, ?, ?, ?, ?, ?);'
[148652.125] In XMLSerializer while inserting row into table [COLOR="red"]insert into Improvements[/COLOR]('Type', 'Description', 'Civilopedia', 'ArtDefineTag', 'PillageGold', 'PortraitIndex', 'IconAtlas', 'RequiresFeature', 'RequiresFlatlands') with  values (IMPROVEMENT_FOREST_FARM, TXT_KEY_IMPROVEMENT_FOREST_FARM, TXT_KEY_CIV5_IMPROVEMENTS_FOREST_FARM_TEXT, ART_DEF_IMPROVEMENT_PLANTATION, 20, 22, TERRAIN_ATLAS, 1, 1, ).
[148652.125] In XMLSerializer [COLOR="Red"]while updating table Improvements from file Forest Farm.xml.[/COLOR]
[148652.125] column Type is not unique
Since nowhere in the code you posted is the table <Improvements> ever mentioned, this error can't apply to it.

There is, however, this error from your building file that will cause the game to dump the whole file:
Code:
[148652.125] table Language_en_US has no column named Where
[148652.125] In Query - insert into Language_en_US('Where', 'Set') values (?, ?);
[148652.125] In XMLSerializer while updating table Language_en_US from file Potter's House.xml.
It refers to this line:
Spoiler :
Code:
<Language_en_US>
		<Update>
			<Where Tag="TXT_KEY_BUILDING_MONUMENT_PEDIA"/>
			<Set Text="A Potter's House is a structure home to the necessities for making Pottery. Staple utilities stored inside of it include paints, clay and a Pit Kiln."/>
		</Update>

		<Update>
			<Where Tag="TXT_KEY_BUILDING_MONUMENT_STRATEGY"/>
			<Set Text="The Potter's House increases the [ICON_CULTURE] Culture of a city, speeding the growth of the city's territory and the civilization's acquisition of Social Policies."/>
		</Update>

		<Update>
			<Where Tag="TXT_KEY_BUILDING_MONUMENT_DESC"/>
			<Set Text="Potter's House"/>
		</Update>

		<Row>
			[B][COLOR="Red"]<Where Tag="TXT_KEY_BUILDING_REAL_MONUMENT_PEDIA"/>[/COLOR][/B]
			<Set Text="A monument is a structure built to commemorate an important person, event, deity, or concept. The more important monuments are usually constructed near the center of the city, by the ruler's palace, or near the city's main gates. Monuments come in all shapes and sizes, from the Great Sphinx of Giza, Egypt, to the Statue of Liberty in New York City, USA, to Nelson's Column in London, England. The best of them imbue the city's inhabitants with a great feeling of civic and national pride. "/>
		</Row>

		<Row>
			<Where Tag="TXT_KEY_BUILDING_REAL_MONUMENT_STRATEGY"/>
			<Set Text="The Monument increases the [ICON_CULTURE] Culture of a city, speeding the growth of the city's territory and the civilization's acquisition of Social Policies."/>
		</Row>

		<Row>
			<Where Tag="TXT_KEY_BUILDING_REAL_MONUMENT_DESC"/>
			<Set Text="Monument"/>
		</Row>
	</Language_en_US>
As a modder you'll have to learn to read the log errors and realize that what the game thinks is the error is not always what the error really is. In this case, there is no real problem with that line, but with the line above it. <Row> should be <Update>, and the corresponding end tag should also be changed accordingly.
<Row> tells the game that you're adding a completely new item to the table. Use <Update> when you just want to change a couple columns of an already existing item.
 
Spoiler :
Code:
[COLOR="Blue"][148652.125] column Type is not unique
[148652.125] While executing - 'insert into Improvements('Type', 'Description', 'Civilopedia', 'ArtDefineTag', 'PillageGold', 'PortraitIndex', 'IconAtlas', 'RequiresFeature', 'RequiresFlatlands') values (?, ?, ?, ?, ?, ?, ?, ?, ?);'
[148652.125] In XMLSerializer while inserting row into table insert into Improvements('Type', 'Description', 'Civilopedia', 'ArtDefineTag', 'PillageGold', 'PortraitIndex', 'IconAtlas', 'RequiresFeature', 'RequiresFlatlands') with  values (IMPROVEMENT_FOREST_FARM, TXT_KEY_IMPROVEMENT_FOREST_FARM, TXT_KEY_CIV5_IMPROVEMENTS_FOREST_FARM_TEXT, ART_DEF_IMPROVEMENT_PLANTATION, 20, 22, TERRAIN_ATLAS, 1, 1, ).
[148652.125] In XMLSerializer while updating table Improvements from file Forest Farm.xml.
[148652.125] column Type is not unique[/color]
[COLOR="Red"][148652.125] table Language_en_US has no column named Where
[148652.125] In Query - insert into Language_en_US('Where', 'Set') values (?, ?);
[148652.125] In XMLSerializer while updating table Language_en_US from file Potter's House.xml.[/COLOR]
[COLOR="green"][148652.125] column Type is not unique
[148652.125] While executing - 'insert into BuildingClasses('Type', 'DefaultBuilding', 'Description') values (?, ?, ?);'
[148652.125] In XMLSerializer while inserting row into table insert into BuildingClasses('Type', 'DefaultBuilding', 'Description') with  values (BUILDINGCLASS_SMELTER, BUILDING_SMELTER, TXT_KEY_BUILDING_SMELTER, ).
[148652.125] In XMLSerializer while updating table BuildingClasses from file Early Production Fix.xml.
[148652.125] column Type is not unique[/COLOR]
[COLOR="Magenta"][148652.125] columns Language, Tag are not unique
[148652.125] While executing - 'insert into Language_EN_US('Tag', 'Text') values (?, ?);'
[148652.125] In XMLSerializer while inserting row into table insert into Language_EN_US('Tag', 'Text') with  values (TXT_KEY_BUILDING_SMELTER, Smelter, ).
[148652.125] In XMLSerializer while updating table Language_EN_US from file Text.xml.
[148652.125] columns Language, Tag are not unique[/COLOR]
Each of these has a different file-name referenced. This is exactly the sort of reason why it is always better to attach the actual mod rather than quoting code from within the mod. You have four different files, each with a different error, being referenced in that group of error codes.

-----------------------------------------------------------

And with your earlier comment that I missed, it is entirely possible that one or more of the errors is coming from a diffrerent mod. Shut your mod off, run through starting a New-Game Set-Up, exit directly to windows, then look at the error log. Any errors still being reported cannot be coming from your mod.

This sort of thing is also why it is far better as a test-procedure to run no more mods than is absolutely necessary for your mod to operate correctly. If your mod is not dependant on Mod-X to operate correctly, turn off Mod-X. The only general exception to this is IGE. Even EUI can cause mod-failures in an otherwise correctly-created mod.
 
Oops, so I forgot to change the format from Update to Rows... DOH!
 
Back
Top Bottom