Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if SERVER then return end
- CreateClientConVar("Fairy_ID", 0, true, false);
- CreateClientConVar("Fairy_Light_Brightness", 0, true, false);
- //====================
- // Function Prototypes
- //====================
- local MainThink;
- local Light;
- local Sprite;
- //====================
- local Fairy;
- local emitter = ParticleEmitter(Vector(), false);
- emitter:SetNoDraw(true);
- local Glowmat = CreateMaterial("glow","UnlitGeneric", {
- ["$basetexture"] = "sprites/light_glow01",
- ["$additive"] = 1,
- ["$translucent"] = 1,
- ["$vertexalpha"] = 1,
- ["$vertexcolor"] = 1,
- })
- local Glowmat2 = CreateMaterial("glow2","UnlitGeneric", {
- ["$basetexture"] = "sprites/glow06",
- ["$additive"] = 1,
- ["$translucent"] = 1,
- ["$vertexalpha"] = 1,
- ["$vertexcolor"] = 1,
- })
- local Glowmat3 = CreateMaterial("glow3","UnlitGeneric", {
- ["$basetexture"] = "sprites/glow1",
- ["$additive"] = 1,
- ["$translucent"] = 1,
- ["$vertexalpha"] = 1,
- ["$vertexcolor"] = 1,
- })
- local Particle = "effects/yellowflare"
- function MainThink()
- if (!IsValid(Fairy) or Fairy == nil) then
- for _,v in pairs(ents.GetAll()) do
- if(IsValid(v) && v:EntIndex() == GetConVarNumber("Fairy_ID")) then
- Fairy = v;
- end
- end
- else
- Fairy.r,Fairy.g,Fairy.b,Fairy.a = Fairy:GetColor()
- Fairy.pos = Fairy:GetPos()
- Light();
- Sprite();
- end
- end
- function Light()
- local light = DynamicLight(0);
- if (light) then
- light.Pos = Fairy.pos;
- light.r = Fairy.r;
- light.g = Fairy.g;
- light.b = Fairy.b;
- light.Size = 75;
- light.Brightness = 1;
- light.DieTime = CurTime() + 0.3;
- light.Style = 0;
- end
- end
- function Sprite()
- Glowmat:SetMaterialVector("$color",Vector((Fairy.r/255),(Fairy.g/255),(Fairy.b/255)));
- render.SetMaterial(Glowmat);
- render.DrawSprite(Fairy.pos,20,20,Color(0,0,0,0));
- Glowmat2:SetMaterialVector("$color",Vector((Fairy.r/255),(Fairy.g/255),(Fairy.b/255)));
- Glowmat2:SetMaterialFloat("$alpha",0.3);
- render.SetMaterial(Glowmat2);
- render.DrawSprite(Fairy.pos,100,100,Color(0,0,0,0));
- Glowmat3:SetMaterialVector("$color",Vector((Fairy.r/255),(Fairy.g/255),(Fairy.b/255)));
- Glowmat3:SetMaterialFloat("$alpha",0.025);
- render.SetMaterial(Glowmat3);
- render.DrawSprite(Fairy.pos,100,100,Color(0,0,0,0));
- end
- hook.Add("Think","MainThasdasdink",MainThink);
- hook.Add("PreDrawTranslucentRenderables","sprite",MainThink);
Add Comment
Please, Sign In to add comment