Mod shows up but building not created

jakkob4682

Chieftain
Joined
Nov 5, 2018
Messages
20
<?xml version="1.0"?>

-<GameData>


-<Buildings>


-<Row>

<!-- Building Defines -->


<Type>BUILDING_TRADECENTER</Type>

<BuildingClass>BUILDINGCLASS_TRADECENER</BuildingClass>

<Cost>300</Cost>

<GoldMaintenance>4</GoldMaintenance>

<PrereqTech>TECH_EDUCATION</PrereqTech>

<!-- Text and Civilopedia Entries -->


<Help>+10% Gold, Culture, and Science in the city in which it built. Also +3 to Science, Gold, and Culture.</Help>

<Description>Trade Center</Description>

<Civilopedia>The Trade Center is the epicenter of the city</Civilopedia>

<ArtDefineTag>NONE</ArtDefineTag>

<!-- More useful stuff for buildings -->


<SpecialistType>SPECIALIST_SCIENTIST</SpecialistType>

<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>

<SpecialistType>SPECIALIST_MUSICIAN</SpecialistType>

<SpecialistCount>3</SpecialistCount>

<GreatPeopleRateChange>1</GreatPeopleRateChange>

<MinAreaSize>-1</MinAreaSize>

<!-- Yield Changes -->


<CultureRateModifier>10</CultureRateModifier>

</Row>

</Buildings>


-<BuildingClasses>


-<Row>

<Type>BUILDINGCLASS_TRADECENTER</Type>

<DefaultBuilding>BUILDING_TRADECENTER</DefaultBuilding>

<Description>TXT_KEY_BUILDING_TRADECENTER</Description>

</Row>

</BuildingClasses>


-<Building_YieldModifiers>


-<Row>

<BuildingType>BUILDING_TRADECENTER</BuildingType>

<YieldType>YIELD_GOLD</YieldType>

<Yield>10</Yield>

</Row>


-<Row>

<BuildingType>BUILDING_TRADECENTER</BuildingType>

<YieldType>YIELD_SCIENCE</YieldType>

<Yield>10</Yield>

</Row>

</Building_YieldModifiers>

</GameData>
What am i doing wrong? Also of importance I don't have an art file associated with this mod as of yet. But no pedia entries at start of game

Moderator Action: Welcome to CivFanatics. Moved thread to main C&C forum as that is where questions get answered. Good luck with your modding. leif
 
Last edited by a moderator:
  1. Mismatch between
    Code:
    <BuildingClass>BUILDINGCLASS_TRADECENER</BuildingClass>
    and
    Code:
    <Type>BUILDINGCLASS_TRADECENTER</Type>
    One has two "T"s and the other does not.
  2. Non-Existant Text-Key Reference
    Code:
    <Description>TXT_KEY_BUILDING_TRADECENTER</Description>
    This is not a fatal error, but can result in seeing literally "TXT_KEY_BUILDING_TRADECENTER" in certain portions of the game wherever the name of a Building-Class is needed.
    • Your non-defined text-key reference occurs in the definition of the Building-Class so will follow the need to display a Building-Class name rather than a simple Building name wherever required, even though your text-key reference is "TXT_KEY_BUILDING_TRADECENTER"
  3. Attempt to use the same column multiple times in the same row
    Code:
    <SpecialistType>SPECIALIST_SCIENTIST</SpecialistType>
    
    <SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
    
    <SpecialistType>SPECIALIST_MUSICIAN</SpecialistType>
    This is a fatal syntax error and causes the game to reject the entire contents of the file where it occurs. You can never repeat a column-name even with differing argument-data in a single row of any game-table.
    • There can be only one selection of <SpecialistType> for any one building.
 
So I have to have a row for each specialist? Or I can only have one specialist? Where do I create the TXT_KEY_ reference?
 
◦There can be only one selection of <SpecialistType> for any one building.
No one building can have more than one type of specialist.
Code:
	<Language_en_US>
		<Row Tag="TXT_KEY_BUILDING_TRADECENTER">
			<Text>Trade Center</Text>
		</Row>
	</Language_en_US>
 
Not really. Buildings for the most part don't actually use any main-map art, but you do need to include values for <IconAtlas> and <PortraitIndex>. These are used to define the Icon that should show in the city-view, on the civilopedia, etc. You can re-use existing ones the game already has. So if you want to have the game use the same Icon as is used for the Market, you can just add
Code:
			<IconAtlas>BW_ATLAS_1</IconAtlas>
			<PortraitIndex>16</PortraitIndex>
To the definition under table <Buildings>.

Column <ArtDefineTag> is used to designate a main-map 3d model definition (if any) rather than the Icon the game should use. NONE as you are using is just fine.
 
Is it possible to increase the yields of the other types by percentage? I was browsing through you Advanced XML guide and couldn't find it.
 
awesome, thank you. sorry for a million questions just getting into modding civ. Does each table need a seperate a file? I can store them all in one xml file i.e. NewBuilding.xml which contains all the tables I'm trying to adjust?

Also is this like specialists where only entry for yields is possible? Or can I have the building increase the yield percentage for more than one type of yield? Does it need a separate row, or same row?

Or is there a guide or guides that you can point me to? One guide I read had two files to define the building, and one to define the texts. I imagine this makes for less clutter when adding more than one building but is it necessary?
 
Last edited:
You can do this:
Code:
		<!-- these modifiers create percentage adjustments to city yields -->
	<Building_YieldModifiers>
		<Row>
			<BuildingType>BUILDING_NEW_BUILDING</BuildingType>
			<YieldType>YIELD_FOOD</YieldType>
			<Yield>15</Yield>
		</Row>
		<Row>
			<BuildingType>BUILDING_NEW_BUILDING</BuildingType>
			<YieldType>YIELD_PRODUCTION</YieldType>
			<Yield>10</Yield>
		</Row>
		<Row>
			<BuildingType>BUILDING_NEW_BUILDING</BuildingType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>25</Yield>
		</Row>
		<Row>
			<BuildingType>BUILDING_NEW_BUILDING</BuildingType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>33</Yield>
		</Row>
	</Building_YieldModifiers>
Each type of yield for the same building needs its own row in the table.

All your code can be dumped into the same file.
 
For some reason even after correcting syntax errors the last time around, and making you recommended changes there's still no entry in the civilopedia.
Code:
<GameData>
    <Language_en_US>
        <Row Tag="TXT_KEY_BUILDING_TRADECENTER">
            <Text>Trade Center</Text>
        </Row>
    </Language_en_US>

 
    
    
    <Buildings>
            <Row>
            <!-- Building Defines -->
            <Type>BUILDING_TRADECENTER</Type>
            <BuildingClass>BUILDINGCLASS_TRADECENTER</BuildingClass>
            <Cost>300</Cost>
            <GoldMaintenance>4</GoldMaintenance>
            <PrereqTech>TECH_EDUCATION</PrereqTech>
            <IconAtlas>BW_ATLAS_1</IconAtlas>
            <PortraitIndex>16</PortraitIndex>
            
            <!-- Text and Civilopedia Entries -->
            
            <Help>+10% Gold, Culture, and Science in the city in which it built.  Also +3 to Science, Gold, and Culture.</Help>
            <Description>Trade Center</Description>
            <Civilopedia>The Trade Center is the epicenter of the city</Civilopedia>
            <ArtDefineTag>NONE</ArtDefineTag>

            <!-- More useful stuff for buildings -->
            <SpecialistType>SPECIALIST_SCIENTIST</SpecialistType>
            <SpecialistCount>3</SpecialistCount>
            <GreatPeopleRateChange>1</GreatPeopleRateChange>
            <MinAreaSize>-1</MinAreaSize>
            
            <!-- Yield Changes -->
            <CultureRateModifier>10</CultureRateModifier>
            </Row>
    </Buildings>
    
    <Building_YieldChanges>
    <Row>
        <BuildingType>BUILDING_TRADECENTER</BuildingType>
        <YieldType>YIELD_GOLD</YieldType>
        <Yield>1</Yield>
    </Row>
    <Row>
        <BuildingType>BUILDING_TRADECENTER</BuildingType>
        <YieldType>YIELD_PRODUCTION</YieldType>
        <Yield>1</Yield>
    </Row>
    <Row>
        <BuildingType>BUILDING_TRADECENTER</BuildingType>
        <YieldType>YIELD_SCIENCE</YieldType>
        <Yield>1</Yield>
    </Row>
    <Row>
        <BuildingType>BUILDING_TRADECENTER</BuildingType>
        <YieldType>YIELD_FOOD</YieldType>
        <Yield>1</Yield>
    </Row>
</Building_YieldChanges>
    
    <BuildingClasses>
    <Row>
        <Type>BUILDINGCLASS_TRADECENTER</Type>
        <DefaultBuilding>BUILDING_TRADECENTER</DefaultBuilding>
        <Description>TXT_KEY_BUILDING_TRADECENTER</Description>
        
    </Row>
    </BuildingClasses>
    
    <Building_YieldModifiers>
    <Row>
        <BuildingType>BUILDING_TRADECENTER</BuildingType>
        <YieldType>YIELD_GOLD</YieldType>
        <Yield>5</Yield>
    </Row>
    <Row>
        <BuildingType>BUILDING_TRADECENTER</BuildingType>
        <YieldType>YIELD_SCIENCE</YieldType>
        <Yield>5</Yield>
    </Row>
    </Building_YieldModifiers>
</GameData>
 
It would be better to zip and attach the mod itself: See: whoward69's zip your mods and attach tutorial Just bear in mind that the process for actually adding the zip to a forum post is now different since the CFC website software was updated a few months ago about a year ago. To attach the zip to a forum post, look for a button called Upload A File when composing your thread reply: this button opens a browse menu where you can select the zipped folder to attach directly to a forum post.

You should also enable error logging and use Database.log to find clues as to why your mod is not working: whoward69's enable error logging tutorial
 
From the log:

Reference on Buildings.Help - "+10% Gold, Culture, and Science in the city in which it built. Also +3 to Science, Gold, and Culture." does not exist in Language_en_US
[4994.359] Invalid Reference on Buildings.Civilopedia - "The Trade Center is the epicenter of the city" does not exist in Language_en_US
[4994.437] Invalid Reference on Buildings.Description - "Trade Center" does not exist in Language_en_US

I read some more of your guide so I think I got it nailed down now for the text conversions
 
Last edited:
You're missing a "Row" closer here:
Code:
		<Row Tag="TXT_KEY_CIV5_BUILDINGS_TRADECENTER_TEXT">
			<Text>The Trade Center is the epicenter of the city</Text>
	</Language_en_US>
Which results in this error in database.log as the nearest error-message the game can generate for the condition:
Code:
[894438.125] Database::XMLSerializer (XML/Tradecenter.xml): 'Row' or 'Delete' expected, got 'Buildings'.

these kinds of errors are sometimes not easy to see when reading code. Which is why the request for the mod itself. Consistent indentation methods is helpful in xml to spot omissions of the sort you had.
Spoiler :
Code:
<GameData>
	<Language_en_US>
		<Row Tag="TXT_KEY_BUILDING_TRADECENTER">
			<Text>Trade Center</Text>
		</Row>
		<Row Tag="TXT_KEY_BUILDING_TRADECENTER_HELP">
			<Text>+25% Gold Culture, and Science in the city in which it is built.</Text>
		</Row>
		<Row Tag="TXT_KEY_CIV5_BUILDINGS_TRADECENTER_TEXT">
			<Text>The Trade Center is the epicenter of the city</Text>
		</Row>
	</Language_en_US>
	
	<Buildings>
		<Row>
			<!-- Building Defines -->
			<Type>BUILDING_TRADECENTER</Type>
			<BuildingClass>BUILDINGCLASS_TRADECENTER</BuildingClass>
			<Cost>300</Cost>
			<GoldMaintenance>4</GoldMaintenance>
			<PrereqTech>TECH_EDUCATION</PrereqTech>
			<IconAtlas>BW_ATLAS_1</IconAtlas>
			<PortraitIndex>16</PortraitIndex>
			
			<!-- Text and Civilopedia Entries -->
			
			<Help>+25% Gold, Culture, and Science in the city in which it built.</Help>
			<Description>Trade Center</Description>
			<Civilopedia>The Trade Center is the epicenter of the city</Civilopedia>
			<ArtDefineTag>NONE</ArtDefineTag>

			<!-- More useful stuff for buildings -->
			<SpecialistType>SPECIALIST_SCIENTIST</SpecialistType>
			<SpecialistCount>3</SpecialistCount>
			<GreatPeopleRateChange>1</GreatPeopleRateChange>
			<MinAreaSize>-1</MinAreaSize>
			
			<!-- Yield Changes -->
			<CultureRateModifier>10</CultureRateModifier>
		</Row>
	</Buildings>
	
	<Building_YieldChanges>
		<Row>
			<BuildingType>BUILDING_TRADECENTER</BuildingType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
		<Row>
			<BuildingType>BUILDING_TRADECENTER</BuildingType>
			<YieldType>YIELD_PRODUCTION</YieldType>
			<Yield>1</Yield>
		</Row>
		<Row>
			<BuildingType>BUILDING_TRADECENTER</BuildingType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>1</Yield>
		</Row>
		<Row>
			<BuildingType>BUILDING_TRADECENTER</BuildingType>
			<YieldType>YIELD_FOOD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Building_YieldChanges>
	
	<BuildingClasses>
		<Row>
			<Type>BUILDINGCLASS_TRADECENTER</Type>
			<DefaultBuilding>BUILDING_TRADECENTER</DefaultBuilding>
			<Description>TXT_KEY_BUILDING_TRADECENTER</Description>
		</Row>
	</BuildingClasses>
	
	<Building_YieldModifiers>
		<Row>
			<BuildingType>BUILDING_TRADECENTER</BuildingType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>10</Yield>
		</Row>
		<Row>
			<BuildingType>BUILDING_TRADECENTER</BuildingType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>10</Yield>
		</Row>
	</Building_YieldModifiers>
</GameData>
Everything runs fine with the error corrected.
 
I'm not seeing an entry in the civilopedia.... but you did? Also getting weird errors in the log about leaders not being present
 
Last edited:
I didn't look at the civilopedia. I tested that once the correct tech is available the building shows in the city production lists.

[edit]Just re-tested with the corrected code I posted and the buildng shows in the proper era in the civilopedia as well.
 
Last edited:
Medieval Era isn't showing a trade center in my pedia.... I only have G&K and BNW listed as the mandatory mods, all others as optional if that matters
 
Back
Top Bottom