[HELP] Troubleshooting My First Mod

thombran

Chieftain
Joined
Aug 18, 2006
Messages
25
Location
Toronto, Ontario.
ATTENTION: MAJOR N00BERY FOLLOWS. PLEASE EXCUSE MY IGNORANCE.

The past few days I've been reading a bit into modding Civ 5, and decided to create my own mod. The idea is to create forts and citadels that can be used as bases for missiles and air units much like missile cruisers and carriers. To do this, I thought I would modify the xml files under Improvements and Builds. Early on I discovered the schema under Improvments.xml did not have any commands for <SpecialCargo> and <DomainCargo>. So naturally I thought what I needed to do was modify the schema to add these commands and then reference them under the Citadel Improvement Row under /Improvements. Sadly, something seems to be wrong as I've tested the following modifications and they haven't produced any change in the game :(. I'd appreciate so much if one you guys could let me know what's failing here :

This is my attempt to modify the original schema for <Improvements>:
Spoiler :
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 10/11/2012 12:47:30 AM -->
<GameData>
<!-- Schema-->
<!-- Table definition -->
<Table name="Improvements">
<Column name="ID" type="integer" primarykey="true" autoincrement="true"/>
<Column name="Type" type="text" notnull="true" unique="true"/>
<Column name="Description" type="text"/>
<Column name="Civilopedia" type="text"/>
<Column name="Help" type="text"/>
<Column name="ArtDefineTag" type="text"/>
<Column name="WorldSoundscapeAudioScript" type="text"/>
<Column name="ImprovementPillage" type="text" reference="Improvements(Type)" default="NULL"/>
<Column name="ImprovementUpgrade" type="text" reference="Improvements(Type)" default="NULL"/>
<Column name="SpecificCivRequired" type="boolean" default="false"/>
<Column name="CivilizationType" type="text" reference="Civilizations(Type)" default="NULL"/>
<Column name="HillsMakesValid" type="boolean" default="false"/>
<Column name="FreshWaterMakesValid" type="boolean" default="false"/>
<Column name="RiverSideMakesValid" type="boolean" default="false"/>
<Column name="NoFreshWater" type="boolean" default="false"/>
<Column name="RequiresFlatlands" type="boolean" default="false"/>
<Column name="RequiresFlatlandsOrFreshWater" type="boolean" default="false"/>
<Column name="RequiresFeature" type="boolean" default="false"/>
<Column name="Coastal" type="boolean" default="false"/>
<Column name="Water" type="boolean" default="false"/>
<Column name="DestroyedWhenPillaged" type="boolean" default="false"/>
<Column name="BuildableOnResources" type="boolean" default="false"/>
<Column name="BarbarianCamp" type="boolean" default="false"/>
<Column name="Goody" type="boolean" default="false"/>
<Column name="Permanent" type="boolean" default="false"/>
<Column name="OutsideBorders" type="boolean" default="false"/>
<Column name="GraphicalOnly" type="boolean" default="false"/>
<Column name="CreatedByGreatPerson" type="boolean" default="false"/>
<Column name="Culture" type="integer" default="0"/>
<Column name="CultureAdjacentSameType" type="integer" default="0"/>
<Column name="TilesPerGoody" type="integer" default="0"/>
<Column name="GoodyRange" type="integer" default="0"/>
<Column name="FeatureGrowth" type="integer" default="0"/>
<Column name="UpgradeTime" type="integer" default="0"/>
<Column name="RiverSideUpgradeMod" type="integer" default="0"/>
<Column name="CoastalLandUpgradeMod" type="integer" default="0"/>
<Column name="HillsUpgradeMod" type="integer" default="0"/>
<Column name="FreshWaterUpgradeMod" type="integer" default="0"/>
<Column name="DefenseModifier" type="integer" default="0"/>
<Column name="NearbyEnemyDamage" type="integer" default="0"/>
<Column name="PillageGold" type="integer" default="0"/>
<Column name="ResourceExtractionMod" type="integer" default="0"/>
<Column name="GoldMaintenance" type="integer" default="0"/>
<Column name="PortraitIndex" type="integer" default="-1"/>
<Column name="IconAtlas" type="text" default="NULL" reference="IconTextureAtlases(Atlas)"/>
<Column name="SpecialCargo" type="text" reference="SpecialUnits(Type)" default="NULL"/>
<Column name="DomainCargo" type="text" reference="Domains(Type)" default="NULL"/>
</Table>
<Table name="Improvement_Flavors">
<Column name="ImprovementType" type="text" reference="Improvements(Type)"/>
<Column name="FlavorType" type="text" reference="Flavors(Type)"/>
<Column name="Flavor" type="integer" notnull="true"/>
</Table>
<Table name="Improvement_Yields">
<Column name="ImprovementType" type="text" reference="Improvements(Type)"/>
<Column name="YieldType" type="text" reference="Yields(Type)"/>
<Column name="Yield" type="integer" default="0"/>
</Table>
<Table name="Improvement_AdjacentCityYields">
<Column name="ImprovementType" type="text" reference="Improvements(Type)"/>
<Column name="YieldType" type="text" reference="Yields(Type)"/>
<Column name="Yield" type="integer" default="0"/>
</Table>
<Table name="Improvement_CoastalLandYields">
<Column name="ImprovementType" type="text" reference="Improvements(Type)"/>
<Column name="YieldType" type="text" reference="Yields(Type)"/>
<Column name="Yield" type="integer" default="0"/>
</Table>
<Table name="Improvement_FreshWaterYields">
<Column name="ImprovementType" type="text" reference="Improvements(Type)"/>
<Column name="YieldType" type="text" reference="Yields(Type)"/>
<Column name="Yield" type="integer" default="0"/>
</Table>
<Table name="Improvement_HillsYields">
<Column name="ImprovementType" type="text" reference="Improvements(Type)"/>
<Column name="YieldType" type="text" reference="Yields(Type)"/>
<Column name="Yield" type="integer" default="0"/>
</Table>
<Table name="Improvement_AdjacentMountainYieldChanges">
<Column name="ImprovementType" type="text" reference="Improvements(Type)"/>
<Column name="YieldType" type="text" reference="Yields(Type)"/>
<Column name="Yield" type="integer" default="0"/>
</Table>
<Table name="Improvement_PrereqNatureYields">
<Column name="ImprovementType" type="text" reference="Improvements(Type)"/>
<Column name="YieldType" type="text" reference="Yields(Type)"/>
<Column name="Yield" type="integer" default="0"/>
</Table>
<Table name="Improvement_RiverSideYields">
<Column name="ImprovementType" type="text" reference="Improvements(Type)"/>
<Column name="YieldType" type="text" reference="Yields(Type)"/>
<Column name="Yield" type="integer" default="0"/>
</Table>
<Table name="Improvement_ValidTerrains">
<Column name="ImprovementType" type="text" reference="Improvements(Type)"/>
<Column name="TerrainType" type="text" reference="Terrains(Type)"/>
</Table>
<Table name="Improvement_ValidFeatures">
<Column name="ImprovementType" type="text" reference="Improvements(Type)"/>
<Column name="FeatureType" type="text" reference="Features(Type)"/>
</Table>
<Table name="Improvement_ResourceTypes">
<Column name="ImprovementType" type="text" reference="Improvements(Type)"/>
<Column name="ResourceType" type="text" reference="Resources(Type)"/>
<Column name="ResourceMakesValid" type="boolean" default="true"/>
<Column name="ResourceTrade" type="boolean" default="true"/>
<Column name="DiscoveryRand" type="integer" default="0"/>
<Column name="QuantityRequirement" type="integer" default="0"/>
</Table>
<Table name="Improvement_ResourceType_Yields">
<Column name="ImprovementType" type="text" reference="Improvements(Type)"/>
<Column name="ResourceType" type="text" reference="Resources(Type)"/>
<Column name="YieldType" type="text" reference="Yields(Type)"/>
<Column name="Yield" type="integer" default="0"/>
</Table>
<Table name="Improvement_RouteYieldChanges">
<Column name="ImprovementType" type="text" reference="Improvements(Type)"/>
<Column name="RouteType" type="text" reference="Routes(Type)"/>
<Column name="YieldType" type="text" reference="Yields(Type)"/>
<Column name="Yield" type="integer"/>
</Table>
<Table name="Improvement_TechYieldChanges">
<Column name="ImprovementType" type="text" reference="Improvements(Type)"/>
<Column name="TechType" type="text" reference="Technologies(Type)"/>
<Column name="YieldType" type="text" reference="Yields(Type)"/>
<Column name="Yield" type="integer"/>
</Table>
<Table name="Improvement_TechNoFreshWaterYieldChanges">
<Column name="ImprovementType" type="text" reference="Improvements(Type)"/>
<Column name="TechType" type="text" reference="Technologies(Type)"/>
<Column name="YieldType" type="text" reference="Yields(Type)"/>
<Column name="Yield" type="integer"/>
</Table>
<Table name="Improvement_TechFreshWaterYieldChanges">
<Column name="ImprovementType" type="text" reference="Improvements(Type)"/>
<Column name="TechType" type="text" reference="Technologies(Type)"/>
<Column name="YieldType" type="text" reference="Yields(Type)"/>
<Column name="Yield" type="integer"/>
</Table>
<!-- Table data -->


And here are the changes I made to the XML for Improvements and Builds (I wanted citadels to be able to be built on atolls, because I wanted to also change the great admiral to be able to construct them):
Spoiler :
<Improvements>
<Row>
<Type>IMPROVEMENT_CITADEL</Type>
<Description>TXT_KEY_IMPROVEMENT_CITADEL</Description>
<Civilopedia>TXT_KEY_CIV5_IMPROVEMENTS_CITADEL_TEXT</Civilopedia>
<ArtDefineTag>ART_DEF_IMPROVEMENT_CITADEL</ArtDefineTag>
<BuildableOnResources>true</BuildableOnResources>
<DefenseModifier>100</DefenseModifier>
<CreatedByGreatPerson>true</CreatedByGreatPerson>
<NearbyEnemyDamage>3</NearbyEnemyDamage>
<PortraitIndex>35</PortraitIndex>
<IconAtlas>TERRAIN_ATLAS</IconAtlas>
<YieldType>YIELD_PRODUCTION</YieldType>
<Yield>2</Yield>
<CityLoad>true</CityLoad>
<Water>true</Water>
<SpecialCargo>SPECIALUNIT_MISSILE</SpecialCargo>
<DomainCargo>DOMAIN_AIR</DomainCargo>
</Row>
<Update>
<Set SpecialCargo="SPECIALUNIT_MISSILE, SPECIALUNIT_FIGHTER"/>
<Set DomainCargo="DOMAIN_AIR"/>
<Set YieldType="YIELD_PRODUCTION"/>
<Set CityLoad="true"/>
<Set Yield="2"/>
<Where Type="IMPROVEMENT_CITADEL"/>
</Update>
<Update>
<Set SpecialCargo="SPECIALUNIT_MISSILE, SPECIALUNIT_FIGHTER"/>
<Set DomainCargo="DOMAIN_AIR"/>
<Set YieldType="YIELD_PRODUCTION"/>
<Set CityLoad="true"/>
<Set Yield="1"/>
<Where Type="IMPROVEMENT_FORT"/>
</Update>
<Update>
<Set Water="true"/>
<Where Type="IMPROVEMENT_CITADEL"/>
</Update>
</Improvements>
<Builds>
<Row>
<BuildType>BUILD_CITADEL</BuildType>
<FeatureType>FEATURE_ATOLL/</FeatureType>
<PrereqTech>TECH_SAILING</PrereqTech>
<Remove>true</Remove>
</Row>
<Update>
<Set FeatureType="FEATURE_ATOLL"/>
<Set PrereqTech="SAILING"/>
<Where BuildType="BUILD_CITADEL" FeatureType="FEATURE_JUNGLE"/>
</Update>
</Builds>
</GameData>


Lastly, I tried to create a SQL file to make a great admiral have the BUILD_CITADEL build like the great general. MY knowledge of SQL is horrible and so this is the only thing I could think of, and help would be greatly appreciated!:
Spoiler :
- GREAT_ADMIRAL
INSERT INTO "main"."Unit_Builds" ("UnitType","BuildType") VALUES ('UNIT_GREAT_ADMIRAL','BUILD_CITADEL')
INSERT INTO "Unit_Builds" (UNIT_GREAT_ADMIRAL,BUILD_CITADEL)
INSERT INTO Unit_Builds ["UnitType", "BuildType"] VALUES("29", "UNIT_GREAT_ADMIRAL", "BUILD_CITADEL")



As you can see, I tried to add great admiral to the Unit_Builds table and have it be able to use the construct citadel option (on an atoll referenced earlier). But again, this was to no avail.

Anything that anyone can help is welcome. Even if its just pointing to a good guide, etc. I tried kael's guide but it mentioned little on unit/improvement modification.

Thanks again! :D
 
Moderator Action: Thread moved, only tutorials or finished files in the subforums please.
 
INSERT INTO "main"."Unit_Builds"

What is main? and as far as I am aware with SQL you can not insert into two(main & Unit_Builds) rows at once the way you are trying. Id remove the bit underlined and try again. Actualy you whole SQL part is a mess, [] instead of () and "" where there should be none or ' ' instead of " ", you only need to add one line of code, why are you attempting to add the same thing 3 times? And tbh if you cant use SQL stick to XML :) or read SQL guide here on the forums.

INSERT INTO Unit_Builds ('UnitType', 'BuildType')
SELECT 'UNIT_GREAT_ADMIRAL', 'BUILD_CITADEL';

Edit:

Re reading this now, sounds like im been harsh, soz for that was first thing in the morning.
 
Spoiler :
INSERT INTO Unit_Builds (UnitType,BuildType)
SELECT ('Unit_Builds_Great_Admiral')
INSERT VALUES ('UNIT_GREAT_ADMIRAL','BUILD_CITADEL')
FROM Unit_Builds WHERE (Type = 'Unit_Builds_Great_Admiral');


Thanks for your reply Horem, sorry I got back so late. I've decided to give this another go. I don't have much modding skill at all, but I want to get better. There was no offense taken at all, I thank you so much for trying to help!

I tried re-writing the SQL based on the links you posted. Does this make more sense now?
I would also much rather stick to XML, but it seems that to add a new build type to a unit I think I might need to use SQL, right? Do I also need LUA to add in a new button for this build?

Thanks again, I'm trying to get this mod working.
 
I personally prefer SQL, but you could use straight XML for what you're doing (i.e., as long as you're not trying to add new columns as described in this and your other recent thread). As explained by PawelS in the other thread, it's not going to actually do anything without some LUA or C++, but you can add a column with SQL like so:
Code:
ALTER TABLE Improvements ADD COLUMN 'SpecialCargo' TEXT DEFAULT NULL;

As far as the SQL you included in your last post, you're combining selects and inserts improperly. You just want:
Code:
INSERT INTO Unit_Builds(UnitType, BuildType)
    VALUES ('UNIT_GREAT_ADMIRAL', 'BUILD_CITADEL');

I guess you could do XML instead (you were updating "Builds" instead of "Unit_Builds"):
Code:
<GameData>
  <Unit_Builds>
    <Row>
      <UnitType>UNIT_GREAT_ADMIRAL</UnitType>
      <BuildType>BUILD_CITADEL</BuildType>
    </Row>
  </Unit_Builds>
</GameData>
I'm not sure if you'll need LUA or C++ to add the button.

EDIT:
Glancing through the Improvements table, you'll definitely need to make a copy of the citadel so you can set the 'Water' column to 1 in Improvements, but that means you need a new Build. You'll need to change the Atoll feature to NoImprovement = 0. I'm pretty sure you'll need an entry in BuildFeatures. That's only the stuff I could think of. Here's some SQL for that much, at least:

Code:
INSERT INTO Improvements ('Type', 'Description', 'Civilopedia', 'Help', 'ArtDefineTag', 'WorldSoundscapeAudioScript', 'ImprovementPillage', 'ImprovementUpgrade', 'SpecificCivRequired', 'CivilizationType', 'HillsMakeValid', 'FreshWaterMakesValid', 'RiverSideMakesValid', 'NoFreshWater', 'RequiresFlatlands', 'RequiresFlatlandsOrFreshWater', 'RequiresFeature', 'Coastal', 'Water', 'DestroyedWhenPillaged', 'BuildableOnResources', 'BarbarianCamp', 'Goody', 'Permanent', 'OutsideBorders', 'GraphicalOnly', 'CreatedByGreatPerson', 'Culture', 'CultureAdjacentSameType', 'TilesPerGoody', 'GoodyRange', 'FeatureGrowth', 'UpgradeTime', 'RiverSideUpgradeMod', 'CoastalLandUpgradeMod', 'HillsUpgradeMod', 'FreshWaterUpgradeMod', 'DefenseModifier', 'NearbyEnemyDamage', 'PillageGold', 'ResourceExtractionMod', 'GoldMaintenance', 'PortraitIndex', 'IconAtlas')
	SELECT	('IMPROVEMENT_CITADEL_SEA'), 'Description', 'Civilopedia', 'Help', 'ArtDefineTag', 'WorldSoundscapeAudioScript', 'ImprovementPillage', 'ImprovementUpgrade', 'SpecificCivRequired', 'CivilizationType', 'HillsMakeValid', 'FreshWaterMakesValid', 'RiverSideMakesValid', 'NoFreshWater', 'RequiresFlatlands', 'RequiresFlatlandsOrFreshWater', 'RequiresFeature', 'Coastal',
		(1), 'DestroyedWhenPillaged', 'BuildableOnResources', 'BarbarianCamp', 'Goody', 'Permanent', 'OutsideBorders', 'GraphicalOnly', 'CreatedByGreatPerson', 'Culture', 'CultureAdjacentSameType', 'TilesPerGoody', 'GoodyRange', 'FeatureGrowth', 'UpgradeTime', 'RiverSideUpgradeMod', 'CoastalLandUpgradeMod', 'HillsUpgradeMod', 'FreshWaterUpgradeMod', 'DefenseModifier', 'NearbyEnemyDamage', 'PillageGold', 'ResourceExtractionMod', 'GoldMaintenance', 'PortraitIndex', 'IconAtlas'
	FROM Improvements WHERE Type = 'IMPROVEMENT_CITADEL';
INSERT INTO Builds('Type', 'Description', 'Help', 'DisabledHelp', 'Recommendation', 'HotKey', 'HotKeyAlt', 'HotKeyPriority', 'HotKeyPriorityAlt', 'OrderPriority', 'AltDown', 'AltDownAlt', 'ShiftDown', 'ShiftDownAlt', 'CtrlDown', 'CtrlDownAlt', 'Time', 'Cost', 'CostIncreasePerImprovement', 'Kill', 'Repair', 'RemoveRoute', 'PrereqTech', 'ImprovementType', 'RouteType', 'EntityEvent', 'IconIndex', 'IconAtlas')
	SELECT	('BUILD_CITADEL_SEA'), 'Description', 'Help', 'DisabledHelp', 'Recommendation', 'HotKey', 'HotKeyAlt', 'HotKeyPriority', 'HotKeyPriorityAlt', 'OrderPriority', 'AltDown', 'AltDownAlt', 'ShiftDown', 'ShiftDownAlt', 'CtrlDown', 'CtrlDownAlt', 'Time', 'Cost', 'CostIncreasePerImprovement', 'Kill', 'Repair', 'RemoveRoute', 'PrereqTech',
		('IMPROVEMENT_CITADEL_SEA'), 'RouteType', 'EntityEvent', 'IconIndex', 'IconAtlas'
	FROM Builds WHERE Type = 'BUILD_CITADEL';

UPDATE Features SET NoImprovement = 0 WHERE Type = 'FEATURE_ATOLL';
INSERT INTO BuildFeatures VALUES('BUILD_CITADEL_SEA','FEATURE_ATOLL',NULL,NULL,0,0,0);

Good luck!
 
I personally prefer SQL, but you could use straight XML for what you're doing (i.e., as long as you're not trying to add new columns as described in this and your other recent thread). As explained by PawelS in the other thread, it's not going to actually do anything without some LUA or C++, but you can add a column with SQL like so:
Code:
ALTER TABLE Improvements ADD COLUMN 'SpecialCargo' TEXT DEFAULT NULL;

As far as the SQL you included in your last post, you're combining selects and inserts improperly. You just want:
Code:
INSERT INTO Unit_Builds(UnitType, BuildType)
    VALUES ('UNIT_GREAT_ADMIRAL', 'BUILD_CITADEL');

I guess you could do XML instead (you were updating "Builds" instead of "Unit_Builds"):
Code:
<GameData>
  <Unit_Builds>
    <Row>
      <UnitType>UNIT_GREAT_ADMIRAL</UnitType>
      <BuildType>BUILD_CITADEL</BuildType>
    </Row>
  </Unit_Builds>
</GameData>
I'm not sure if you'll need LUA or C++ to add the button or enable you to build citadels on water terrain.

Thanks Nutty! I made the changes that you kindly posted.

So if I understand correctly, I should only use that line of SQL you posted, which should give Great Admiral the ability to build a citadel?

With respect to the column entry, even if it's created by SQL, could I effectively reference it in the Improvements table? For example, could I then add SpecialCargo value to a new row?

Thanks so much!
 
Note I added an edit to the end of my previous post.

I have no idea whether it will actually work [EDIT: I suspect not], but my suggestions would certainly be the bare minimum of what's required.

If you add a new column, it's really there, and you can add values to it [EDIT: through XML if you want], but the game will ignore it. You might as well create a new table instead.
 
Sorry to be dragging this on, but I edited my mod and again it provided no results.

I tried stepping back and making a new mod which is much simpler. It contains one xml file and the code is:
Spoiler :
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 11/14/2012 7:47:15 PM -->
<GameData>
<Improvement_Yields>
<Row>
<ImprovementType>IMPROVEMENT_CITADEL</ImprovementType>
<YieldType>YIELD_PRODUCTION</YieldType>
<Yield>5</Yield>
</Row>
</Improvement_Yields>
</GameData>


I added production yield to citadel and made it 5 hammers. Yet when I load this mod, again there is no effect whatsoever. I checked the database log and it reports nothing. I know this must be an obvious mistake, but it seems to me that I am missing a very crucial step, because my mod seems to not even be modifying the game whatsoever.

Any insight on this Nutty?

(PS Thanks again for you help, I know it must be tiresome to answer these baby questions!)
 
Yes, still that doesn't seem to be the issue. I was able to modify the yields for the citadel and fort, but still no success in making citadels into air bases. Basically, I'm having issues trying to add new entries to existing rows. I can't update, because the entries aren't present in the default rows. So I want to add entirely new values to them. So far, this is what I could do:

Spoiler :
<GameData>
<Improvements>
<Row>
<Type>IMPROVEMENT_CITADEL</Type>
<Description>TXT_KEY_IMPROVEMENT_CITADEL</Description>
<Civilopedia>TXT_KEY_CIV5_IMPROVEMENTS_CITADEL_TEXT</Civilopedia>
<ArtDefineTag>ART_DEF_IMPROVEMENT_CITADEL</ArtDefineTag>
<BuildableOnResources>false</BuildableOnResources>
<DefenseModifier>100</DefenseModifier>
<CreatedByGreatPerson>true</CreatedByGreatPerson>
<NearbyEnemyDamage>3</NearbyEnemyDamage>
<PortraitIndex>35</PortraitIndex>
<IconAtlas>TERRAIN_ATLAS</IconAtlas>
<YieldType>YIELD_PRODUCTION</YieldType>
<Yield>10</Yield>
<CityLoad>true</CityLoad>
<Water>true</Water>
<SpecialCargo>SPECIALUNIT_MISSILE</SpecialCargo>
<DomainCargo>DOMAIN_AIR</DomainCargo>
</Row>
</Improvements>
</GameData>


This xml doesn't provide what I had in mind though, I imagine the reason is that the engine isn't accepting the new entries. I also tried deleting Improvements_Citadels altogether, and then adding the new Improvements_Citadels, but in game the general was able to make a citadel that didn't have any graphics or text *SIGH*.

Any ideas as to how I can modify the existing /Improvement_Citadel entry with new values (DomainCargo, SpecialCargo, water, CityLoad) that will work?

P.S: I also tried your SQL line while also updating Citadel to the new columns, but to no avail either. :(
 
OK, you have 2 different mods that affect citadels here, so let's separate them.

Let's not worry about whether your airbases work in-game (as stated, it won't without some LUA or C++ [EDIT: and I believe the airbase idea is quite a bit more ambitious]). What do your database.log and xml.log say? Look at your Civ5DebugDatabase and see if the new columns are there.

It may be that you have to change the order of your UpdateDatabase entries so the SQL column add goes before the XML.
 
You can check if your logging is working at all - make an obvious XML mistake in a file and try to load it in game, then check the database log file - if it doesn't yell at you, logging is disabled or the file is not being loaded in the first place.
 
Just from a quick glance a the XML, since you're editing existing improvements with the things like changing citadel production to 5 hammers, shouldn't you be using <Update></Update> tags instead of <Row></Row> tags? I seem to remember <Row> adds a new entry to the DB, whereas <Update> changes existing ones.
 
You can check if your logging is working at all - make an obvious XML mistake in a file and try to load it in game, then check the database log file - if it doesn't yell at you, logging is disabled or the file is not being loaded in the first place.

The error will only be in database.log if the xml is well-formed but the table/column name(s) are invalid. If the xml is not well formed (eg you've not closed a tag) the error will be in xml.log
 
Just from a quick glance a the XML, since you're editing existing improvements with the things like changing citadel production to 5 hammers, shouldn't you be using <Update></Update> tags instead of <Row></Row> tags? I seem to remember <Row> adds a new entry to the DB, whereas <Update> changes existing ones.

The problem is that Improvements_Citadel doesn't have a yields entry. I was able to add productions through Improvement_Yields Instead.

My database logs said this:
Spoiler :
[348978.261] no such table: ContentPackage.LocalizedText
[348985.593] no such table: ContentPackage.LocalizedText
[348996.731] near "(": syntax error
[348996.731] no such column: DomainCargo
[348996.731] Database::XMLSerializer (XML/Update Improvements.xml): Duplicate <Set> elements are not allowed.
[348996.731] Database::XMLSerializer (XML/Builds.xml): 'Row' or 'Delete' expected, got 'BuildFeatures'.
[348996.731] Database::XMLSerializer (XML/Unit Builds.xml): 'Row' or 'Delete' expected, got 'Unit_Builds'.
[348996.731] table Improvements has no column named YieldType
[348996.731] In Query - insert into Improvements('Type', 'Description', 'Civilopedia', 'ArtDefineTag', 'BuildableOnResources', 'DefenseModifier', 'CreatedByGreatPerson', 'NearbyEnemyDamage', 'PortraitIndex', 'IconAtlas', 'YieldType', 'Yield', 'CityLoad', 'Water', 'SpecialCargo', 'DomainCargo') values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
[348996.731] In XMLSerializer while updating table Improvements from file XML/Improvements.xml.
[349011.380] Validating Foreign Key Constraints...
[349011.380] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[349011.380] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[349011.380] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[349012.488] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_HITTITE_WARCHARIOT" does not exist in Units
[349012.488] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_SUMERIAN_PHALANX" does not exist in Units
[349012.488] Failed Validation.
[349012.909]


Far as I can tell, DomainCargo is not being registered as a column, and three of my xml's are also having issues. The Improvements xml is completely flawed, logs tell me to insert queries for everything, but I thought I had already done so? "SPECIAL" seems to also be an issue, although I don't know what this is referring to.

These are my xml files so far:

Builds:
Spoiler :
<GameData>
<Builds>
<BuildFeatures>
<Row>
<BuildType>BUILD_CITADEL</BuildType>
<FeatureType>FEATURE_ATOLL/</FeatureType>
<Remove>true</Remove>
</Row>
</BuildFeatures>
</Builds>
</GameData>


Improvements:
Spoiler :
<GameData>
<Improvements>
<Update>
<Set SpecialCargo="SPECIALUNIT_FIGHTER"/>
<Set DomainCargo="DOMAIN_AIR"/>
<Set YieldType="YIELD_PRODUCTION"/>
<Set CityLoad="true"/>
<Set Yield="2"/>
<Set BuildableOnResources="false"/>
<Set Water="true"/>
<Where Type="IMPROVEMENT_CITADEL"/>
</Update>
<Update>
<Set SpecialCargo="SPECIALUNIT_FIGHTER"/>
<Set DomainCargo="DOMAIN_AIR"/>
<Set YieldType="YIELD_PRODUCTION"/>
<Set CityLoad="true"/>
<Set Yield="1"/>
<Where Type="IMPROVEMENT_FORT"/>
</Update>
</Improvements>
</GameData>


Improvements 2:
Spoiler :
<GameData>
<Improvements>
<Row>
<Type>IMPROVEMENT_CITADEL</Type>
<Description>TXT_KEY_IMPROVEMENT_CITADEL</Description>
<Civilopedia>TXT_KEY_CIV5_IMPROVEMENTS_CITADEL_TEXT</Civilopedia>
<ArtDefineTag>ART_DEF_IMPROVEMENT_CITADEL</ArtDefineTag>
<BuildableOnResources>false</BuildableOnResources>
<DefenseModifier>100</DefenseModifier>
<CreatedByGreatPerson>true</CreatedByGreatPerson>
<NearbyEnemyDamage>3</NearbyEnemyDamage>
<PortraitIndex>35</PortraitIndex>
<IconAtlas>TERRAIN_ATLAS</IconAtlas>
<YieldType>YIELD_PRODUCTION</YieldType>
<Yield>10</Yield>
<CityLoad>true</CityLoad>
<Water>true</Water>
<SpecialCargo>SPECIALUNIT_MISSILE</SpecialCargo>
<DomainCargo>DOMAIN_AIR</DomainCargo>
</Row>
</Improvements>
</GameData>


Improvement_Yields seems to be working fine, and Unit_builds into which I added citadel build to great admiral is also not working either. It seems the tables are not being built by SQL...
 
<FeatureType>FEATURE_ATOLL/</FeatureType>
Should be: <FeatureType>FEATURE_ATOLL</FeatureType>
Code:
<GameData>
<Improvements>
<Update>
<Set SpecialCargo="SPECIALUNIT_FIGHTER"/>
<Set DomainCargo="DOMAIN_AIR"/>
<Set YieldType="YIELD_PRODUCTION"/>
<Set CityLoad="true"/>
<Set Yield="2"/>
<Set BuildableOnResources="false"/>
<Set Water="true"/>
<Where Type="IMPROVEMENT_CITADEL"/>
</Update>
<Update>
<Set SpecialCargo="SPECIALUNIT_FIGHTER"/>
<Set DomainCargo="DOMAIN_AIR"/>
<Set YieldType="YIELD_PRODUCTION"/>
<Set CityLoad="true"/>
<Set Yield="1"/>
<Where Type="IMPROVEMENT_FORT"/>
</Update>
</Improvements>
</GameData>

You can not have multiple Set's in one update like this, you have to do it like so:-
Code:
<GameData>	
	<Improvements>
		<Update>
			<Set SpecialCargo="SPECIALUNIT_FIGHTER" DomainCargo="DOMAIN_AIR" YieldType="YIELD_PRODUCTION" CityLoad="true" Yield="2" BuildableOnResources="false" Water="true"/>
			<Where Type="IMPROVEMENT_CITADEL"/>
		</Update>
		<Update>
			<Set SpecialCargo="SPECIALUNIT_FIGHTER" DomainCargo="DOMAIN_AIR" YieldType="YIELD_PRODUCTION" CityLoad="true" Yield="1"/>
			<Where Type="IMPROVEMENT_FORT"/>
		</Update>
	</Improvements>
</GameData>

Can not see anything wrong with improvements 2, unless you have both improvements and improvements 2 code in the same xml, that would cause an issue with 2 <GameData>
 
Thank you, yes I spotted that error too. I tried lastly to forget xml and do everything by sql.
These are the files I have thus far:

Spoiler :
New Columns:

ALTER TABLE Improvements ADD COLUMN SpecialCargo TEXT 0 NULL,
DomainCargo TEXT DEFAULT NULL GO


Atoll becomes improvement friendly:

UPDATE Features
SET NoImprovement='0'
WHERE Type='FEATURE_ATOLL'


Citadel Buildable on water:

UPDATE Builds
SET Water='1'
WHERE Type='BUILD_CITADEL'

Citadel Buildable on water (through improvements table):

UPDATE Improvements
SET Water='1'
WHERE type='IMPROVEMENT_CITADEL'

Citadel Buildable on coast:

INSERT INTO Improvements_ValidTerrains (ImprovementType, TerrainType) VALUES ('IMPROVEMENT_CITADEL', 'TERRAIN_COAST')

Citadel valid on atoll:

INSERT INTO Improvements_ValidFeatures (ImprovementType, FeatureType) VALUES ('IMPROVEMENT_CITADEL', 'FEATURE_ATOLL')


Citadel becomes buildable on atoll:

INSERT INTO BuildFeatures (BuildType, FeatureType, PrereqTech, Time, Production, Cost, Remove) VALUES ('BUILD_CITADEL', 'FEATURE_ATOLL', 'TECH_SAILING', '300', '0', '0', '1')


Citadel can host air units:

UPDATE Improvements
SET DomainCargo='DOMAIN_AIR', SpecialCargo='SPECIALUNIT_FIGHTER'
WHERE Type='IMPROVEMENT_CITADEL'


Admiral can construct citadel:

INSERT INTO Unit_Builds (UnitType, BuildType) VALUES ('UNIT_GREAT_ADMIRAL', 'BUILD_CITADEL');

Citadel Yield:

INSERT INTO Improvement_Yields (ImprovementType, YieldType, Yield) VALUES ('IMPROVEMENT_CITADEL', 'YIELD_PRODUCTION', '2')

Fort Yield:

INSERT INTO Improvement_Yields (ImprovementType, YieldType, Yield) VALUES ('IMPROVEMENT_FORT', 'YIELD_PRODUCTION', '1')


However, in game the general is not able to construct the citadel at all! The civopedia shows correct yields for citadel, though it does not remark atolls or coasts as build friendly. Neither could I yet make the admiral build the citadel.

Logs display this:

Spoiler :
[359187.918] near "0": syntax error
[359187.918] no such column: DomainCargo
[359188.823] no such table: Improvements_ValidTerrains


It seems that the SQL tables of Improvements_validterrains and Improvements_validfeatures are not being recognized. DomainCargo is neither being added to the Improvements table.

Any clues guys?
 
The log is telling you the very first statement is invalid. Did you mean to put "TEXT DEFAULT '0'" OR MAYBE "INTEGER DEFAULT 0"?

You can only add one column per statement:
Code:
ALTER TABLE Improvements ADD COLUMN SpecialCargo INTEGER DEFAULT 0;
ALTER TABLE Improvements ADD COLUMN DomainCargo INTEGER DEFAULT 0;

The biggie, though, is the missing semicolon terminators everywhere. I liked the GO terminator you picked up somewhere. That's not used by SQLite.

I assume your comments were added after the fact. You can include them with "--".

EDIT:
Spoiler :
Code:
--New Columns:
ALTER TABLE Improvements ADD COLUMN SpecialCargo INTEGER DEFAULT 0;
ALTER TABLE Improvements ADD COLUMN DomainCargo INTEGER DEFAULT 0;

--Atoll becomes improvement friendly:
UPDATE Features
SET NoImprovement=0
WHERE Type='FEATURE_ATOLL';

--Citadel Buildable on water:
--UPDATE Builds
--SET Water=1
--WHERE Type='BUILD_CITADEL';

--Citadel Buildable on water (through improvements table):
UPDATE Improvements
SET Water=1
WHERE type='IMPROVEMENT_CITADEL';

--Citadel Buildable on coast:
INSERT INTO Improvement_ValidTerrains (ImprovementType, TerrainType) VALUES ('IMPROVEMENT_CITADEL', 'TERRAIN_COAST');

--Citadel valid on atoll:
INSERT INTO Improvement_ValidFeatures (ImprovementType, FeatureType) VALUES ('IMPROVEMENT_CITADEL', 'FEATURE_ATOLL');

--Citadel becomes buildable on atoll:
INSERT INTO BuildFeatures (BuildType, FeatureType, PrereqTech, Time, Production, Cost, Remove) VALUES ('BUILD_CITADEL', 'FEATURE_ATOLL', 'TECH_SAILING', 300, 0, 0, 1);

--Citadel can host air units:
UPDATE Improvements
SET DomainCargo='DOMAIN_AIR', SpecialCargo='SPECIALUNIT_FIGHTER'
WHERE Type='IMPROVEMENT_CITADEL';

--Admiral can construct citadel:
INSERT INTO Unit_Builds (UnitType, BuildType) VALUES ('UNIT_GREAT_ADMIRAL', 'BUILD_CITADEL');

--Citadel Yield:
INSERT INTO Improvement_Yields (ImprovementType, YieldType, Yield) VALUES ('IMPROVEMENT_CITADEL', 'YIELD_PRODUCTION', 2);

--Fort Yield:
INSERT INTO Improvement_Yields (ImprovementType, YieldType, Yield) VALUES ('IMPROVEMENT_FORT', 'YIELD_PRODUCTION', 1);

EDIT #2: I just noticed... because you decided not to add a new kind of citadel, you're trying to make it so the citadel can ONLY be built on water [or is that just for testing purposes?]

EDIT #3: There's no Water column in Builds [so I commented out that bit].

EDIT #4: Oh, also, you don't want to quote your integers [it'll work, but it's bad form].
Note that I'm teaching myself (better) SQLite as I go in helping you. This is great!

EDIT #5: It's Improvement_ValidTerrains (no S).
You really need to actually look at the database (%userprofile%\Documents\My Games\Sid Meier's Civilization 5\cache\Civ5DebugDatabase.db) with a SQLite browser (SQLite Manager for Firefox or SQLite Administrator or SQLite Browser or SQLiteSpy) while the mod is running. You can compare it to the pre-mod database (%userprofile%\Documents\My Games\Sid Meier's Civilization 5\cache\Civ5CoreDatabase.db).
 
Thanks Nutty, how absolutely silly of me. Updating the codes now.

Also, I want to make the citadel buildable on water AND land as usual.

And there is a water column on Builds I can see in SQLite?

Will switching from TEXT to INTEGER have a significant difference? Would it still validate the columns?
 
Also, I want to make the citadel buildable on water AND land as usual.
As far as I'm aware, the water field is all-or-nothing, which is why I suggested adding a separate Sea Citadel.

And there is a water column on Builds I can see in SQLite?
The PC I'm using at the moment doesn't have G+K. Maybe it was added?

Will switching from TEXT to INTEGER have a significant difference? Would it still validate the columns?
Won't make a whit of difference, since those columns will be completely ignored either way. EDIT: SQLite uses dynamic typing, so the column's type is an "affinity" (more of a suggestion).
 
Top Bottom