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

Culture Buildings - Vanilla and G&K cross-compatibility

Discussion in 'Civ5 - Modding Tutorials & Reference' started by whoward69, Jul 9, 2012.

  1. whoward69

    whoward69 DLL Minion

    May 30, 2011
    Near Portsmouth, UK
    You can create a single "Culture Building" mod that works with both "Vanilla 674/705" and "Gods and Kings" if 1) you're happy using sql and 2) you can accept one "Column does not exist" error in database.log

    Create three files, one for the main building data (UBDojo.xml below, but could be done with sql), one for the 674/705 culture value (UBDojo674.sql) and one for the G&K culture/faith yields (UBDojoGaK.sql)

    You cannot merge the two SQL files as the culture column does not exist in the G&K database so the resultant error will fail the entire file.

    You could include the main building data into the UBDojoGaK.sql file, but then you would have both common and G&K specific SQL statements in the same file, so I wouldn't recommend it from a maintainability point-of-view

    All three files need OnModActivated -> UpdateDatabase entries and the file with the common building data (UBDojo.xml below) MUST come first in the list


          <!-- Culture is set via SQL

    -- This has to be in its own file so the "no such column: Culture" error can be ignored by Gods and Kings
    UPDATE Buildings
      SET Culture=2
      AND EXISTS (SELECT Value FROM Defines WHERE Name='MAX_HIT_POINTS' AND Value=10);

    INSERT INTO Building_YieldChanges(BuildingType, YieldType, Yield)
      SELECT Type, 'YIELD_CULTURE', 2 FROM Buildings
        AND EXISTS (SELECT Value FROM Defines WHERE Name='MAX_HIT_POINTS' AND Value=100);
    There may be a "better" way of detecting "674/705" vs "G&K" but the number of hit-points a unit has does the trick.

    Also the EXISTS clause is not strictly necessary in the UBDojo674.sql file but it adds to the clarity of the statement and defends against another mod altering the Buildings table

Share This Page