daily pastebin goal
24%
SHARE
TWEET

Untitled

a guest May 16th, 2018 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if SERVER then return end
  2.  
  3. CreateClientConVar("Fairy_ID", 0, true, false);
  4. CreateClientConVar("Fairy_Light_Brightness", 0, true, false);
  5.  
  6. //====================
  7. // Function Prototypes
  8. //====================
  9.  
  10. local MainThink;
  11. local Light;
  12. local Sprite;
  13.  
  14. //====================
  15. local Fairy;
  16. local emitter = ParticleEmitter(Vector(), false);
  17. emitter:SetNoDraw(true);
  18.  
  19. local Glowmat = CreateMaterial("glow","UnlitGeneric", {
  20.     ["$basetexture"] = "sprites/light_glow01",
  21.     ["$additive"] = 1,
  22.     ["$translucent"] = 1,
  23.     ["$vertexalpha"] = 1,
  24.     ["$vertexcolor"] = 1,
  25. })
  26. local Glowmat2 = CreateMaterial("glow2","UnlitGeneric", {
  27.     ["$basetexture"] = "sprites/glow06",
  28.     ["$additive"] = 1,
  29.     ["$translucent"] = 1,
  30.     ["$vertexalpha"] = 1,
  31.     ["$vertexcolor"] = 1,
  32. })
  33. local Glowmat3 = CreateMaterial("glow3","UnlitGeneric", {
  34.     ["$basetexture"] = "sprites/glow1",
  35.     ["$additive"] = 1,
  36.     ["$translucent"] = 1,
  37.     ["$vertexalpha"] = 1,
  38.     ["$vertexcolor"] = 1,
  39. })
  40.  
  41. local Particle = "effects/yellowflare"
  42.  
  43.  
  44. function MainThink()
  45.     if (!IsValid(Fairy) or Fairy == nil) then
  46.         for _,v in pairs(ents.GetAll()) do
  47.             if(IsValid(v) && v:EntIndex() == GetConVarNumber("Fairy_ID")) then
  48.                 Fairy = v;
  49.             end
  50.         end
  51.     else
  52.         Fairy.r,Fairy.g,Fairy.b,Fairy.a = Fairy:GetColor()
  53.         Fairy.pos = Fairy:GetPos()
  54.        
  55.         Light();
  56.         Sprite();
  57.     end
  58. end
  59.  
  60. function Light()
  61.     local light = DynamicLight(0);
  62.     if (light) then
  63.         light.Pos = Fairy.pos;
  64.         light.r = Fairy.r;
  65.         light.g = Fairy.g;
  66.         light.b = Fairy.b;
  67.         light.Size = 75;
  68.         light.Brightness = 1;
  69.         light.DieTime = CurTime() + 0.3;
  70.         light.Style = 0;
  71.     end
  72. end
  73.  
  74. function Sprite()
  75.     Glowmat:SetMaterialVector("$color",Vector((Fairy.r/255),(Fairy.g/255),(Fairy.b/255)));
  76.     render.SetMaterial(Glowmat);
  77.     render.DrawSprite(Fairy.pos,20,20,Color(0,0,0,0));
  78.    
  79.     Glowmat2:SetMaterialVector("$color",Vector((Fairy.r/255),(Fairy.g/255),(Fairy.b/255)));
  80.     Glowmat2:SetMaterialFloat("$alpha",0.3);
  81.     render.SetMaterial(Glowmat2);
  82.     render.DrawSprite(Fairy.pos,100,100,Color(0,0,0,0));
  83.    
  84.     Glowmat3:SetMaterialVector("$color",Vector((Fairy.r/255),(Fairy.g/255),(Fairy.b/255)));
  85.     Glowmat3:SetMaterialFloat("$alpha",0.025);
  86.     render.SetMaterial(Glowmat3);
  87.     render.DrawSprite(Fairy.pos,100,100,Color(0,0,0,0));
  88. end
  89.    
  90.  
  91.  
  92. hook.Add("Think","MainThasdasdink",MainThink);
  93. hook.Add("PreDrawTranslucentRenderables","sprite",MainThink);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top