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

[R&F] Updating GameParameters.xml via SQL

Discussion in 'Mod Creation Help' started by Question, Mar 15, 2018.

  1. Question

    Question King

    Joined:
    Mar 12, 2008
    Messages:
    945
    Im trying to change this :

    <Replace Name="RELIGION_SPREAD_ADJACENT_CITY_DISTANCE" Value="10"/>

    So I tried

    INSERT OR REPLACE INTO GlobalParameters (Name, Value)
    VALUES ( 'RELIGION_SPREAD_ADJACENT_CITY_DISTANCE', '15');

    But it doesnt appear to work ingame....any idea why?

    Database.log shows this :

    [751445.353] [Localization]: Input XML does not contain database entry tags. GameData, GameInfo or Database

    [751557.192] [Gameplay] ERROR: UNIQUE constraint failed: RequirementSetRequirements.RequirementSetId, RequirementSetRequirements.RequirementId

    But i dont think the second one is related, any idea on how to track down what is causing that? Im not sure where requirement set is...
     
  2. Laurana Kanan

    Laurana Kanan Don’t underestimate who I am.

    Joined:
    Apr 10, 2014
    Messages:
    2,687
    Gender:
    Female
    Location:
    Near the Greatest Snow on Earth
    Use:
    Code:
    UPDATE GlobalParameters
    SET    Value = 15
    WHERE  Name  = 'RELIGION_SPREAD_ADJACENT_CITY_DISTANCE';
    INSERT is for adding new data to a table, UPDATE is for updating data that already exists.
     
  3. Question

    Question King

    Joined:
    Mar 12, 2008
    Messages:
    945
    Thanks, will give that a try.

    Edit : I put it in an existing mod, loaded a save game, but saw no changes...
     
    Last edited: Mar 16, 2018
  4. Laurana Kanan

    Laurana Kanan Don’t underestimate who I am.

    Joined:
    Apr 10, 2014
    Messages:
    2,687
    Gender:
    Female
    Location:
    Near the Greatest Snow on Earth
    It might not work with a .sav. Might need a new game to see the effect. In any event, the code is correct.
     
  5. Question

    Question King

    Joined:
    Mar 12, 2008
    Messages:
    945
    Alright, thanks.
     
  6. isau

    isau Deity

    Joined:
    Jan 15, 2007
    Messages:
    3,068
    Your INSERT OR REPLACE INTO code should work fine. Did you have a SQL error somewhere else in the file? Civ 6 will execute every line of code in linear order, top of the file to the bottom. If a prior line fails it will just never execute stuff at the bottom of the file.

    For what its worth UPDATE, INSERT OR REPLACE INTO, or just REPLACE INTO are all very similar commands that do virtually the same thing in a situation where a record already exists. If you know for sure that a record exists you can use UPDATE. But if you are ever on the fence in most situations UPDATE OR REPLACE INTO or just REPLACE INTO will do the same thing.

    Usually I stick to UPDATE for stuff I know exists, INSERT when specifically inserting something I created myself that for sure doesn't exist elsewhere in the database (e.g. a custom Modifier) and UPDATE OR REPLACE if there are questions about whether another mod might have added the same record.
     
  7. Question

    Question King

    Joined:
    Mar 12, 2008
    Messages:
    945
    I dont see any SQL errors related to that. I think its just that certain game parameters cannot be updated in game and you need to start a new one for it to work.
     

Share This Page