Trying to convert an old addon from 2010 to gmod version 2018 having trouble with the method that was used to prevent self damage.
timer.Simple(2, function()
local dmg = DamageInfo()
dmg:SetDamageType( DMG_BLAST | DMG_PLASMA )
dmg:SetDamage( 100 )
dmg:SetDamagePosition( self:LocalToWorld(self:OBBCenter()) )
dmg:SetDamageForce( VectorRand() * 512 )
dmg:SetInflictor(self:GetOwner())
dmg:SetAttacker(self:GetOwner())
for k, v in pairs(ents.FindInSphere(self:GetPos(), 250)) do
local a = self:LocalToWorld(self:OBBCenter())
local b = v:LocalToWorld(v:OBBCenter())
local theta = (a-b):Normalize()
if v:GetMoveType() == MOVETYPE_VPHYSICS then
local phys = v:GetPhysicsObject()
phys:ApplyForceCenter(theta * -500 * phys:GetMass())
end
if v:GetClass() == "morph_ball_ent" then
else
v:TakeDamageInfo(dmg)
end
end
self:EmitSound("npc/dog/dog_drop_gate1.wav")
self:Remove()
end
)
ParticleEffectAttach("larvae_glow_extract_b", PATTACH_ABSORIGIN, self, 0)
ParticleEffectAttach("cingularity", PATTACH_ABSORIGIN, self, 0)
ParticleEffectAttach("vortigaunt_charge_token", PATTACH_ABSORIGIN, self, 0)
spawnTime = CurTime()
Just check if v is the owner when applying the damage?
How would you go about that
Sorry, you need to Log In to post a reply to this thread.