Modding/Modifiers: Difference between revisions

From Hammerwatch 2 Wiki
Jump to navigation Jump to search
(Created page with "=Modifier Classes= ==Modifiers== ModifyStack ModifySummons PointsFromDamageTaken SpellCost Thorns TrueStrike UnlethalDamage UsePointsCost ==Skill Modifiers== SkillModifier BaseSkillModifier SkillCost SkillCrit SkillDamageLeeching SkillSlowScale ==Stat Modifiers== ConvertStat ConvertStatExpression DummyModifier StatBasedDamage StatAdd DamageAdd ArmorAdd AttribAdd SpeedAdd SpeedMul Evade DamageMulAdd ArmorPenetration Experience PlayerLight Pla...")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
=Modifiers Array=
All skills have a modifiers array denoted by <code><array name="modifiers"> ... </array></code> that is global across the skill. It's important to note that individual modifiers within this array are positional and modifiers added in skill specializations need to be moved to the next position in the array by using <code><array><null /></array></code> blocks for each existing modifier, otherwise the new modifiers will overwrite the modifier in the existing position. This is especially important to be aware of when copying code from other classes as the number or position of modifiers may be different.
Example:
A dash skill has <code>Modifiers::SkillTriggerEffect</code> that creates a sprite. On dash, the sprite appears. Then in a skill specialization for dash, there is <code>Modifiers::SkillCost</code> that reduces the cost of dash. Putting a point in that specialization reduces the cost, but makes the base skill no longer create the sprite. If in the specialization code <code><array><null /></array></code> is placed before the block for the <code>Modifiers::SkillCost</code>, both now work correctly.
Addition info on the <null /> lines from the devs:
Skills don't just have arrays of modifiers, they have arrays of arrays of modifiers, the reason is so you can have several sets of modifiers that individually get replaced by sub skills. You can have a skill that has three sets of modifiers, one that modifies some passive thing, one that modifies the projectile that gets shot, and one that modifies some bonus attack speed, then if you wanna make a sub-skill that replaces the attack speed modifiers you just define the modifiers as
:<null />
:<null />
:<array>...</array>
=Modifier Classes=
=Modifier Classes=


Line 82: Line 97:
:TimedTriggerEffectState
:TimedTriggerEffectState
::QuantityTriggerEffectState
::QuantityTriggerEffectState
{{Template:BaseNav}}

Latest revision as of 14:18, 8 September 2023

Modifiers Array

All skills have a modifiers array denoted by <array name="modifiers"> ... </array> that is global across the skill. It's important to note that individual modifiers within this array are positional and modifiers added in skill specializations need to be moved to the next position in the array by using <array><null /></array> blocks for each existing modifier, otherwise the new modifiers will overwrite the modifier in the existing position. This is especially important to be aware of when copying code from other classes as the number or position of modifiers may be different.

Example: A dash skill has Modifiers::SkillTriggerEffect that creates a sprite. On dash, the sprite appears. Then in a skill specialization for dash, there is Modifiers::SkillCost that reduces the cost of dash. Putting a point in that specialization reduces the cost, but makes the base skill no longer create the sprite. If in the specialization code <array><null /></array> is placed before the block for the Modifiers::SkillCost, both now work correctly.


Addition info on the <null /> lines from the devs:

Skills don't just have arrays of modifiers, they have arrays of arrays of modifiers, the reason is so you can have several sets of modifiers that individually get replaced by sub skills. You can have a skill that has three sets of modifiers, one that modifies some passive thing, one that modifies the projectile that gets shot, and one that modifies some bonus attack speed, then if you wanna make a sub-skill that replaces the attack speed modifiers you just define the modifiers as

<null />
<null />
<array>...</array>

Modifier Classes

Modifiers

ModifyStack

ModifySummons

PointsFromDamageTaken

SpellCost

Thorns

TrueStrike

UnlethalDamage

UsePointsCost

Skill Modifiers

SkillModifier

BaseSkillModifier

SkillCost

SkillCrit

SkillDamageLeeching

SkillSlowScale

Stat Modifiers

ConvertStat

ConvertStatExpression

DummyModifier

StatBasedDamage

StatAdd

DamageAdd

ArmorAdd

AttribAdd

SpeedAdd

SpeedMul

Evade

DamageMulAdd

ArmorPenetration

Experience

PlayerLight

PlayerTargetedRange

CritDamage

CriticalHit

CustomStat

CustomStat2

Trigger Effect Modifiers

TriggerEffectBase

TriggerEffect
SkillTriggerEffect
TimedTriggerEffect
QuantityTriggerEffect

TriggerEffectState

TimedTriggerEffectState
QuantityTriggerEffectState