New Modifiers

Joined
Jan 10, 2019
Messages
2,833
Is it possible to make New Modifiers from scratch if one desired modifiers doesn't exists in Base game "Modifiers.xml".

If so how? And what is a coding file that contains EFFECTS assigned to specific modifiers (and elaborates how these effects actually work)

For example. adjusting unit strenghts of certain classes with Technology has never been completed because there's no modifiers that 'adjusts unit strenghts with tech exists in Base Game 'Modifiers.xml')
 
anyway why dont you use MODIFIER_PLAYER_UNITS_GRANT_ABILITY. in the techmodifiers section?
 
^ Does it works to boost certain units with 'dummy' tag class that will earn benefits once a tech or civic is researched?
If this modifier is to be used. What are coding patterns in ModifierArguements that permits them to work?

For example. Tech is Ironworking. and I have a dummy tag class that added in addition to normal class to units like Archer, Warrior and Spearman. This tech adds +3 strenghts to the following units with this dummy tag class but not affecting anything after that.
 
Collections/Effects/Modifiers are supposed to simplify things, but I dunno, I find them to often be unintuitive and cumbersome to use; I will also admit to a lack of knowledge there, so it might just be me. With that said, if you haven't yet found a solution, you can probably achieve what you're looking for with a combination of modifiers and lua scripting.

I'm just spitballing here, but take a look at the UnitAbilities table in the Gameplay database. I'd start by following the example set by a Great Admiral or General's ability, and configuring your +3 strength modifier to be a unit ability. From there, you'd use lua to attach that ability to any desired units, existing and new, after the desired tech has been researched. You'd need to hook into both Events.ResearchCompleted and Events.UnitAddedToMap to accomplish this.

Again, this is all in theory, but I've employed something similar to attach a strength modifier to a unit as a goody hut reward, so I think the theory is sound.
 
Back
Top Bottom