1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    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:
    109
    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,751
    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:
    109
    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,751
    Yes that way works too. It just depends on how you want to apply the Modifier.
     

Share This Page