1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

[R&F] Can you modify science per pop on a per-city basis?

Discussion in 'Mod Creation Help' started by rattatatouille, Mar 7, 2018.

  1. rattatatouille

    rattatatouille Chieftain

    Joined:
    Jan 26, 2018
    Messages:
    89
    Gender:
    Male
    There's this in GlobalModifiers.xml

    Code:
    <Replace Name="SCIENCE_PERCENTAGE_YIELD_PER_POP" Value="50" />
    which is where we get the 0.5 (used to be 0.7 before R&F) Science per population.

    Is there a way to make it so that if you have, for example, a Library in a city, this modifier gets bumped up to either 70% or 80% but only for that city?

    I'm currently working on an overhaul of certain districts to help reward tall play, see.
     
  2. isau

    isau Warlord

    Joined:
    Jan 15, 2007
    Messages:
    2,693
    Check out the Modifier MODIFIER_PLAYER_CITIES_ADJUST_CITY_YIELD_PER_POPULATION (which would effect all cities). It is used by the Theoracy government to add a yield based on population in cities with governors. You could re-use portions of it and rewrite the RequirementSet to return True for cities with the conditions you want to provide the bonus to.
     
  3. rattatatouille

    rattatatouille Chieftain

    Joined:
    Jan 26, 2018
    Messages:
    89
    Gender:
    Male
    I figured it out. Here's what I did:

    Code:
    <Types>
            <Row Type="MODIFIER_SINGLE_CITY_ADJUST_CITY_YIELD_PER_POPULATION" Kind="KIND_MODIFIER"/>
            <Row Type="MODIFIER_SINGLE_CITY_ADJUST_CITY_YIELD_PER_DISTRICT" Kind="KIND_MODIFIER"/>
        </Types>
    These two statements are essentially "hijacking" the per pop modifier from Theocracy/Communism and the per district modifier from Democracy.

    Code:
    <DynamicModifiers>
            <Row>
                <ModifierType>MODIFIER_SINGLE_CITY_ADJUST_CITY_YIELD_PER_POPULATION</ModifierType>
                <CollectionType>COLLECTION_OWNER</CollectionType>
                <EffectType>EFFECT_ADJUST_CITY_YIELD_PER_POPULATION</EffectType>
            </Row>
            <Row>
                <ModifierType>MODIFIER_SINGLE_CITY_ADJUST_CITY_YIELD_PER_DISTRICT</ModifierType>
                <CollectionType>COLLECTION_OWNER</CollectionType>
                <EffectType>EFFECT_ADJUST_CITY_YIELD_PER_DISTRICT</EffectType>
            </Row>
        </DynamicModifiers>
    Here is the crux of the modification. Originally, CollectionType was COLLECTION_PLAYER_CITIES (which, as you may suspect, applies it to all cities owned by a particular player) but after I changed it to COLLECTION_OWNER it now only affects it once per city.
     
  4. isau

    isau Warlord

    Joined:
    Jan 15, 2007
    Messages:
    2,693
    Yes that way works too. It just depends on how you want to apply the Modifier.
     

Share This Page