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] Need help with modifier

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

  1. rattatatouille

    rattatatouille Chieftain

    Joined:
    Jan 26, 2018
    Messages:
    89
    Gender:
    Male
    I'm currently making a mod where Universities grant +1 Science to Rainforest tiles in its city (a la Civ V). Here's my code:
    Code:
    <Modifiers>
            <Row>
                <ModifierId>UNIVERSITY_ADD_SCIENCE_RAINFOREST</ModifierId>
                <ModifierType>MODIFIER_CITY_PLOT_YIELDS_ADJUST_PLOT_YIELD</ModifierType>
                <SubjectRequirementSetId>RTT_REQUIRES_PLOT_HAS_TAG_UNIVERSITY_FEATURE</SubjectRequirementSetId>
            </Row>
        </Modifiers>
        <ModifierArguments>
            <Row>
                <ModifierId>UNIVERSITY_ADD_SCIENCE_RAINFOREST</ModifierId>
                <Name>Amount</Name>
                <Value>1</Value>
            </Row>
            <Row>
                <ModifierId>UNIVERSITY_ADD_SCIENCE_RAINFOREST</ModifierId>
                <Name>YieldType</Name>
                <Value>YIELD_SCIENCE</Value>
            </Row>
        </ModifierArguments>
        <Requirements>
            <Row>
                <RequirementId>RTT_REQUIRES_PLOT_HAS_TAG_UNIVERSITY_FEATURE</RequirementId>
                <RequirementType>REQUIRES_PLOT_HAS_JUNGLE</RequirementType>
            </Row>
        </Requirements>
        <BuildingModifiers>
            <Row>
                <BuildingType>BUILDING_UNIVERSITY</BuildingType>
                <ModifierId>UNIVERSITY_ADD_SCIENCE_RAINFOREST</ModifierId>
            </Row>
        </BuildingModifiers>
    Is there anything I should correct to make this work?
     
  2. Infixo

    Infixo Warlord

    Joined:
    Jan 9, 2016
    Messages:
    2,192
    Gender:
    Male
    Location:
    Warsaw
  3. rattatatouille

    rattatatouille Chieftain

    Joined:
    Jan 26, 2018
    Messages:
    89
    Gender:
    Male
    Here's my updated code - am I missing anything else? Doesn't seem to work.

    Code:
    <Modifiers>
            <Row>
                <ModifierId>UNIVERSITY_ADD_SCIENCE_RAINFOREST</ModifierId>
                <ModifierType>MODIFIER_CITY_PLOT_YIELDS_ADJUST_PLOT_YIELD</ModifierType>
                <SubjectRequirementSetId>RTT_PLOT_HAS_JUNGLE_REQUIREMENTS</SubjectRequirementSetId>
            </Row>
        </Modifiers>
        <ModifierArguments>
            <Row>
                <ModifierId>UNIVERSITY_ADD_SCIENCE_RAINFOREST</ModifierId>
                <Name>Amount</Name>
                <Value>1</Value>
            </Row>
            <Row>
                <ModifierId>UNIVERSITY_ADD_SCIENCE_RAINFOREST</ModifierId>
                <Name>YieldType</Name>
                <Value>YIELD_SCIENCE</Value>
            </Row>
        </ModifierArguments>
        <RequirementSets>
            <Row>
                <RequirementSetId>RTT_PLOT_HAS_JUNGLE_REQUIREMENTS</RequirementSetId>
                <RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
            </Row>
        </RequirementSets>
        <RequirementSetRequirements>
            <Row>
                <RequirementSetId>RTT_PLOT_HAS_JUNGLE_REQUIREMENTS</RequirementSetId>
                <RequirementId>RTT_REQUIRES_PLOT_HAS_JUNGLE</RequirementId>
            </Row>
        </RequirementSetRequirements>
        <Requirements>
            <Row>
                <RequirementId>RTT_REQUIRES_PLOT_HAS_JUNGLE</RequirementId>
                <RequirementType>REQUIREMENT_PLOT_FEATURE_TYPE_MATCHES</RequirementType>
            </Row>
        </Requirements>
        <RequirementArguments>
            <Row>
                <RequirementId>RTT_REQUIRES_PLOT_HAS_JUNGLE</RequirementId>
                <Name>FeatureType</Name>
                <Value>FEATURE_JUNGLE</Value>
            </Row>
        </RequirementArguments>
        <BuildingModifiers>
            <Row>
                <BuildingType>BUILDING_UNIVERSITY</BuildingType>
                <ModifierId>UNIVERSITY_ADD_SCIENCE_RAINFOREST</ModifierId>
            </Row>
        </BuildingModifiers>
     
  4. Infixo

    Infixo Warlord

    Joined:
    Jan 9, 2016
    Messages:
    2,192
    Gender:
    Male
    Location:
    Warsaw
    There is already a req set to check for Jungle, used by Chichen Itza, you can reuse it.
    If a modifier doesnt work then first check gameeffects.log. You need to set log to Diagnostic and it will tell you if the definition is wrong. While in game, use FireTuner to see if its been properly attached and activated.
    Also, how do you actually check if it works?
     
    rattatatouille likes this.
  5. isau

    isau Warlord

    Joined:
    Jan 15, 2007
    Messages:
    2,693
    The best way to check if a Modifier is working is to open up Firetuner, open the Modifiers panel, and ensure you can see the Modifier in there. BuildingModifiers though... I can't remember if they are visible in there like other Modifiers are.

    I would also use a SQL tool to query the database and make sure the XML is loading. That's actually why I prefer SQL to XML for most tasks. You can write the UPDATE/INSERT statements and test them to be sure they work before committing them to code.


    Here's a sample SQL query you could use to spot check to make sure the data is being inserted correctly.

    Code:
    select * from buildingmodifiers
    left join modifiers on modifiers.ModifierId = buildingmodifiers.ModifierId
    left join modifierarguments on modifierarguments.ModifierId = modifiers.ModifierId
    left join requirementsets on requirementsets.RequirementSetId = modifiers.SubjectRequirementSetId
    left join requirementsetrequirements on requirementsetrequirements.RequirementSetId = requirementsets.RequirementSetId
    left join requirements on requirements.requirementid = requirementsetrequirements.RequirementId
    left join requirementarguments on requirementarguments.RequirementId = requirements.requirementid
    where modifiers.modifierid like '%UNIVERSITY_ADD_SCIENCE_RAINFOREST%'
     
  6. rattatatouille

    rattatatouille Chieftain

    Joined:
    Jan 26, 2018
    Messages:
    89
    Gender:
    Male
    Update: It works now. Was testing with an old save, but when I tested with a fresh new game it works now.
     

Share This Page