I seem to be having some problems with an entity which doesn’t “always” explode. It sometimes explodes, and sometimes it doesn’t.
And I have a hard head into understanding why, I’ve already tried removing the “AlreadyBlewUp” but that isn’t the fix either.
local DefaultHealth = 99.2
local ExplosionRadius = 512
local ExplosionDamage = 100
if victim.DefaultHealth <= 0 and not victim.AlreadyBlewUp then victim.AlreadyBlewUp = true local effectdata = EffectData() effectdata:SetOrigin(victim:GetPos()) util.Effect("Explosion", effectdata, true, true) util.BlastDamage(inflictor, attacker, victim:GetPos(), 512, 100) victim:Remove() end
hook.Add(“EntityTakeDamage”, “EntityBlowUp”, EntityBlowUp)
The code itself isn’t really important as it works, but I don’t fully understand this util.Effect stuff.
This is what happens, you shoot the entity untill it’s health is gone, and it well explodes. But sometimes, it doesn’t explode. And sometimes it just shows the explosion effect, but doesn’t do the explosion damage.
Any ideas on this?