[R&F] Making building yields not stack?

Question

King
Joined
Mar 12, 2008
Messages
950
I know buildings.xml contains data so that you cant build both a barracks and a stable at the same time, but i want to build both but not have the bonuses stack.

Is there a way to do this, like with regional buildings (Factories, etc)?

Also, where do you change the city center yield itself? All city centers automatically produce 2 food and 2 production, but i cannot find that defined anywhere...i want to try increasing it.
 
I know buildings.xml contains data so that you cant build both a barracks and a stable at the same time, but i want to build both but not have the bonuses stack.

Is there a way to do this, like with regional buildings (Factories, etc)?

Also, where do you change the city center yield itself? All city centers automatically produce 2 food and 2 production, but i cannot find that defined anywhere...i want to try increasing it.


You'd need to test it but giving the Buildings a RegionalRange of 1 would probably do this for Amenities and Production (and also other Yields?--probably but I haven't tested them). It would probably not work for stuff added by the BuildingModifiers table like the extra XP to units, etc, unless there's a way I'm not aware of to make a Modifier only stack 1 time. That may be possible but I've never seen it in actual use.

Note there may be a workaround way for this, if you attach Modifiers to the Player (perhaps using a broadcast Modifier like MODIFIER_PLAYER_CITIES_ATTACH_MODIFIER) and use a RequirementSet to check for the presence of the building before applying a bonus. I have no idea if that would work with Unit XP although it might because that is how I assume the Mapuche XP bonus in cities with governors is set up.
 
Oh unit xp isnt an issue since stables/barracks are for seperate class of units anyway. Im more concerned about things like art muesuem/archaelogical muesuem stacking and GP points stacking.
 
Oh unit xp isnt an issue since stables/barracks are for seperate class of units anyway. Im more concerned about things like art muesuem/archaelogical muesuem stacking and GP points stacking.

I would probably handle this with the following technique:

  1. Strip each of these stackable buildings of values found in Building_GreatPersonPoints and Building_YieldChanges. A simple SQL DELETE will handle this pretty easily.
  2. Create RequirementSets that examine cities for the combinations of buildings you want to stack. E.g. create a RequirementSet that looks for either a Barrack or a Stable.
  3. Create a broadcast Modifier of the MODIFIER_PLAYER_CITIES_ATTACH_MODIFIER. Use the above RequirementSet as the SubjectRequirementSetId.
  4. Create a city-level modifier that actually applies the effects you deleted in Step 1. E.g. a Modifier that awards GPP to the city.
  5. Apply the broadcast Modifier to a specific player or to all players using the TraitModifiers table.

By doing it this way, you basically are using a RequirementSet as a "gateway" that unlocks the Modifier. Using a RequirementSetType of REQUIREMENTSET_TEST_ANY allows it to trigger the first time a building in the group is constructed, but not again when a second or third etc. building in the set is added.
 
Top Bottom