• Does Anyone have the old "prop spawn" effect code?
    1 replies, posted
I ask because it is pretty important to a project I'm working on. [highlight](User was banned for this post ("Wrong section" - mahalis))[/highlight]
[lua] local matRefract = Material("models/spawn_effect") local matLight = Material("models/spawn_effect2") function EFFECT:Init(data) self.Time = 1.5 self.LifeTime = CurTime() + self.Time local ent = data:GetEntity() if (ent == NULL) then return end self.ParentEntity = ent self:SetModel(ent:GetModel()) self:SetPos(ent:GetPos()) self:SetAngles(ent:GetAngles()) self:SetParent(ent) end function EFFECT:Think() if (!self.ParentEntity or !self.ParentEntity:IsValid()) then return false end local PPos = self.ParentEntity:GetPos(); self:SetPos(PPos + (EyePos() - PPos):GetNormal()) return (self.LifeTime > CurTime()) end function EFFECT:Render() local Fraction = (self.LifeTime - CurTime()) / self.Time local ColFrac = (Fraction-0.5) * 2 Fraction = math.Clamp(Fraction, 0, 1) ColFrac = math.Clamp(ColFrac, 0, 1) self:SetColor(255, 255, 255, 1 + 254 * (ColFrac)) local EyeNormal = self:GetPos() - EyePos() local Distance = EyeNormal:Length() EyeNormal:Normalize() local Pos = EyePos() + EyeNormal * Distance * 0.01 cam.Start3D(Pos, EyeAngles()) if (ColFrac > 0) then SetMaterialOverride(matLight) self:DrawModel() SetMaterialOverride(0) end if (render.GetDXLevel() >= 80) then render.UpdateRefractTexture() matRefract:SetMaterialFloat("$refractamount", Fraction * 0.1) SetMaterialOverride(matRefract) self:DrawModel() SetMaterialOverride(0) end cam.End3D() end [/lua]
Sorry, you need to Log In to post a reply to this thread.