In HealHitZones() when contextTemplate is null, the fallback fails. Assign it to a local variable and it works fine. In the example below, when contextTemplate is null, damageEffect still returns null after the fallback and causes a VME.
if (!contextTemplate)
{
vector hitPosDirNorm[3]
contextTemplate = SCR_DamageContext(EDamageType.HEALING, 0, hitPosDirNorm, GetOwner(), null, null, null, 0, 0)
}
if (!contextTemplate.damageEffect)
contextTemplate.damageEffect = new SCR_HealingDamageEffect()
If you use a local variable, it works just fine. Suggested fix, create local context and replace all instances of contextTemplate with context as follows:
SCR_DamageContext context = contextTemplate
if (!context)
{
vector hitPosDirNorm[3]
context = SCR_DamageContext(EDamageType.HEALING, 0, hitPosDirNorm, GetOwner(), null, null, null, 0, 0)
}
if (!context.damageEffect)
context.damageEffect = new SCR_HealingDamageEffect()
if (sequential)
healthToDistribute = HealHitZonesInSequence(healthToDistribute, maxHealThresholdScaled, targetHitZones, context)
else // if in Parallel
healthToDistribute = HealHitZonesInParallel(healthToDistribute, maxHealThresholdScaled, targetHitZones, context)