[help] Simple XML mod - logs say table is not in database

kaspergm

Deity
Joined
Aug 19, 2012
Messages
5,570
I'm trying to get started on Civ6 modding, and the game just doesn't want to cooporate with me. I tried to make a simple XML-mod for a start, but it doesn't work. Here's the code I made:

Spoiler :
Code:
<GameInfo>
   <UnitPromotionPrereqs>
       <Update>
           <Where UnitPromotion="PROMOTION_COMMANDO" PrereqUnitPromotion="PROMOTION_AMPHIBIOUS"/>
           <Set PrereqUnitPromotion="PROMOTION_TORTOISE"/>
       </Update>
       <Update>
           <Where UnitPromotion="PROMOTION_AMPHIBIOUS" PrereqUnitPromotion="PROMOTION_COMMANDO"/>
           <Set PrereqUnitPromotion="PROMOTION_BATTLECRY"/>
       </Update>
   </UnitPromotionPrereqs>
</GameInfo>

I set this to Update Database as a Front End action in ModBuddy. The game does try to update the database (I think), but it tells me there is no table called UnitPromotionPrereqs - see excerpt from database.log below.

Spoiler :
[Configuration] ERROR: no such table: UnitPromotionPrereqs
[2609565.909] [Configuration]: In Query - UPDATE UnitPromotionPrereqs SET "PrereqUnitPromotion" = ? WHERE "UnitPromotion" = ? AND "PrereqUnitPromotion" = ?;
[2609565.909] [Configuration] ERROR: Database::XMLSerializer (PromotionsMod.xml): There was an error executing the update statement! See Database.log for details.
[2609565.909] [Configuration]: In XMLSerializer while updating table UnitPromotionPrereqs from file PromotionsMod.xml.[2609565.909]


I don't understand this, because there is a table called exactly that when I look in the UnitPromotions file:

Spoiler :
Code:
    <UnitPromotionPrereqs>
       <!--Melee-->
       <Row UnitPromotion="PROMOTION_COMMANDO" PrereqUnitPromotion="PROMOTION_BATTLECRY"/>
       <Row UnitPromotion="PROMOTION_COMMANDO" PrereqUnitPromotion="PROMOTION_AMPHIBIOUS"/>

So ... what am I doing wrong? :confused: I used to get these things to work perfectly fine in Civ5.
 
Hey!

I might be completely wrong, but I think the problem here is syntax. If your code does not make sense to it, Civ 6 will often meltdown AS OF the instance when it tries to insert the incorrect code. So, if you are trying to update UnitPromotionPrereqs. and your code does not compute, the error will cascade from there, and the whole table will be omitted from the database, as well as, often, many subsequent tables.

Once again, I might be off here (I am by no means an expert), but it looks to me like you are conflating SQL and XML formats. When you are working through SQL, you don't need to use the following (SEE BOLDED):

<GameInfo>
<UnitPromotionPrereqs>
<Update>

<Where UnitPromotion="PROMOTION_COMMANDO" PrereqUnitPromotion="PROMOTION_AMPHIBIOUS"/>
<Set PrereqUnitPromotion="PROMOTION_TORTOISE"/>
</Update>
<Update>

<Where UnitPromotion="PROMOTION_AMPHIBIOUS" PrereqUnitPromotion="PROMOTION_COMMANDO"/>
<Set PrereqUnitPromotion="PROMOTION_BATTLECRY"/>
</Update>
</UnitPromotionPrereqs>
</GameInfo>


That's XML format. In SQL, you would simply say:

UPDATE UnitPromotionPrereqs SET PrereqUnitPromotion='PROMOTION_TORTOISE' WHERE UnitPromotion='PROMOTION_COMMANDO' AND PrereqUnitPromotion='PROMOTION_AMPHIBIOUS'

UPDATE UnitPromotionPrereqs SET PrereqUnitPromotion='PROMOTION_BATTLECRY' WHERE UnitPromotion='PROMOTION_AMPHIBIOUS' AND PrereqUnitPromotion='PROMOTION_COMMANDO'

Because of the syntax, the game is imploding. And watch your "" marks. in SQL, the convention is ' ', not " ".

Cheers!

(NOTE: I did not check whether the columns are correct, I will assume that they are).
 
I tried to make a simple XML-mod for a start
it looks to me like you are conflating SQL and XML formats
Code is legit. It's .xml and if file is .xml it should work. So where is the problem? Probably this:
I set this to Update Database as a Front End action in ModBuddy.
I used to code with Notepad++ and I never get into MOdBuddy but I suspect that setting it as FrontEnd is what causes the problem.
PrereqUnitPromotion table is not created before game starts (when Sean Bean starts to talk) so it does not exist when you call it because FrontEnd, I believe, is "executed" right after ticking mod enabled in the menu. I mean it allows for modding main menu (adding custom maps, rules, buttons, scenarios, etc.). Compiler knows that PrereqUnitPromotion should not exist at this time and returns an error.
Change to in-game action (or whatever it is called in ModBuddy - should be something simmilar) and see what happens.
 
Thanx for the feedback guys. I'll look into it later.

I do have one question: It seems like the game core file is written more in SQL than in XML this time around (if I'm not mistaken, I'm a complete noob when it comes to these things). Will that prevent me from editing the database with XML?
 
No. Database is edited with build-in-game-engine which understands both SQL and XML. Which one you'll use is only a matter of your preference.
 
I suspect that setting it as FrontEnd is what causes the problem.
PrereqUnitPromotion table is not created before game starts (when Sean Bean starts to talk) so it does not exist when you call it because FrontEnd, I believe, is "executed" right after ticking mod enabled in the menu. I mean it allows for modding main menu (adding custom maps, rules, buttons, scenarios, etc.). Compiler knows that PrereqUnitPromotion should not exist at this time and returns an error.
Change to in-game action (or whatever it is called in ModBuddy - should be something simmilar) and see what happens.
Just want to confirm that your suspicion was correct. Changing it from FrontEnd to InGame action made it all work perfectly. :thumbsup:
 
There are two databases for what we normally think of as "gameplay" tables: DebugConfiguration.sqlite and DebugGameplay.sqlite.

DebugGameplay.sqlite is the "In-Game" database and is the one to which Units, Unit-Promotions, etc., are sent. The actions for this database are Properties > In-GameActions > UpdateDatabase "Action" in Modbuddy or when creating the mod manually this in the modinfo file:
Code:
  <InGameActions>
    <UpdateDatabase id="Database_XML">
      <File>XML/Resource_Dependant_Buildings.xml</File>
      <File>XML/DummyResourceUnlockerBuildings.xml</File>
      <File>XML/Era_Buildings/Amenity_Buildings.xml</File>
      <File>XML/Era_Buildings/CoastalCityBuildings.xml</File>
      <File>XML/Era_Buildings/CulturalBuildings.xml</File>
      <File>XML/Era_Buildings/FoodBuildings.xml</File>
      <File>XML/Era_Buildings/Housing_Buildings.xml</File>
      <File>XML/Era_Buildings/ProductionBuildings.xml</File>
      <File>XML/Era_Buildings/ScienceBuildings.xml</File>
      <File>XML/Era_Buildings/Dummy_Era_LOCKERS.xml</File>
      <File>XML/PlotRecourceRequirementSets.xml</File>
    </UpdateDatabase>
  </InGameActions>
Icons and Text must be handled with seperate "action" types (they appear to have their own additional databases). See this for which tables are used in DebugGameplay.sqlite: C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization VI\Base\Assets\Gameplay\Data\Schema/01_GameplaySchema.sql

DebugConfiguration.sqlite is for "Front-End" actions such as definining players for the purposes of the game setup menus, and some of this info is also actually used within "gameplay" of the game. In ModBuddy use Properties > FrontEnd Actions > UpdateDatabase "Action" and same rules apply to needing a seperate "Action" type for Icons and Text that needs to show in the "front-end" of the game. See this for which tables are used in DebugConfiguration.sqlite: C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization VI\Base\Assets\Configuration\Data\Schema/AdditionalTables.sql
 
Top Bottom