• Dynamic Lights Broken?
    4 replies, posted
So I have been trying to mess around with putting a dynamic light in my effect code but it never worked. I found this odd because I knew I was doing everything right. I pulled out another weapon that had one in its effects and that I knew worked before, but it didn't this time. I then pulled out the light tool and spawned a light, not even that was working. So what the fuck is going on? Is this happening to anyone else or just me? I have no effect packs or anything of the sort installed and my settings are on highest.
They work fine, show some code?
I am pretty sure its not my code since the light tool isn't even working but here ya go. [code] function EFFECT:Init(data) self.WeaponEnt = data:GetEntity() self.Attachment = data:GetAttachment() self.Position = self:GetTracerShootPos(data:GetOrigin(), self.WeaponEnt, self.Attachment) self.Forward = data:GetNormal() self.Angle = self.Forward:Angle() self.Right = self.Angle:Right() local AddVel = self.WeaponEnt:GetOwner():GetVelocity() local emitter = ParticleEmitter(self.Position) local particle = emitter:Add("sprites/heatwave", self.Position + Vector(0,0,1)) particle:SetVelocity(80*self.Forward + 20*VectorRand()) particle:SetDieTime(math.Rand(0.15,0.2)) particle:SetStartSize(math.random(25,19)) particle:SetEndSize(0) particle:SetRoll(math.Rand(180,480)) particle:SetRollDelta(math.Rand(-1,1)) particle:SetAirResistance(160) for i=-1,1 do local particle = emitter:Add("effects/muzzleflash2", self.Position + Vector(0,-1,1)) particle:SetVelocity(Vector(0,0,0)) particle:SetDieTime(0.1) particle:SetStartAlpha(math.Rand(200,255)) particle:SetEndAlpha(0) particle:SetStartSize(math.random(3,5)) particle:SetEndSize(math.Rand(2,1)) particle:SetRoll(0) particle:SetRollDelta(0) particle:SetColor(255,255,255) particle:SetAirResistance(160) end for i=-1,1 do local particle = emitter:Add("particle/smokesprites_000"..math.random(1,9), self.Position + Vector(0,0,1)) particle:SetVelocity(100*self.Forward + 20*VectorRand()) particle:SetDieTime(math.Rand(1.2,0.2)) particle:SetStartAlpha(math.Rand(10,40)) particle:SetEndAlpha(0) particle:SetStartSize(math.random(2,3)) particle:SetEndSize(math.Rand(5,6)) particle:SetRoll(math.Rand(30,40)) particle:SetRollDelta(math.Rand(-1,1)) particle:SetColor(150,150,150) particle:SetAirResistance(160) end for i=-1,1 do local particle = emitter:Add("particle/smokesprites_000"..math.random(1,9), self.Position + Vector(0,-1,1)) particle:SetVelocity(10*i*self.Right) particle:SetDieTime(math.Rand(1.2,0.2)) particle:SetStartAlpha(math.Rand(10,30)) particle:SetEndAlpha(0) particle:SetStartSize(math.random(2,3)) particle:SetEndSize(math.Rand(5,6)) particle:SetRoll(math.Rand(30,40)) particle:SetRollDelta(math.Rand(-1,1)) particle:SetColor(150,150,150) particle:SetAirResistance(160) end local dlight = DynamicLight(self:EntIndex()) if (dlight) then print("ya") dlight.Pos = self.Position dlight.r = 160 dlight.g = 50 dlight.b = 0 dlight.Brightness = 0.5 dlight.size = 600 dlight.DieTime = CurTime() + 0.1 end emitter:Finish() end function EFFECT:Think() return false end function EFFECT:Render() end[/code] Everything works except the light
It seems fine; the only thing I do differently in mine is define a Decay ( which shouldn't matter as you have a DieTime set ), and instead of just using the EntIndex, I use EntIndex + key ( key being the number of light from 1 to x. I spawn 2 max ) -- Also shouldn't matter... The only other thing I can think of, is the Position. Is self.Position a valid spot? You could try teleporting yourself to vector_origin and setting the position there to see.. Or the brightness / size. I see that the brightness is very low. If your brightness and size are too low, it won't be seen or it'll be too faint to see easily. Try upping the values a tad. Brightness 5, Size 2048 should be pretty blinding.
The position works fine as all the other effects spawn in the correct place. As I have said, everything that uses dynamic lights has broken in my game. Here is the light entity spawned by the light tool. [IMG_THUMb]http://puu.sh/6RQxO.jpg[/IMG_THUMB] It emits no light at all. So something has gone screwy with my game.
Sorry, you need to Log In to post a reply to this thread.