1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Trouble with Updating Agendas - SQL/XML

Discussion in 'Mod Creation Help' started by Dude211212, May 17, 2019.

  1. Dude211212

    Dude211212 Chieftain

    Joined:
    Jan 16, 2019
    Messages:
    7
    Location:
    Florida
    Hello all.

    I can't get my mod to update the Agendas, through SQL or XML. I'm not sure what I'm doing wrong.

    I've been working for the past few months on adjusting the AI agendas and traits to make them more aggressive and domination victory focused. I edited the game files in Notepad++ and playtested, and now I'm trying to put those edits into two nice concise mods- 'Aggressive AI Traits' and 'Aggressive AI Agendas'.

    The 'Aggressive AI Agendas' changes themselves are not complicated; simply adding agenda traits and updating existing agenda's traits, descriptions, and what leaders they are assigned to. 'Aggressive AI Traits' works fine, however I am having great difficulty getting 'Aggressive AI Agendas' to work at all. I'm not familiar with SQL or XML, but I'm not a stranger to coding or modding in general and I've run out of ideas.

    Originally, I had one XML file that both updated and added agenda traits (AggressiveAIAgendasV1, which is in the zip). Everything runs with no errors, but when I boot the game there is no observable changes whatsoever (you can't see agendas traits in-game). After picking through it with a fine tooth comb for errorswithout success, I tried writing the update commands in SQL in a new document (AggressiveAIAgendasUpdates). It still doesn't work. Additionally, I don't have any errors in Database.log, ModBuddy, or during in-game testing.

    It seems that adding things works fine in XML, but updating simply does not register. I'm hoping I'm overlooking a simple syntax error or something similar.

    Spoiler Here is code snippets from the current XML file: :

    <!-- AggressiveAIAgendas -->
    <!-- Author: Dude211212 -->
    <!-- DateCreated: 5/16/2019 8:00:44 PM -->
    <GameData>
    <ExclusiveAgendas>
    <Row AgendaOne="AGENDA_BILLIONAIRE" AgendaTwo="AGENDA_MONEY_GRUBBER"/>
    <Row AgendaOne="AGENDA_CITY_PLANNER" AgendaTwo="AGENDA_INDUSTRIALIST"/>
    <Row AgendaOne="AGENDA_PATRON_OF_ARTS" AgendaTwo="AGENDA_TECHNOPHILE"/>
    <Row AgendaOne="AGENDA_BARBARIAN_LOVER" AgendaTwo="AGENDA_PILLAGER"/>
    <Row AgendaOne="AGENDA_CIVILIZED" AgendaTwo="AGENDA_IDEOLOGUE"/>
    <Row AgendaOne="AGENDA_DARWINIST" AgendaTwo="AGENDA_PARANOID"/>
    ...continues...
    </ExclusiveAgendas>

    <AgendaTraits>
    <Row AgendaType="AGENDA_BLACK_QUEEN" TraitType="TRAIT_AGENDA_ENJOYS_WAR"/>
    <Row AgendaType="AGENDA_BLACK_QUEEN" TraitType="TRAIT_AGENDA_PREFER_NUKES"/>
    <Row AgendaType="AGENDA_BLACK_QUEEN" TraitType="TRAIT_AGENDA_IGNORE_WARMONGERING"/>
    <Row AgendaType="AGENDA_BLACK_QUEEN" TraitType="TRAIT_AGENDA_MAURYA_EMPIRE"/>
    ...these four repeat for numerous agendas...
    </AgendaTraits>
    </GameData>


    Spoiler Here is code snippets from the current SQL file: :

    -- Aggressive AI Agendas
    -- Author: Dude211212
    -- DateCreated: 5/15/2019 8:22:51 PM
    --------------------------------------------------------------

    -- Historical-Agendas
    UPDATE HistoricalAgendas SET AgendaType = 'AGENDA_LORD_OF_MINES' WHERE LeaderType = 'LEADER_BARBAROSSA';
    UPDATE HistoricalAgendas SET AgendaType = 'AGENDA_BLACK_QUEEN' WHERE LeaderType = 'LEADER_CLEOPATRA';
    UPDATE HistoricalAgendas SET AgendaType = 'AGENDA_SAINT' WHERE LeaderType = 'LEADER_GANDHI';
    ...this continues for all leaders...

    -- Exclusive-Agendas
    UPDATE ExclusiveAgendas SET AgendaTwo = 'AGENDA_WONDER_ADVOCATE' WHERE AgendaOne = 'AGENDA_BLACK_QUEEN' AND AgendaTwo = 'AGENDA_GOSSIP';
    UPDATE ExclusiveAgendas SET AgendaTwo = 'AGENDA_GREAT_PERSON_ADVOCATE' WHERE AgendaOne = 'AGENDA_DELIAN_LEAGUE' AND AgendaTwo = 'AGENDA_CITY_STATE_ALLY';
    UPDATE ExclusiveAgendas SET AgendaTwo = 'AGENDA_CULTURED' WHERE AgendaOne = 'AGENDA_GREAT_PERSON_OBSESSED' AND AgendaTwo = 'AGENDA_GREAT_PERSON_ADVOCATE';
    UPDATE ExclusiveAgendas SET AgendaTwo = 'AGENDA_INDUSTRIALIST' WHERE AgendaOne = 'AGENDA_LORD_OF_MINES' AND AgendaTwo = 'AGENDA_MONEY_GRUBBER';

    -- Update-Traits
    UPDATE AgendaTraits SET TraitType = 'TRAIT_AGENDA_WONDER_OBSESSED' WHERE AgendaType = 'AGENDA_BLACK_QUEEN' AND TraitType='TRAIT_AGENDA_BLACK_QUEEN';
    UPDATE AgendaTraits SET TraitType = 'TRAIT_AGENDA_GREAT_PERSON_OBSESSED' WHERE AgendaType = 'AGENDA_DELIAN_LEAGUE' AND TraitType='TRAIT_AGENDA_DELIAN_LEAGUE';
    UPDATE AgendaTraits SET TraitType = 'TRAIT_AGENDA_PREFER_CULTURE' WHERE AgendaType = 'AGENDA_GREAT_PERSON_OBSESSED' AND TraitType='TRAIT_AGENDA_GREAT_PERSON_OBSESSED';
    UPDATE AgendaTraits SET TraitType = 'TRAIT_AGENDA_LORD_OF_MINES' WHERE AgendaType = 'AGENDA_BILLIONAIRE' AND TraitType='TRAIT_AGENDA_BILLIONAIRE';
    ...this continues for all used agendas...

    --Agenda Descriptions
    UPDATE Agendas SET Description = 'LOC_AGENDA_PILLAGER_DESCRIPTION' WHERE AgendaType = 'AGENDA_BARBARIAN_LOVER';
    UPDATE Agendas SET Description = 'LOC_TRAIT_AGENDA_PREFER_SAME_GOVERNMENT_DESCRIPTION' WHERE AgendaType = 'AGENDA_CIVILIZED';
    UPDATE Agendas SET Description = 'LOC_AGENDA_AIRPOWER_DESCRIPTION' WHERE AgendaType = 'AGENDA_NUKE_LOVER';
    UPDATE Agendas SET Description = 'LOC_AGENDA_IDEOLOGUE_DESCRIPTION' WHERE AgendaType = 'AGENDA_DEMAGOGUE';
    ...and so on for all agenda descriptions that need to change.


    Spoiler Here is code snippets from the original XML file: :

    <?xml version="1.0" encoding="utf-8"?>
    <!-- Aggressive AI Agendas -->
    <!-- Author: Dude211212 -->
    <!-- DateCreated: 5/5/2019 10:58:46 PM -->
    <GameInfo>

    <!-- Descriptions -->
    <Agendas>
    <Update>
    <Where AgendaType="AGENDA_BARBARIAN_LOVER" Name="LOC_AGENDA_BARBARIAN_LOVER_NAME" Description="LOC_AGENDA_BARBARIAN_LOVER_DESCRIPTION"/>
    <Set>
    <Description>"LOC_AGENDA_PILLAGER_DESCRIPTION"</Description>
    </Set>
    </Update>
    ...and so on, for all descriptions...
    </Agendas>

    <!-- Historical-Agendas -->
    <HistoricalAgendas>
    <Update>
    <!-- Base-Game -->
    <Where LeaderType="LEADER_BARBAROSSA" AgendaType="AGENDA_IRON_CROWN"/>
    <Set>
    <AgendaType>"AGENDA_LORD_OF_MINES"</AgendaType>
    </Set>
    </Update>
    <Update>

    <Where LeaderType="LEADER_CLEOPATRA" AgendaType="AGENDA_QUEEN_OF_NILE"/>
    <Set>
    <AgendaType>"AGENDA_BLACK_QUEEN"</AgendaType>
    </Set>
    </Update>
    ...and so on, for all leaders....
    <HistoricalAgendas>


    <!-- Update-Traits -->
    <AgendaTraits>
    <Update>
    <Where AgendaType="AGENDA_BLACK_QUEEN" TraitType="TRAIT_AGENDA_BLACK_QUEEN"/>
    <Set>
    <TraitType>"TRAIT_AGENDA_WONDER_OBSESSED"</TraitType>
    </Set>
    </Update>
    <Update>

    <Where AgendaType="AGENDA_DELIAN_LEAGUE" TraitType="TRAIT_AGENDA_DELIAN_LEAGUE"/>
    <Set>
    <TraitType>"TRAIT_AGENDA_GREAT_PERSON_OBSESSED"</TraitType>
    </Set>
    </Update>
    ...And so on, for all traits...
    <AgendaTraits>


    Any input would be appreciated. Attached is the zipped mod with the original XML file.
     

    Attached Files:

    Last edited: May 18, 2019
  2. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,085
    Location:
    Illinois, USA
    Nothing you've posted is a mod. It has a Modbuddy Project Solution file from a Modbuddy Project, but this is not a mod. A mod is created within modbuddy from the modbuddy project: when the mod is 'built' using the Build Solution or Build NameOfMod functions within the Modbuddy tool, a functioning version of the mod is generated and sent to the game's Mods folder at C:\Users\[UserNameGoesHere]\Documents\My Games\Sid Meier's Civilization VI\Mods.

    A mod has a modinfo file which contains all the instructions needed by the game to execute the code within the files of the mod. You have no modinfo file anywhere in what you've posted.
     
  3. Dude211212

    Dude211212 Chieftain

    Joined:
    Jan 16, 2019
    Messages:
    7
    Location:
    Florida
    My bad. I've updated the original post with the proper zipped mod, with the original V1 XML file included.
     
  4. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,085
    Location:
    Illinois, USA
    1. You have a Unique Constraint error in file AggressiveAIAgendas.xml

      Relevant Database.log message-chunk:
      Code:
      [3439883.759] [Gameplay] ERROR: UNIQUE constraint failed: ExclusiveAgendas.AgendaOne, ExclusiveAgendas.AgendaTwo
      [3439883.759] [Gameplay]: While executing - 'insert into ExclusiveAgendas('AgendaOne', 'AgendaTwo') values (?, ?);'
      [3439883.759] [Gameplay]: In XMLSerializer while inserting row into table insert into ExclusiveAgendas('AgendaOne', 'AgendaTwo') with  values (AGENDA_DESTINATION_CIV, AGENDA_CULTURED, ).
      [3439883.759] [Gameplay]: In XMLSerializer while updating table ExclusiveAgendas from file AggressiveAIAgendas.xml.
      [3439883.759] [Gameplay] ERROR: UNIQUE constraint failed: ExclusiveAgendas.AgendaOne, ExclusiveAgendas.AgendaTwo
      You have a second row here with identical data, which by rules of databases is not allowed:
      Code:
      <GameData>
      	<ExclusiveAgendas>
      		... snipped out lines ......
      		<Row AgendaOne="AGENDA_DESTINATION_CIV" AgendaTwo="AGENDA_CULTURED"/>
      		<Row AgendaOne="AGENDA_ZEALOT" AgendaTwo="AGENDA_DEVOUT"/>
      		<Row AgendaOne="AGENDA_SAINT" AgendaTwo="AGENDA_ZEALOT"/>
      		<Row AgendaOne="AGENDA_DESTINATION_CIV" AgendaTwo="AGENDA_CULTURED"/>
      		... snipped out lines ......
      	</ExclusiveAgendas>
      As soon as the game encounters this unique constraint error it ceases to read anything else from within file AggressiveAIAgendas.xml
    2. Eliminating this extra row cures any issues with your mod that I am able to see so far as the code being implemented into the game's Database is concerned. An quick examination of the relevant database tables via an SQlite Viewer program shows everything is getting updated properly by your mod so far as everything I quickly looked at was concerned.
    3. I think you also have a repeated UPDATE command in your SQL file, but this does not cause a Unique Constraint Error because a repeat of the exact same UPDATE command does not violate any of the rules of databases, it just causes the game to make the same alteration twice, with the same effect as if the exact same UPDATE were only applied once. Pretty sure you've commanded this one twice:
      Code:
      UPDATE HistoricalAgendas SET AgendaType = 'AGENDA_SUN_NEVER_SETS' WHERE LeaderType = 'LEADER_HARDRADA';
    4. You still have one remaining issue in that people who do not have the Poland DLC will not be able to use the mod since AGENDA_SAINT is only valid for people who have Poland/Jadwigga. A quick look through the other code for the vanilla expansion leaders didn't show any other of those issues but you may want to check which leaders are part of which DLC and which Agendas you are using that are part of those DLC so you can mark the mod as being dependant on those DLC as well as Gathering Storm
     
  5. Dude211212

    Dude211212 Chieftain

    Joined:
    Jan 16, 2019
    Messages:
    7
    Location:
    Florida
    Works like a dream! Absolutely outstanding. Can't believe I missed those lines. Thank you so much for your quick reply and continued help on these forums.

    Also, I intend to release a modular version of this mod for players without R&F, GS, and DLCs. I'll be sure to add the dependency tags for this one. This particular version is intended for a TSL Earth map in my next playthrough, where I'll playtest it over a marathon game. When it's thoroughly vetted I'll release the non-TSL optimized modular version.
     
    Last edited: May 19, 2019

Share This Page