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

[GS] Problem with increase technology mod

Discussion in 'Mod Creation Help' started by Bucho, May 18, 2020.

  1. Bucho

    Bucho Chieftain

    Joined:
    May 18, 2020
    Messages:
    3
    Hi everyone,

    Just a very casual modder with an issue I cannot find a solution.

    I reused some work from Alpaca around increasing cost for technologies/civics as eras passed by. After some try and test I managed to make it work as I wanted and increased all costs. However, for some reason, I cannot manage to increase the cost for Future Era technologies/civics. I've been trying many options, doing multiple online searches, played around with LoadOrder, but I cannot figure out why it doesn't work for Future Era.

    Any insight would be more than appreciated.

    Sample below of the part of the mod that has the entries to increase costs for technologies:

    UPDATE Technologies SET Cost = Cost*1 WHERE EraType ='ERA_ANCIENT';
    UPDATE Technologies SET Cost = Cost*1.1 WHERE EraType ='ERA_CLASSICAL';
    UPDATE Technologies SET Cost = Cost*1.2 WHERE EraType ='ERA_MEDIEVAL';
    UPDATE Technologies SET Cost = Cost*1.4 WHERE EraType ='ERA_RENAISSANCE';
    UPDATE Technologies SET Cost = Cost*1.7 WHERE EraType ='ERA_INDUSTRIAL';
    UPDATE Technologies SET Cost = Cost*2.1 WHERE EraType ='ERA_MODERN';
    UPDATE Technologies SET Cost = Cost*2.6 WHERE EraType ='ERA_ATOMIC';
    UPDATE Technologies SET Cost = Cost*3.1 WHERE EraType ='ERA_INFORMATION';
    UPDATE Technologies SET Cost = Cost*3.6 WHERE EraType ='ERA_FUTURE';


    The .modinfo is:

    <?xml version="1.0" encoding="utf-8"?>
    <Mod id="cc58cb64-7dde-4c26-90c1-6af61baadbd6" version="1">
    <Properties>
    <Name>SlowerByEra</Name>
    <Description>This is a brief description of the mod.</Description>
    <Created>1589299419</Created>
    <Teaser>This is a brief description of the mod.</Teaser>
    <Authors>Bucho</Authors>
    <CompatibleVersions>1.2,2.0</CompatibleVersions>
    </Properties>
    <Dependencies>
    <Mod id="4873eb62-8ccc-4574-b784-dda455e74e68" title="Expansion: Gathering Storm" />
    </Dependencies>
    <InGameActions>
    <UpdateDatabase id="SLOWER_BY_ERA">
    <Properties>
    <LoadOrder>-1</LoadOrder>
    </Properties>
    <File>SlowerByEra.sql</File>
    </UpdateDatabase>
    </InGameActions>
    <Files>
    <File>SlowerByEra.sql</File>
    </Files>
    </Mod>


    Help is much appreciated.

    Thanks
     
  2. Laurana Kanan

    Laurana Kanan Don’t underestimate who I am. Moderator

    Joined:
    Apr 10, 2014
    Messages:
    3,047
    Gender:
    Female
    Location:
    Near the Greatest Snow on Earth
    You need to increase costs for future era techs in the table TechnologyRandomCosts as well.
     
  3. Arstahd

    Arstahd Chieftain

    Joined:
    Apr 20, 2006
    Messages:
    81
    This reminded me that I needed to tackle this issue for my own mod. The costs for those techs and civics are in new tables, TechnologyRandomCosts and CivicRandomCosts. Here is what I ended up with.

    Code:
    --  Create dummy table for non-GS games
    CREATE TABLE IF NOT EXISTS TechnologyRandomCosts (TechnologyType VARCHAR, Cost INTEGER);
    --  Update random Tech costs
    UPDATE TechnologyRandomCosts SET Cost=Cost*2.8;
    
    --  Create dummy table for non-GS games
    CREATE TABLE IF NOT EXISTS CivicRandomCosts (TechnologyType VARCHAR, Cost INTEGER);
    --  Update random Civic costs
    UPDATE CivicRandomCosts SET Cost=Cost*2.8;
    
     
     
  4. Bucho

    Bucho Chieftain

    Joined:
    May 18, 2020
    Messages:
    3
    Thanks both. Will give it a try, though I'm struggling to get a quick start that already shows technologies/civics from Future Era to see if it works fine now...
     
  5. Laurana Kanan

    Laurana Kanan Don’t underestimate who I am. Moderator

    Joined:
    Apr 10, 2014
    Messages:
    3,047
    Gender:
    Female
    Location:
    Near the Greatest Snow on Earth
    If you add this to the end of your code it should reveal all Future techs from the start.
    Code:
    UPDATE Technologies_XP2 SET HiddenUntilPrereqComplete = 0 WHERE HiddenUntilPrereqComplete = 1;
     
    Bucho likes this.
  6. Bucho

    Bucho Chieftain

    Joined:
    May 18, 2020
    Messages:
    3
    Thanks Laurana! All working now
     
    Laurana Kanan likes this.
  7. alknicteos

    alknicteos Chieftain

    Joined:
    Oct 4, 2010
    Messages:
    14
    I had still problems with era changed tech/civic costs beginning with the banking tech. Does it still work for you from ERA_RENAISSANCE and beyond?
     
  8. Arstahd

    Arstahd Chieftain

    Joined:
    Apr 20, 2006
    Messages:
    81
    Mine works perfectly for all Techs and Civics in all versions. You must have an error or conflict somewhere. I see that you have LoadOrder is set to -1, I believe your edits are being overwritten by GS content.
     
  9. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    7,081
    Location:
    Illinois, USA
    Yes, a negative LoadOrder value will result in the code being over-written by the expansions. Negative LoadOrder numbers should only be used (like Firaxis does) for files that are defining new game-tables or are otherwise executing similar special processing command-chunks.

    Code that adds, alters, or deletes individual rows within game tables should always have a LoadOrder no lower than '0', and need a LoadOrder value greater than 0 in order to not be overwritten by or kill off the code loaded by the expansions.

    Firaxis is using LoadOrder values of "-100" in both expansions now to create the new tables those expansions add to the game, as well as to delete stuff not needed or wanted from the base game or the other expansion. But other than deleting conflicting contents from within some of the game tables, the code executed at these negative Load Order values does not fill in any information in the newly created tables.

    The data for new tables (and existing tables that were "cleaned" earlier) is done with the default LoadOrder value of '0'.
     
  10. alknicteos

    alknicteos Chieftain

    Joined:
    Oct 4, 2010
    Messages:
    14
    I guess, I think, I know, where the error was for me. Somehow, somewhere it caches the mods. ... had some days prior also a similar problem with a world builder map, I guess also caused through the caching. To reset it, change in the .modinfo the mod id, then switch it on (in game ) again in the mods.
     

Share This Page