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

Setting Maximums for Bonuses

Discussion in 'Mod Creation Help' started by SocialMechanic, May 11, 2019.

  1. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    86
    So I'm trying to make a policy that increases the Science yield of Research Labs by +5. That alone I think is simple. However, I'm trying to make it cap out at +25. So, the policy would be worded like this: "+5 Science from Research Labs, up to a maximum of +25."
    What exactly is the syntax for setting a maximum? I know there is a religious follower belief that caps out bonus production at +15%...

    Also, I'm not new to modding, but I AM new to modding Civ. I've been reading Lee's 400+ page modding doc and I'm on page 100 as of now. I'm saying this because I forsee myself being on these forums often.
    I also mod Darkest Dungeon and there is a DD Modding discord where people are always available to help, but I don't think there is a Civ Modding discord... is there?
     
    Last edited: May 11, 2019
  2. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    86
    Also, I can't get this to work:

    <PolicyModifiers>
    <Delete PolicyType="POLICY_URBAN_PLANNING" ModifierId="URBAN_PLANNING_ALLCITYPRODUCTION" />
    <Row PolicyType="POLICY_URBAN_PLANNING" ModifierId="URBAN_SM_PLANNING_ALLCITYPRODUCTION" />
    <Row PolicyType="POLICY_URBAN_PLANNING" ModifierId="URBAN_SM_PLANNING_COASTAL_CITY_PRODUCTION" />
    </PolicyModifiers>
    <Modifiers>
    <Row ModifierId="URBAN_SM_PLANNING_ALLCITYPRODUCTION" ModifierType="MODIFIER_PLAYER_CITIES_ADJUST_CITY_YIELD_CHANGE" />
    <Row>
    <ModifierId>URBAN_SM_PLANNING_COASTAL_CITY_PRODUCTION</ModifierId>
    <ModifierType>MODIFIER_PLAYER_CITIES_ADJUST_CITY_YIELD_CHANGE</ModifierType>
    <SubjectRequirementSetId>CITY_IS_COASTAL</SubjectRequirementSetId>
    </Row>
    </Modifiers>
    <ModifierArguments>
    <Row ModifierId="URBAN_SM_PLANNING_ALLCITYPRODUCTION" Name="YieldType" Value="YIELD_PRODUCTION" />
    <Row ModifierId="URBAN_SM_PLANNING_ALLCITYPRODUCTION" Name="Amount" Value="1" />
    <Row ModifierId="URBAN_SM_PLANNING_COASTAL_CITY_PRODUCTION" Name="YieldType" Value="YIELD_PRODUCTION" />
    <Row ModifierId="URBAN_SM_PLANNING_COASTAL_CITY_PRODUCTION" Name="Amount" Value="1" />
    </ModifierArguments>

    However, when I code out the " <SubjectRequirementSetId>CITY_IS_COASTAL</SubjectRequirementSetId>", it works. What am I doing wrong?
    I want it to be: "+1 Production in all cities. +1 additional Production in coastal cities."
     
  3. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    86
    I also want to create a policy that provides "for every" bonuses.
    For example, the New Deal requires 3 specialitydistricts.
    If I wanted to change the New Deal to give +1 housing and +1 Amenity FOR EVERY 2 specialitydistricts, how would I go about doing that?

    Sorry to keep asking questions. I'm just excited to start getting things working.
     
  4. Sejick

    Sejick Chieftain

    Joined:
    Feb 28, 2018
    Messages:
    12
    Gender:
    Male
    1) Modifiers have parameters for OwnerStackLimit and SubjectStackLimit, which are normally set to null. I haven't used them myself, but you could set one of them to 5 and see if that works. The modifier type you would want is probably MODIFIER_PLAYER_CITIES_ADJUST_BUILDING_YIELD_CHANGE.

    2) I don't think CITY_IS_COASTAL is a pre-existing RequirementSet. You could try PLOT_IS_COASTAL_LAND_REQUIREMENTS, which might work.

    3) For granting effects on every 2 specialty districts, I would just create 5 modifiers that each grant +1 housing (and 5 more that give +1 amenity) and give each modifier a requirement set for 2, 4, 6, 8, 10 specialty districts.
     
  5. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    86
    Okay cool. Thank you for helping me. I'll try these in the morning and post the results.
     
  6. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    86
    1) I'm trying to get this policy to give +25% Faith PER 5 POP. I managed to get it where I think it would work. The text actually changes which is nice, but when I tested the functionality it doesn't work. In fact, it functions exactly how if does in the main game:

    <PolicyModifiers>
    <Delete PolicyType="POLICY_SIMULTANEUM" ModifierId="SIMULTANEUM_BUILDING_YIELDS_HIGH_ADJACENCY" />
    <Delete PolicyType="POLICY_SIMULTANEUM" ModifierId="SIMULTANEUM_BUILDING_YIELDS_HIGH_POP" />
    <Row PolicyType="POLICY_SIMULTANEUM" ModifierId="MODIFIER_SM_FAITH_PER_X_POP" />
    </PolicyModifiers>
    <Modifiers>
    <Row ModifierId="MODIFIER_SM_FAITH_PER_X_POP" ModifierType="MODIFIER_PLAYER_CITIES_ADJUST_BUILDING_YIELD_MODIFIERS_FOR_DISTRICT" SubjectRequirementSetId="CITY_HAS_X_POPULATION" />
    </Modifiers>
    <RequirementSets>
    <Row RequirementSetId="CITY_HAS_X_POPULATION" RequirementSetType="REQUIREMENTSET_TEST_ALL" />
    </RequirementSets>
    <RequirementSetRequirements>
    <Row RequirementSetId="CITY_HAS_X_POPULATION" RequirementId="REQUIRES_CITY_HAS_X_POPULATION" />
    </RequirementSetRequirements>
    <Requirements>
    <Row RequirementId="REQUIRES_CITY_HAS_X_POPULATION" RequirementType="REQUIREMENT_CITY_HAS_X_POPULATION" />
    </Requirements>
    <RequirementArguments>
    <Row RequirementId="REQUIRES_CITY_HAS_X_POPULATION" Name="Amount" Value="5" />
    </RequirementArguments>
    <ModifierArguments>
    <Row ModifierId="MODIFIER_SM_FAITH_PER_X_POP" Name="DistrictType" Value="DISTRICT_HOLY_SITE"/>
    <Row ModifierId="MODIFIER_SM_FAITH_PER_X_POP" Name="YieldType" Value="YIELD_FAITH"/>
    <Row ModifierId="MODIFIER_SM_FAITH_PER_X_POP" Name="Amount" Value="25"/>
    </ModifierArguments>

    2) "PLOT_IS_COASTAL_LAND_REQUIREMENTS" worked! Fantastic.

    3) This policy isn't being loaded and I'm not sure why.

    <Types>
    <Row Type="POLICY_SM_SEARLAB" Kind="KIND_POLICY" />
    </Types>
    <Policies>
    <Row PolicyType="POLICY_SM_SEARLAB" Name="LOC_POLICY_SM_SEARLAB_NAME" Description="LOC_POLICY_SM_SEARLAB_DESCRIPTION" PrereqCivic="CIVIC_CONSERVATION" GovernmentSlotType="SLOT_ECONOMIC" />
    </Policies>
    <PolicyModifiers>
    <Row PolicyType="POLICY_SM_SEARLAB" ModifierId="POLICY_SM_SEARLAB_MODIFIER" />
    </PolicyModifiers>
    <Modifiers>
    <Row ModifierId="POLICY_SM_SEARLAB_MODIFIER" ModifierType="MODIFIER_PLAYER_CITIES_ADJUST_BUILDING_YIELD_CHANGE" />
    <!-- <Row OwnerStackLimit="5" /> -->
    </Modifiers>
    <ModifierArguments>
    <Row ModifierId="POLICY_SM_SEARLAB_MODIFIER" Name="BuildingType" Value="BUILDING_RESEARCH_LAB" />
    <Row ModifierId="POLICY_SM_SEARLAB_MODIFIER" Name="YieldType" Value="YIELD_SCIENCE" />
    <Row ModifierId="POLICY_SM_SEARLAB_MODIFIER" Name="Amount" Value="5" />
    </ModifierArguments>

    So, I'm not sure what I'm doing wrong on both 1 and 3, but hopefully someone can help me.
    Also, ignore the numbering, I do not believe it matches my previous statements.
     
  7. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    86
    So this ALSO isn't working and I'm not sure why...


    <!-- Changing Old Public Transport -->
    <PolicyModifiers>
    <Delete PolicyType="POLICY_PUBLIC_TRANSPORT" ModifierId="PUBLICTRANSPORT_FARMREPLACEGOLD"/>
    <Row PolicyType="POLICY_PUBLIC_TRANSPORT" ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_A" />
    <Row PolicyType="POLICY_PUBLIC_TRANSPORT" ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_B" />
    <Row PolicyType="POLICY_PUBLIC_TRANSPORT" ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_C" />
    <Row PolicyType="POLICY_PUBLIC_TRANSPORT" ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_D" />
    <Row PolicyType="POLICY_PUBLIC_TRANSPORT" ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_E" />
    <Row PolicyType="POLICY_PUBLIC_TRANSPORT" ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_F" />
    </PolicyModifiers>
    <Modifiers>
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_A" ModifierType="MODIFIER_PLAYER_DISTRICTS_ADJUST_YIELD_BASED_ON_APPEAL" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_B" ModifierType="MODIFIER_PLAYER_DISTRICTS_ADJUST_YIELD_BASED_ON_APPEAL" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_C" ModifierType="MODIFIER_PLAYER_DISTRICTS_ADJUST_YIELD_BASED_ON_APPEAL" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_D" ModifierType="MODIFIER_PLAYER_DISTRICTS_ADJUST_YIELD_BASED_ON_APPEAL" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_E" ModifierType="MODIFIER_PLAYER_DISTRICTS_ADJUST_YIELD_BASED_ON_APPEAL" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_F" ModifierType="MODIFIER_PLAYER_DISTRICTS_ADJUST_YIELD_BASED_ON_APPEAL" />
    </Modifiers>
    <ModifierArguments>
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_A" Name="YieldType" Value="YIELD_GOLD" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_A" Name="RequiredAppeal" Value="1" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_A" Name="YieldChange" Value="3" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_A" Name="DistrictType" Value="DISTRICT_NEIGHBORHOOD" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_B" Name="YieldType" Value="YIELD_GOLD" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_B" Name="RequiredAppeal" Value="2" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_B" Name="YieldChange" Value="3" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_B" Name="DistrictType" Value="DISTRICT_NEIGHBORHOOD" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_C" Name="YieldType" Value="YIELD_GOLD" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_C" Name="RequiredAppeal" Value="3" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_C" Name="YieldChange" Value="3" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_C" Name="DistrictType" Value="DISTRICT_NEIGHBORHOOD" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_D" Name="YieldType" Value="YIELD_GOLD" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_D" Name="RequiredAppeal" Value="4" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_D" Name="YieldChange" Value="3" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_D" Name="DistrictType" Value="DISTRICT_NEIGHBORHOOD" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_E" Name="YieldType" Value="YIELD_GOLD" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_E" Name="RequiredAppeal" Value="5" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_E" Name="YieldChange" Value="3" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_E" Name="DistrictType" Value="DISTRICT_NEIGHBORHOOD" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_F" Name="YieldType" Value="YIELD_GOLD" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_F" Name="RequiredAppeal" Value="6" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_F" Name="YieldChange" Value="3" />
    <Row ModifierId="MODIFIER_SM_GOLD_PER_APPEAL_F" Name="DistrictType" Value="DISTRICT_NEIGHBORHOOD" />
    </ModifierArguments>

    I want Neighborhoods to give +3 Gold per appeal of the tile they are on...
     
  8. Sejick

    Sejick Chieftain

    Joined:
    Feb 28, 2018
    Messages:
    12
    Gender:
    Male
    If your policies are functioning like they do in the base game, it might mean there was an error loading your xml somewhere before your delete statement occurs. None of your code after the error will take affect, so try commenting out any previous code and see if there is still no change.

    Alternatively, have you changed the load order of your database changes in your modinfo file? Recently with GS, mods now load before DLC, which means that edits to existing data may be overwritten or fail. You can set the load order greater than zero like this:

    Code:
    <UpdateDatabase id="YourUpdateId">
        <Properties>
            <LoadOrder>1</LoadOrder>
        </Properties>
        <File>YourDatabaseChanges.xml</File>
    </UpdateDatabase>
    
     
  9. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    86
    Imsorry, im not familiar with the modinfo file >.< Where is that at?
    I'm assuming the syntax you posted is put in there?
     
  10. Sejick

    Sejick Chieftain

    Joined:
    Feb 28, 2018
    Messages:
    12
    Gender:
    Male
    I'm assuming you're using ModBuddy? I'm not well versed in it, but whenever you build your solution it automatically creates/updates the modinfo file, which just tells the game which other files to load and when. Lee's guide explains how to change the load order on pages 367 - 372.

    To manually update the modinfo file (if you're not using ModBuddy) you would go to the mod location (for Windows, it is probably Documents/My Games/Sid Meier's Civ 6/Mods/YourModName) and edit the modinfo file with any text editor.
     
  11. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,603
    Location:
    Illinois, USA
    That page number reference will change soon since I've been adding a bit more to the guide. You want to follow the T.O.C. link called "Dependancies, References, Load Orders, Blocks" and then scroll down.
     
  12. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,603
    Location:
    Illinois, USA
    Have you tried your MODIFIER_SM_GOLD_PER_APPEAL_A etc code on a District that has inherent yields, such as the commerical hub or harbor district ? The Aussie DLC uses MODIFIER_PLAYER_DISTRICTS_ADJUST_YIELD_BASED_ON_APPEAL but does so with YieldTypes that are 'correct' for each district being affected. Neighborhoods don't have citizen yields, adjacencies, or other "inherent" yields, so the code may not be working because of this or it may actually be working but is not showing anywhere in the UI.
     
  13. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    86
    Sejick, yes. I'm using ModBuddy.
    LeeS, thats an excellent point. I suppose I could try it on something like a Theater Square? Or should I try it on something that intrinsically yields gold?

    Edit: LeeS, I just tried both Theater Squares and Commerical Hubs and it still doesn't work.
     
    Last edited: May 14, 2019
  14. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    86
    Also, Sejick:
    You made a great point about my policies suddenly not working past a certain point because something might be wrong with the code and it doesn't read anything past the error. I noticed that EVERYTHING past this policy isn't wokring so there must be something wrong with it. The syntax is as follows:

    <PolicyModifiers>
    <Row PolicyType="POLICY_PROFESSIONAL_ARMY" ModifierId="PROFESSIONAL_SM_ARMY_UPGRADE_RESOURCE_DISCOUNT" />
    </PolicyModifiers>
    <Modifiers>
    <Row ModifierId="PROFESSIONAL_SM_ARMY_UPGRADE_RESOURCE_DISCOUNT" ModifierType="MODIFIER_PLAYER_ADJUST_UNIT_UPGRADE_RESOURCE_COST_MODIFIER" />
    </Modifiers>
    <ModifierArguments>
    <Row ModifierId="PROFESSIONAL_SM_ARMY_UPGRADE_RESOURCE_DISCOUNT" Name="Amount" Value="25" />
    <Update>
    <Where ModifierId="PROFESSIONAL_ARMY_UNITUPGRADEDISCOUNT" Name="Amount"/>
    <Set Value="25"/>
    </Update>
    </ModifierArguments>

    Let me know if you see something wrong with it. The text is also not working either (which is in another file of course). I want it to read: "-25% [ICON_Gold] gold and resource cost on all unit upgrades"
     
  15. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,603
    Location:
    Illinois, USA
    There's no error anywhere in this portion of code. It is implemented properly into the game's database
    Code:
    <GameData>
    	<PolicyModifiers>
    		<Row PolicyType="POLICY_PROFESSIONAL_ARMY" ModifierId="PROFESSIONAL_SM_ARMY_UPGRADE_RESOURCE_DISCOUNT" />
    	</PolicyModifiers>
    	<Modifiers>
    		<Row ModifierId="PROFESSIONAL_SM_ARMY_UPGRADE_RESOURCE_DISCOUNT" ModifierType="MODIFIER_PLAYER_ADJUST_UNIT_UPGRADE_RESOURCE_COST_MODIFIER" />
    	</Modifiers>
    	<ModifierArguments>
    		<Row ModifierId="PROFESSIONAL_SM_ARMY_UPGRADE_RESOURCE_DISCOUNT" Name="Amount" Value="25" />
    		<Update>
    			<Where ModifierId="PROFESSIONAL_ARMY_UNITUPGRADEDISCOUNT" Name="Amount"/>
    			<Set Value="25"/>
    		</Update>
    	</ModifierArguments>
    </GameData>
    What is your LoadOrder setting for the UpdateDatabase Action that implements this code ?

    Also, the game-standard modifier for Professional Army Resource Discounts would still be in effect. A 25% discount on resource cost may not take effect until the base resource cost is a power of 4, since rounding up or down may be implemented by the game when the integer result of the discount is a partial value.

    And what, if anything, is being reported in Database.log ?
     
    Last edited: May 14, 2019

Share This Page