Is it possible to change each city yeild independently?

slegach

Chieftain
Joined
Jan 28, 2019
Messages
13
I'm trying to introduce the next change in my mod:
- cities yield per population is decreased greatly,
- each district generates a yield of the corresponding type based on city population
- you can build any number of districts of the same type for the city, their summed yield should be additive.

Here is what I've done using modifiers:
Code:
UPDATE GlobalParameters SET Value='10' WHERE Name='SCIENCE_PERCENTAGE_YIELD_PER_POP';
INSERT INTO Modifiers (ModifierId, ModifierType, RunOnce, NewOnly, Permanent) VALUES ('AARS_DISTRICT_CAMPUS_SCIENCE_YIELD_CHANGE', 'MODIFIER_PLAYER_CITIES_ADJUST_CITY_YIELD_PER_POPULATION', '0', '0', '0');
INSERT INTO ModifierArguments (ModifierId, Name, Type, Value) VALUES ('AARS_DISTRICT_CAMPUS_SCIENCE_YIELD_CHANGE', 'Amount', 'ARGTYPE_IDENTITY', '0.35');
INSERT INTO ModifierArguments (ModifierId, Name, Type, Value) VALUES ('AARS_DISTRICT_CAMPUS_SCIENCE_YIELD_CHANGE', 'YieldType', 'ARGTYPE_IDENTITY', 'YIELD_SCIENCE');
INSERT INTO DistrictModifiers (DistrictType, ModifierId) VALUES ('DISTRICT_CAMPUS', 'AARS_DISTRICT_CAMPUS_SCIENCE_YIELD_CHANGE');
UPDATE Districts SET OnePerCity='0' WHERE DistrictType='DISTRICT_CAMPUS';

At first sight that worked like a charm. Base cities science yield was 0.1 per pop, when I build the first campus 0.45/pop, the second one 0.8/pop, the third one 1.15/pop (or some very near values).
But then I realized that this works for EVERY my city. So every campus in every city provides bonus to every city!
I haven't found any other yield effect related to the city population.
Is there a way to overcome the problem? For example, to use Lua for this. I haven't used it at all, so even any basic suggestions about how it can be used for the problem are very appreciated.
 
You are using a modifier that works for all cities
MODIFIER_PLAYER_CITIES_ADJUST_CITY_YIELD_PER_POPULATION.
You need a single city modifier.
I created 2 buildings in my Real Building Upgrades mod that use that concept (i.e. Increase yield per pop on a city level), so you can look that up too.
 
You'll need to create a new ModifierType with the same effect, "EFFECT_ADJUST_CITY_YIELD_PER_POPULATION", but with collection "COLLECTION_OWNER" instead of "COLLECTION_PLAYER_CITIES".
That worked. Thank you very much!
And now I understand what dynamic modifiers are for, great!
:thumbsup:
 
Back
Top Bottom