Modding:Modifiers

Modifiers are a powerful tool to be used in modding. Here is an example for their basic structure (AssaultDoctrine.xml):



Contains any number of modifiers.

There are a couple alternatives to the standard tag which trigger during different times and apply to different targets, more information below.

Contains effects and optionally also triggering conditions.

The tag can have the following attributes:

Causes the modifier effects not to be visible in the tooltip.  Causes the modifier effects to require a research upgrade to be unlocked.

Contains conditions which all have to be true for the effects to be applied.

The tags above are needed for the following checks (see example at the top of the page):

There is also this attribute:

This one seems to work slightly differently because it's found outside of modifiers:

Can do a number of different things like change values or spawn and remove units or apply traits to units. For a list of things that can be inserted for [Stat], see Stats

Stats
Stats are values that can be changed by effects or checked by conditions.

Basic unit stats

 * armor


 * hitpoints, hitpointsMax, hitpointsFraction
 * Current and maximum . Fraction is a fraction of the max hitpoints, but applied to the current hitpoints.


 * healthPercentage
 * Might be the remaining health as a percentage. Used for conditions.


 * morale, moraleMax
 * Current and maximum.


 * movement, movementMax
 * Current and maximum.


 * movementCost
 * The movement cost of a tile. A forest increases movement cost by 1. A city sets the maximum to 1 for allied units.  force the move to end.


 * healingRate


 * cargoSlots

Resource related

 * production


 * productionCost


 * requisitions, energy, food, ore, influence
 * Produces resources per turn when positive, costs upkeep per turn when negative. When applied as mul to a tile then it will be the tile's resource yield.


 * requisitionsCost, energyCost, foodCost, oreCost, influenceCost
 * One time production cost.


 * research
 * production or upkeep? Can this be production cost as well?


 * loyalty
 * bonus or penalty.


 * growth
 * Population for cities.


 * populationLimit
 * Population housing for cities.

Other stats

 * actionPointsMax
 * When set to 0, the unit won't be able to shoot. Found in stunned.xml. Can't be used for conditions?


 * stealth
 * Maybe makes units invisible, maybe makes them ignore overwatch? found in forest.xml.


 * cargoSlotsRequired
 * How many a unit takes up? -1 means untransportable.


 * influencePerExperience
 * Sets an amount of influenced gained with experience. Used by the Space Marine Captain ability.


 * moraleLossFactor
 * Increases or slows down loss. Used by vox caster and mobrule.


 * hitpointsPerMoraleLoss
 * How much are lost (maybe gained) by morale loss?

Combat related

 * accuracy, rangedAccuracy, meleeAccuracy
 * Total, ranged and melee.


 * damage, rangedDamage, meleeDamage
 * Total, ranged and melee.


 * attacks, meleeAttacks
 * Total, and melee.


 * armorPenetration, rangedArmorPenetration, meleeArmorPenetration
 * Total, ranged and melee.


 * attacksTaken
 * Increases amount of attacks when attacked? Found in swarms.xml.


 * additionalMembersHit
 * Applies the weapon damage to multiple members of a squad. Used by blast and template weapons. See damage calculation.


 * circumstanceMeleeDamage
 * Melee damage modifier. Used by Fear.xml and Zealot.xml.


 * minDamageFromHitpointsFraction
 * Used by weapons.


 * damageFromHitpoints
 * Used by weapons.


 * rangedDamageReduction, invulnerableDamageReduction, feelNoPainDamageReduction, witchfireDamageReduction, cityDamageReduction, heroDamageReduction
 * Types of . See damage calculation.


 * rangedDamageReductionBypass
 * Makes attacks ignore .  will bypass 100%.


 * damageTaken
 * Changes how much damage is taken? Found in misfortune.xml.

Other information
For traits, the category="buff" or category="debuff" attribute controls the colour of the icon. Buff is green and debuff red.