Removing the 10% increase in Buildings production costs from patch?

spfun

King
Joined
Oct 8, 2010
Messages
655
Hey I would like to make 2 changes to a small mod I currently use ( that increases civic/tech cost )

First I'd like to revert the 10% increase in building costs from the patch, as a bonus i would like to play with changing builder charges by +1. China would go to 5 charges.

What would I have to input into the sql?
 
To update the cost of all non-wonder, non-Religious, and non-Palace buildings I think this should do
Code:
UPDATE Buildings SET Cost = Cost * .9 WHERE MaxWorldInstances = -1 AND MaxPlayerInstances = -1 AND InternalOnly = 0 AND EnabledByReligion = 0;
If you want the costs of religious buildings to also be adjusted use
Code:
UPDATE Buildings SET Cost = Cost * .9 WHERE MaxWorldInstances = -1 AND MaxPlayerInstances = -1 AND InternalOnly = 0;

To add a charge to builders in sql
Code:
UPDATE Units SET BuildCharges = BuildCharges + 1 WHERE UnitType = 'UNIT_BUILDER';
 
Last edited:
FYI: A 10% decrease after a 10% increase does not bring you back to the original cost.

100 * 1.1 * 0.9 = 99 not 100.
 
after a quick test I found the city buildings had decreased by a flat 9 production(quick speed) Ideally I'd like to leave them alone. The library building was reduced by a flat 9 as well. So something isn't right there, Possibly it took 10% of its base cost of 90, but on quick speed its 60, should be 6 instead of 9(54 production).

the builder charge works good however.
 
The costs shown in the civilopedia are never based upon your chosen gamespeed. They are based upon "standard" game speed with no modifiers applied.

The code does in fact give a Library cost of 54 hammers on quick speed.

To keep city center buildings from being affected all that should be needed is to alter to:
Code:
UPDATE Buildings SET Cost = Cost * .9 WHERE MaxWorldInstances = -1 AND MaxPlayerInstances = -1 AND InternalOnly = 0 AND EnabledByReligion = 0 AND PrereqDistrict != 'DISTRICT_CITY_CENTER';
or
Code:
UPDATE Buildings SET Cost = Cost * .9 WHERE MaxWorldInstances = -1 AND MaxPlayerInstances = -1 AND InternalOnly = 0 AND PrereqDistrict != 'DISTRICT_CITY_CENTER';
depending on which one you were using before.

As Olleus mentioned there will be rounding errors from X * 1.1 * .9 but the SQL method shown is far easier to deal with than individual UPDATE statements for each building and trying to remember exactly what the cost used to be before the last patch.
 
You could just divide by 1.1 (or multiply by 0.909) rather than multiplying by 0.9.

Btw, does anyone know how SQL deals with rounding in this game? I would have expected most things to be stored as ints (ie, tech costs, combat strengths, ect...) but this does not appear to always be the case. Sometimes I need to explicitly round, sometimes not.
 
If you look directly into the database after doing complex maths on an integer you'll see values in the database such as 81.8181818181 to whatver significant decimals the database displays (I can't remember how many it displays) but the game always does a rounding on these types of numbers if it needs to for purposes of in-game pop-ups and etc. So for example it rounded off the cost of a Library to 54 hammers in the UI but I did not try to check if it was actually using 54.0 or 54.27 internally.
 
I was incorrect in my limited testing, the costs were correct for quick speed, i don't know how made the mistake. I will input the new command to leave city center buildings at default.

Thanks again, big help.
 
Top Bottom