How to figure out which arguments are valid for a given modifier effect?

dunkleosteus

Roman Pleb
Joined
Aug 17, 2015
Messages
534
Location
Toronto, Canada
Does anyone know any information about this?]

Specifically, I'm currently looking at the global yields for unassigned resources,
XML:
<Modifier id="TRAIT_MOD_GOLD_UNASSIGNED_RESOURCE" collection="COLLECTION_OWNER" effect="EFFECT_PLAYER_ADJUST_YIELD_PER_RESOURCE">
        <Argument name="YieldType">YIELD_GOLD</Argument>
        <Argument name="Amount">2</Argument>
        <Argument name="Unassigned">true</Argument>
    </Modifier>
and comparing it to
XML:
<Modifier id="MOD_WINE_FLAT_HAPPINESS" collection="COLLECTION_ALL_CAPITAL_CITIES" effect="EFFECT_PLAYER_ADJUST_YIELD_PER_RESOURCE_TYPE">
        <Argument name="Amount">3</Argument>
        <Argument name="YieldType">YIELD_HAPPINESS</Argument>
        <Argument name="ResourceType">RESOURCE_WINE</Argument>
        <Argument name="PercentMultiplier">false</Argument>
    </Modifier>
The effect seems similar, one is adjust yield per resource and the other is adjust yield per resource type. I wanted to make a mod where global resources get to switch between being global resources and being assignable resources. They'd have their global effect when unassigned but lose it and have a specific effect when assigned. For example, horses have a global yield of increasing cavalry combat strength but aren't much use in peacetime, so I wanted to let players assign them to cities for production as a bonus resource and then take them out during war to increase military power.

I'm not making a mod just yet, I've just edited the .xml files since I know I won't run into any issues with mod loading that way. I figure once I get it working mechanically I can write up the mod and revert the edited game files.

Does anyone know if using the Unassigned argument and the ResourceType argument is even legal for a modifier? Does ResourceType only work on EFFECT_PLAYER_ADJUST_YIELD_PER_RESOURCE and Unassigned only work on EFFECT_PLAYER_ADJUST_YIELD_PER_RESOURCE? I know that ResourceType is a valid argument for EFFECT_CITY_ADJUST_YIELD_PER_RESOURCE which doesn't have _TYPE at the end, but I can't find an instance of EFFECT_PLAYER_ADJUST_YIELD_PER_RESOURCE that uses ResourceType, so I'm not sure.

I've tested with both COLLECTION_OWNER and COLLECTION_ALL_PLAYERS, since MOD_WINE_GOLDEN_AGE_CULTURE seemed to be a global effect that used that collection.

EDIT:
I've learned a lot:
1. If the modifier is being assigned in the civilizations.xml file (where the regular modifier is assigned for unassigned resources) those are assigned when the age STARTS. Even if you adjust the existing modifiers, the change won't be applied until you start a new game or enter the age for the first time.
2. EFFECT_PLAYER_ADJUST_YIELD_PER_RESOURCE does not take the ResourceType argument.
I'm testing with some modifiers for dates specifically
XML:
    <Modifier id="TRAIT_MOD_CULTURE_UNASSIGNED_DATES_RESOURCE" collection="COLLECTION_OWNER" effect="EFFECT_PLAYER_ADJUST_YIELD_PER_RESOURCE">
        <Argument name="YieldType">YIELD_CULTURE</Argument>
        <Argument name="Amount">2000</Argument>
        <Argument name="ResourceType">RESOURCE_DATES</Argument>
        <Argument name="Unassigned">true</Argument>
    </Modifier>
    <Modifier id="TRAIT_MOD_HAPPINESS_UNASSIGNED_DATES_RESOURCE" collection="COLLECTION_ALL_PLAYERS" effect="EFFECT_PLAYER_ADJUST_YIELD_PER_RESOURCE">
        <Argument name="YieldType">YIELD_HAPPINESS</Argument>
        <Argument name="Amount">2000</Argument>
        <Argument name="ResourceType">RESOURCE_DATES</Argument>
        <Argument name="Unassigned">true</Argument>
    </Modifier>
    <Modifier id="TRAIT_MOD_HAPPINESS_UNASSIGNED_RESOURCE" collection="COLLECTION_OWNER" effect="EFFECT_PLAYER_ADJUST_YIELD_PER_RESOURCE">
        <Argument name="YieldType">YIELD_HAPPINESS</Argument>
        <Argument name="Amount">2</Argument>
        <Argument name="Unassigned">true</Argument>
    </Modifier>
and I see this:
1741136659872.png

I think the happiness is being multiplied because I used COLLECTION_ALL_PLAYERS. I wanted to use extreme values so that any change would be obvious because I was originally testing quite far into an existing game.
EDIT 2:
so I've learned some more. Only yields added with the EFFECT_PLAYER_ADJUST_YIELD_PER_RESOURCE effect seem to show up on the tool tip. That effect doesn't take ResourceType as an argument. EFFECT_PLAYER_ADJUST_YIELD_PER_RESOURCE_TYPE doesn't seem to be able to take Unassigned as a resource, so if you have a copy of dates at all with this test modifier, it will just give you a ton of yields.
 
Last edited:
Back
Top Bottom