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

Mod has no effect, please help (sql)

Discussion in 'Mod Creation Help' started by kaetzer, May 2, 2020.

  1. kaetzer

    kaetzer Chieftain

    Joined:
    Jul 31, 2013
    Messages:
    10
    Location:
    Northern Germany
    hello everyone

    having trouble getting this to work and have no idea what else to do
    I added dependencies: nothing
    added load order, high number: nothing
    switched from xml to sql: nothing
    checked the modding.log: no errors concerning this mod
    it should give the designated leaders a fixed hidden agenda, but they are all still random

    modinfo:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <Mod id="7e4a2cdc-3999-4083-a843-d840787c4900" version="1">
      <Properties>
        <Name>Custom Agendas</Name>
        <Description>no random hidden agendas</Description>
        <Created>1588367383</Created>
        <Teaser>no random hidden agendas</Teaser>
        <Authors>kaetzer</Authors>
        <CompatibleVersions>1.2,2.0</CompatibleVersions>
      </Properties>
      <Dependencies>
        <Mod id="4873eb62-8ccc-4574-b784-dda455e74e68" title="Expansion: Gathering Storm" />
        <Mod id="E2749E9A-8056-45CD-901B-C368C8E83DEB" title="DLC: Persia and Macedon Civilization Pack" />
        <Mod id="1B28771A-C749-434B-9053-D1380C553DE9" title="Expansion: Rise and Fall" />
      </Dependencies>
      <Files>
        <File>Agendas.sql</File>
      </Files>
      <UpdateDatabase id="Gameplay">
        <Properties>
          <LoadOrder>10000</LoadOrder>
        </Properties>
        <Items>
          <File>Agendas.sql</File>
        </Items>
      </UpdateDatabase>
    </Mod>
    sql:
    Code:
    INSERT INTO AgendaPreferredLeaders
                (LeaderType,                        AgendaType,                            PercentageChance)
    VALUES        ('LEADER_CHANDRAGUPTA',                'AGENDA_DARWINIST',                    100),
    VALUES        ('LEADER_CYRUS',                    'AGENDA_DARWINIST',                    100),
    VALUES        ('LEADER_GORGO',                    'AGENDA_DARWINIST',                    100),
    VALUES        ('LEADER_HARDRADA',                    'AGENDA_DARWINIST',                    100),
    VALUES        ('LEADER_TRAJAN',                    'AGENDA_DARWINIST',                    100);
    i looked at another mod for help, since my experience is VERY limited
    the mod had an sql with this inside: (excerpt)
    Code:
    INSERT INTO AgendaPreferredLeaders
                (LeaderType,                    AgendaType,                            PercentageChance)
    VALUES        ('LEADER_BARBAROSSA',            'AGENDA_IDEOLOGUE',                    25),
    i also tried 70% instead of 100% (like for ghandi's "nuke happy" trait)

    help would be awesome

    greetings
    kaetzer
     
  2. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    7,210
    Location:
    Illinois, USA
    You need
    Code:
    INSERT INTO AgendaPreferredLeaders
              (LeaderType,                        AgendaType,                            PercentageChance)
    VALUES    ('LEADER_CHANDRAGUPTA',                'AGENDA_DARWINIST',                    100),
              ('LEADER_CYRUS',                    'AGENDA_DARWINIST',                    100),
              ('LEADER_GORGO',                    'AGENDA_DARWINIST',                    100),
              ('LEADER_HARDRADA',                    'AGENDA_DARWINIST',                    100),
              ('LEADER_TRAJAN',                    'AGENDA_DARWINIST',                    100);
    Database.log is the place to look for coding errors.

    For SQL errors however you generally just get messages like
    Code:
    near INSERT: syntax error
    You then have to look at Modding.log to determine which SQL file was loading at or close to the same timestamp as the error message in Database.log because Database.log does not give a file reference for SQL files with errors.

    The default value for column "PercentageChance" in table "AgendaPreferredLeaders" is 100 and all entires into table "AgendaPreferredLeaders" for column "AgendaType" must reference to an entry in table "RandomAgendas". Your usage of AGENDA_DARWINIST is correct as far as referencing to an entry in the other table is concerned but there is a GameLimit of '3' for AGENDA_DARWINIST in table RandomAgendas:
    Code:
    AgendaType		GameLimit
    AGENDA_DARWINIST	3
    Also bear in mind that it is a "Preferred" Agenda, not a "guaranteed" agenda assignment -- it will only apply if all other rules for applying random agendas allow, including the GameLimit value.

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

    However, your real problem is that your modinfo file is not correct. The game does nothing with the code in your file because of this error in the modinfo file. This is also why you get no error messages anywhere.

    Your modinfo file needs to be:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <Mod id="7e4a2cdc-3999-4083-a843-d840787c4900" version="1">
      <Properties>
        <Name>Custom Agendas</Name>
        <Description>no random hidden agendas</Description>
        <Created>1588367383</Created>
        <Teaser>no random hidden agendas</Teaser>
        <Authors>kaetzer</Authors>
        <CompatibleVersions>1.2,2.0</CompatibleVersions>
      </Properties>
      <Dependencies>
        <Mod id="4873eb62-8ccc-4574-b784-dda455e74e68" title="Expansion: Gathering Storm" />
        <Mod id="E2749E9A-8056-45CD-901B-C368C8E83DEB" title="DLC: Persia and Macedon Civilization Pack" />
        <Mod id="1B28771A-C749-434B-9053-D1380C553DE9" title="Expansion: Rise and Fall" />
      </Dependencies>
      <Files>
        <File>Agendas.sql</File>
      </Files>
      <InGameActions>
            <UpdateDatabase id="Gameplay">
                <Properties>
                    <LoadOrder>10000</LoadOrder>
                </Properties>
                <File>Agendas.sql</File>
            </UpdateDatabase>
      </InGameActions>
    </Mod>
     
  3. kaetzer

    kaetzer Chieftain

    Joined:
    Jul 31, 2013
    Messages:
    10
    Location:
    Northern Germany
    thank you! i'll check everything you wrote and see what happens

    i actually had a mod related error in the database.log, but from another file
    i googled the error, and found it was because of a duplicate entry
    guess where i got the answer from? you, in a thread from january :D

    EDIT: i actually read about the limit of 3 for darwinist, but forgot...
     
  4. kaetzer

    kaetzer Chieftain

    Joined:
    Jul 31, 2013
    Messages:
    10
    Location:
    Northern Germany
    ok, i fixed everything you told me, thanks again, totally missed, that i had "VALUES" in front of every line in the sql...

    so far it seems to kinda work, as in: only the first AI in the diplomacy menu gets the assigned agenda, everyone else has no hidden agenda at all (those that didn't get an agenda assigned by the mod still have a random one)
    wierd, huh? :/
    no SQL errors in database.log

    new file:
    Code:
    INSERT INTO AgendaPreferredLeaders
                    (LeaderType,                        AgendaType)
    VALUES            ('LEADER_CYRUS',                    'AGENDA_DARWINIST'),
                    ('LEADER_GORGO',                    'AGENDA_DARWINIST'),
                    ('LEADER_HARDRADA',                    'AGENDA_DARWINIST'),
                    ('LEADER_CHANDRAGUPTA',                'AGENDA_EXPLOITATIVE'),
                    ('LEADER_TRAJAN',                    'AGENDA_PARANOID');
    
    in this case chandragupta (first in the ingame menu) was exploitative and the others had no hidden agenda
     
    Last edited: May 2, 2020
  5. kaetzer

    kaetzer Chieftain

    Joined:
    Jul 31, 2013
    Messages:
    10
    Location:
    Northern Germany
    I got it to work!

    I dialed the percentage down to 80% and suddenly everyone had a hidden agenda. But the ones who had "Darwinist" assigned to them got a random one
    The others had their correct agenda that had been assigned by the mod. Looks like i can't assign "Darwinist".
    Also, I couldn't assign "Paranoid" to Gorgo, even though I could not find any information on whether she can't get it.
     

Share This Page