K found a the problem for Ub Post mortem/plague
#################################################################################################################
# Buff - Plague II
#################################################################################################################
BuffBlueprint {
Name = 'HEPA01Plague02',
DisplayName = '<LOC ABILITY_HEPA01_0062>Plague',
Description = '<LOC ABILITY_HEPA01_0042>Taking poison damage. Spreads to allies.',
BuffType = 'HEPA01PLAGUE',
Debuff = true,
CanBeDispelled = true,
EntityCategory = 'MOBILE - UNTARGETABLE',
Stacks = 'IGNORE',
Duration = 30,
DurationPulse = 30,
Affects = {
Health = {Add = -15},
},
Effects = 'Plague01',
EffectsBone = -2,
DamageSelf = true,
CanBeEvaded = false,
CanBackfire = false,
CanDamageReturn = false,
DamageFriendly = true,
ArmorImmune = true,
CanCrit = false,
CanMagicResist = true,
#NoFloatText = true,
AffectRadius = 10,
AffectChance = 100,
NumIgnoreSpreadPulses = 1, # Number of pulses to wait before spreading plague
Icon = '/DGUncleanBeast/NewUncleanPlague01',
OnApplyBuff = function( self, unit, instigator )
unit.Callbacks.OnKilled:Add(self.UnitOnKilledCallback, self)
end,
OnBuffAffect = function(self, unit, instigator)
#LOG("*DEBUG: OnBuffAffect unit: "..unit:GetUnitId().. " inst:"..instigator:GetUnitId())
if unit:IsDead() or instigator:IsDead() or not instigator.Plague then
return
end
# Allows for ignoring OnBuffAffect pulses, so this doesn't trigger immediately on the first
# application of plague.
if unit.PlagueInstance.IgnoreAffectPulses then
unit.PlagueInstance.NumIgnoredPulses = unit.PlagueInstance.NumIgnoredPulses + 1
if unit.PlagueInstance.NumIgnoredPulses >= self.NumIgnoreSpreadPulses then
unit.PlagueInstance.IgnoreAffectPulses = false
end
return
end
local targets = unit:GetAIBrain():GetUnitsAroundPoint((categories.MOBILE - categories.UNTARGETABLE), unit:GetPosition(), self.AffectRadius, 'Ally')
PlagueSpread02( instigator, targets, self.AffectChance )
end,
OnBuffRemove = function(self, unit)
#self:DecrementPlagueCounter(unit)
Buff.ApplyBuff(unit, 'HEPA01PlagueImmune', unit)
end,
UnitOnKilledCallback = function( self, unit )
unit.Callbacks.OnKilled:Remove(self.UnitOnKilledCallback)
#self:DecrementPlagueCounter(unit)
end,
DecrementPlagueCounter = function(self, unit)
local instigator = unit.PlagueInstance.Instigator
if not instigator then
LOG( 'No Instigator' )
end
if not instigator:IsDead() then
instigator.Plague.NumPlaguedUnits = instigator.Plague.NumPlaguedUnits - 1
unit.PlagueInstance = nil
end
end,
}
Problem code bolded.
This function removes the callback used by post mortem and so it doesnt activate. Removing it allows post mortem to work as usual. Seems to me tho that this is a development descision and not a coding accident.
Two work arounds that i can see to be fairly easy and effective:
1. delete these line of code but i am not sure what add on effect this will have.
2. Add post mortem effect to all units which die of plague. I cannot see this as a problem as i figure plague is caused by ub anyway.
Code for 2.:
OnApplyBuff = function( self, unit, instigator )
unit.Callbacks.OnKilled:Add(self.UnitOnKilledCallback, self)
end,
OnBuffAffect = function(self, unit, instigator)
#LOG("*DEBUG: OnBuffAffect unit: "..unit:GetUnitId().. " inst:"..instigator:GetUnitId())
if unit:IsDead() or instigator:IsDead() or not instigator.Plague then
return
end
# Allows for ignoring OnBuffAffect pulses, so this doesn't trigger immediately on the first
# application of plague.
if unit.PlagueInstance.IgnoreAffectPulses then
unit.PlagueInstance.NumIgnoredPulses = unit.PlagueInstance.NumIgnoredPulses + 1
if unit.PlagueInstance.NumIgnoredPulses >= self.NumIgnoreSpreadPulses then
unit.PlagueInstance.IgnoreAffectPulses = false
end
return
end
local targets = unit:GetAIBrain():GetUnitsAroundPoint((categories.MOBILE - categories.UNTARGETABLE), unit:GetPosition(), self.AffectRadius, 'Ally')
PlagueSpread02( instigator, targets, self.AffectChance )
end,
OnBuffRemove = function(self, unit)
#self:DecrementPlagueCounter(unit)
Buff.ApplyBuff(unit, 'HEPA01PlagueImmune', unit)
end,
UnitOnKilledCallback = function( self, unit )
############Added Code
unit.Callbacks.OnKilled:Add(PMExplode, self)
############ End Added Code
unit.Callbacks.OnKilled:Remove(self.UnitOnKilledCallback)
#self:DecrementPlagueCounter(unit)
end,
DecrementPlagueCounter = function(self, unit)
local instigator = unit.PlagueInstance.Instigator
if not instigator then
LOG( 'No Instigator' )
end
if not instigator:IsDead() then
instigator.Plague.NumPlaguedUnits = instigator.Plague.NumPlaguedUnits - 1
unit.PlagueInstance = nil
end
end,
}