Extending available EffectTypes and modifiers

DRK248

Chieftain
Joined
Jul 28, 2014
Messages
19
Hi all! I'm developing a mod that adds an alternate leader to an existing civilization, and I would like help in figuring out how to implement some of the bonuses I've come up with for the leader's ability. In particular, I would like to understand whether it's even possible to implement my ideas since they go beyond effects and modifiers available in the game's database / DLL. I've done some Civ5 and Civ6 modding in the past but that was all XML-based.

I've listed two of the bonuses I need help with below, in order of priority:
  1. The most important bonus I would like to implement & need help with is as follows: international trade routes provide +2 Gold for every specialty district in the origin city (when the leader's civilization is in a golden age). This is similar to the suzerain bonus provided by the Kumasi city-state except that it applies to all international trade routes instead of just trade routes to city-states. Unfortunately the EffectType that is implements this suzerain bonus, 'EFFECT_ADJUST_CITY_STATE_TRADE_ROUTE_DISTRICT_YIELD', also only applies to city-states. How would I go about implementing my leader's bonus? Is there any way to create a new EffectType that extends the EffectType already available in the game and applies it to all international trade routes?
  2. Similar to how gold can be used to purchase buildings & districts, would it be possible to implement a bonus that allows a player to use gold to repair buildings & districts? If so, how would I go about doing so?
Please let me know if I can provide more detail, explain anything further, etc. Thank you in advance for help!
 
#2 I am not sure is possible

#1 you need to look at the modifiers for University of Sankore. It uses an effect-type that allows a stateable yield-type. The ModifierType used applies to single cities, but you can get around this easily by using a First-Level modifier attached to the leader or civ that then grants a second modifier to all that player's cities.

MODIFIER_PLAYER_CITIES_ATTACH_MODIFIER is the ModifierType you need to use in the First-Level ModifierId and in table ModifierArguments you need to state the second ModifierId as the "Value" for a row where "Name" = "ModifierId"

The Second ModifierId is the one that does the actual work and has the needed requirements attached to it.

A RequirementType of REQUIREMENT_CITY_HAS_X_SPECIALTY_DISTRICTS wants an integer as the "X" for the number of required specialty districts in table RequirementArguments.

The problem you will run into is that you will likely have to make multiple sets of these modifier combinations to handle all the different numbers of Specialty Districts a City can reasonably be expected to have.

All doable but will take a lot of repeat copy-paste-edit.

If it were me I would create one such Modifier Combination and make sure you have all the logic working before copy-pasting-editing to add in the other sets you will need to create the desired effect.
 
MODIFIER_PLAYER_CITIES_ATTACH_MODIFIER is the ModifierType you need to use in the First-Level ModifierId and in table ModifierArguments you need to state the second ModifierId as the "Value" for a row where "Name" = "ModifierId"
wouldn't it be more handy if using DynamicModifiers, with CollectionType: COLLECTION_PLAYER_CITIES?
 
The pertinent row in table DynamicModifiers
Code:
ModifierType	CollectionType	EffectType
MODIFIER_PLAYER_CITIES_ATTACH_MODIFIER	COLLECTION_PLAYER_CITIES	EFFECT_ATTACH_MODIFIER
You attach this First-Level Modifier to the Player, and then the ModifierId you specify as the ModifierArgument for this modifier is attached to all that player's cities.

The issue is using a modifier that allows trade-routes to have extra specifiable YieldType benefits based on origin and destination, and a quick look did not find one that was directly empire-wide.

There are these which might also serve
Code:
MODIFIER_PLAYER_CITIES_ADJUST_TRADE_ROUTE_YIELD_FROM_OTHERS	COLLECTION_PLAYER_CITIES	EFFECT_ADJUST_TRADE_ROUTE_YIELD_FROM_OTHERS

MODIFIER_PLAYER_CITIES_ADJUST_TRADE_ROUTE_YIELD_TO_OTHERS	COLLECTION_PLAYER_CITIES	EFFECT_ADJUST_TRADE_ROUTE_YIELD_TO_OTHERS
Which would eliminate the need for the intermediary First-Level modifierId but I think the problem may be in getting the game to implement a Requirement for X specialty districts if it does not parse the SubjectSetRequirementId as applying to each individual city instead of applying to the player.
 
Last edited:
Thank you @LeeS for your in-depth response! And thank you @Zegangani for your input as well!

#2 I am not sure is possible
I figured this was the case, no worries.

#1 you need to look at the modifiers for University of Sankore. It uses an effect-type that allows a stateable yield-type. The ModifierType used applies to single cities, but you can get around this easily by using a First-Level modifier attached to the leader or civ that then grants a second modifier to all that player's cities.
That plan makes sense. Thank you for providing an in-depth explanation on how the modifiers would work, and thanks for the tips on how to implement & test this bonus.

Thank you all again for the help! :love: I will work on implementing the first bonus now, and I will let you know if I need any more help.
 
Top Bottom