Changing production cost (sql)

Joined
Jan 7, 2009
Messages
620
Say I wanted to increase production cost across the board, but in increasing increments. What variable would I define here? I think this can be done because the Gradual Research mod did something similar, only then it was used for techs. thanks
 
I think he means increasing with era, like how the techs in those mods were multiplied by progressively larger numbers as the era increased. So Ancient techs would multiply by 1.1, Classical by 1.2, and so on.

The short answer is that you can't do that nearly as easily with units. Techs have their era specifically given in their entries; Units only give the name of the tech they're linked to, which you can't easily put into a single-line SQL command. You could try keying it to unit cost or combat strength, but obviously that doesn't scale up nearly as consistently.
 
Hi!

An example from my mod Petroleum:

UPDATE Buildings SET Cost = Cost * 0.5 WHERE
( PrereqTech IN ( SELECT Type FROM Technologies WHERE Era = 'ERA_INDUSTRIAL' OR Era = 'ERA_MODERN' OR Era = 'ERA_FUTURE' )
AND Type in ( SELECT BuildingType FROM Building_YieldModifiers WHERE YieldType = 'YIELD_PRODUCTION' ) );

It is halving the costs of buildings from industrial era and beyond enhancing production yield.
 
Hi again. I tried puting this in for boosting building prodcution cost in sql:

UPDATE Buildings
SET 'COST' = Cost * 1.2
WHERE ( PrereqTech IN ( SELECT Type FROM Technologies WHERE Era = 'ERA ANCIENT' )

but it didn't work:(. Can someone point me in the right direction? Aslo, would this increase unit cost:

UPDATE Units
SET 'COST' = Cost * 1.5
WHERE ( PrereqTech IN ( SELECT Type FROM Technologies WHERE Era = 'ERA CLASSICAL)

And yeah I made one of these entries for all eras so the effect doesn't just dissappear. Thanks for the help
 
Since "Cost" is a field name, it is case sensitive. Also, you haven't closed the second set of parentheses and you need an underscore in the Era identifier. Try
Code:
UPDATE Buildings
SET Cost = Cost * 1.2
WHERE ( PrereqTech IN ( SELECT Type FROM Technologies WHERE Era = 'ERA_ANCIENT' ) )
Note also that there are some buildings which don't have any tech prereq too (e.g. the Monument)

And yes, a similar statement could be used to increase unit costs.
 
Ok so now I'm confused. I have this line

Code:
UPDATE Buildings
SET Cost = Cost * 1.2
WHERE ( PrereqTech IN ( SELECT Type FROM Technologies WHERE Era = 'ERA_ANCIENT' ) );

which works, but all others don't.

Here are the others

Spoiler :
Code:
UPDATE Buildings 
SET Cost = Cost * 12.3
WHERE ( PrereqTech IN ( SELECT Type FROM Technologies WHERE Era = 'ERA _NANOTECH' ) );

UPDATE Buildings 
SET Cost = Cost * 10.0
WHERE ( PrereqTech IN ( SELECT Type FROM Technologies WHERE Era = 'ERA _DIGITAL' ) );

UPDATE Buildings 
SET Cost = Cost * 8.2
WHERE ( PrereqTech IN ( SELECT Type FROM Technologies WHERE Era = 'ERA _MODERN' ) );

UPDATE Buildings 
SET Cost = Cost * 6.5
WHERE ( PrereqTech IN ( SELECT Type FROM Technologies WHERE Era = 'ERA _INDUSTRIAL' ) );

UPDATE Buildings 
SET Cost = Cost * 4.8
WHERE ( PrereqTech IN ( SELECT Type FROM Technologies WHERE Era = 'ERA _RENAISSANCE' ) );

UPDATE Buildings 
SET Cost = Cost * 3.2
WHERE ( PrereqTech IN ( SELECT Type FROM Technologies WHERE Era = 'ERA _MEDIEVAL' ) );

UPDATE Buildings 
SET Cost = Cost * 2.05
WHERE ( PrereqTech IN ( SELECT Type FROM Technologies WHERE Era = 'ERA _CLASSICAL' ) );

and
Code:
UPDATE Units
SET Cost = Cost * 8.0
WHERE ( PrereqTech IN ( SELECT Type FROM Technologies WHERE Era = 'ERA _NANOTECH' ) );

UPDATE Units
SET Cost = Cost * 6.07
WHERE ( PrereqTech IN ( SELECT Type FROM Technologies WHERE Era = 'ERA _DIGITAL' ) );

UPDATE Units
SET Cost = Cost * 4.3
WHERE ( PrereqTech IN ( SELECT Type FROM Technologies WHERE Era = 'ERA _MODERN' ) );

UPDATE Units
SET Cost = Cost * 3.1
WHERE ( PrereqTech IN ( SELECT Type FROM Technologies WHERE Era = 'ERA _INDUSTRIAL' ) );

UPDATE Units
SET Cost = Cost * 2.3
WHERE ( PrereqTech IN ( SELECT Type FROM Technologies WHERE Era = 'ERA _RENAISSANCE' ) );

UPDATE Units
SET Cost = Cost * 2.0
WHERE ( PrereqTech IN ( SELECT Type FROM Technologies WHERE Era = 'ERA _MEDIEVAL' ) );

UPDATE Units
SET Cost = Cost * 1.5
WHERE ( PrereqTech IN ( SELECT Type FROM Technologies WHERE Era = 'ERA _CLASSICAL' ) );

UPDATE Units
SET Cost = Cost * 1.0
WHERE ( PrereqTech IN ( SELECT Type FROM Technologies WHERE Era = 'ERA _ANCIENT' ) );



I see no difference between the correct value and the others :crazyeye:. For the eras after modern, it is bacause I am using this with Call To Power. However, I am testing on vanilla so I can be sure the mod takes hold. Help please :goodjob:
 
You have spaces before the underscore in all your era names. e.g. you have 'ERA _CLASSICAL' instead of 'ERA_CLASSICAL'. This causes all the SELECTs to fail, hence nothing gets updated.
 
Hi again (again). Another question: is there a domain to adjust unit maintenance cost? I checked the Unit folder in the game folder but the only values it list are No maintenance and extra maintenance cost. Thanks
 
Another question: is there a domain to adjust unit maintenance cost?

No.

You can set a unit to not require any maintenance, but units that require maintenance all cost the same, an amount that slowly increases as the game progresses.
 
So what about changing the rate that it increases per era? Otherwise I'll just change the building maintenance
 
Back
Top Bottom