Why is it Purple

Hey, i’ve been trying to convert an addon. But the Entity is purple:


	self:SetColor(Color(255, 255, 255, 255));
	self:SetRenderMode( RENDERMODE_TRANSALPHA );

Anybody knows what im doing wrong?

  • Thanks.

This isn’t really detailed, maybe give more of the code?

Odd, this is what I used:

self:SetColor( Color(255, 0, 0, 255))

and it works for me.

[editline]1st July 2013[/editline]

If i’m not mistaken, purple indicates that the color specified is invalid, are you setting the entities color anywhere else or only those two lines?

Here it is: http://pastebin.com/zWYCCd88

I don’t understand why it’s doing this, try replacing


self:SetColor(Color(255, 255, 255, 255));

with


self:SetColor( Color(255, 255, 255, 255))

I doubt that’s gona do anything but it’s worth a try.

Now it’s just red…

I edited it, sorry, try now.

It is still purple…

I’ve ran into this problem before. What you need to do is set the Entity’s Rendergroup and add a function to your cl_init.lua for the ent.

So, in cl_init.lua add (outside of any function)

[lua]ENT.RenderGroup = RENDERGROUP_BOTH[/lua]

And then after that write this function

[lua]
function ENT:DrawTranslucent()
self:Draw()
end
[/lua]

Also, make sure you’re setting your render mode before you color the ent.

EDIT:

Now that I’ve seen that you posted the ENT’s code. Here is the modified version that shouldn’t have a problem with transparency: http://pastebin.com/FbWb2TfE