HelpLua Chams

Posts 17 of 7 · Page 1 of 1
Lua Chams
I'm having trouble making chams.
I want it to be so the visible player color is green, non-visible player color is blue, and the weapon color is red.
This is my code right now.
Code:
Hkrs.Chams.Mat = CreateMaterial("deznutz", "VertexLitGeneric", { ["$basetexture"] = "models/debug/debugwhite", ["$model"] = 1, ["$ignorez"] = 1 })
Hkrs.Chams.Mat2 = CreateMaterial("deznutz", "VertexLitGeneric", { ["$basetexture"] = "models/debug/debugwhite", ["$model"] = 0, ["$ignorez"] = 0 })
hook.Add("RenderScreenspaceEffects", "nutzjpg", function()
                local allents = ents.GetAll()
                for k = 1, #allents do
                        local v = allents[k]
                                cam.Start3D(EyePos(), EyeAngles())
                                        if (v:IsPlayer() and v:Alive() and v != LocalPlayer()) then
                                                local color = Color(0,255,0,255)
                                                local colour = Color(0,0,255,255)
                                                local colours = Color(255,0,0,255)
                                                render.SuppressEngineLighting(true)
                                                // Visible Player Chams
                                                render.SetColorModulation(color.r/255, color.g/255, color.b/255, 1)
                                                render.SetModelLighting(color.r/255, color.r/255, color.r/255, 255)
                                                render.MaterialOverride(Hkrs.Chams.Mat)
                                                v:DrawModel()
                                                // Swaggy Weapon Chams ( Already Work ) 
                                                render.SetColorModulation(colours.r/255, colours.g/255, colours.b/255, 1)
                                                render.SetModelLighting(colours.r/255, colours.r/255, colours.r/255, 255)
                                                render.MaterialOverride(Hkrs.Chams.Mat2)
                                                v:GetActiveWeapon():DrawModel()
                                                // Non-Visible Player Chams
                                                render.SetColorModulation(colour.r/255, colour.g/255, colour.b/255, 1)
                                                render.SetModelLighting(colour.r/255, colour.g/255, colour.b/255, 255)
                                                render.MaterialOverride()
                                                v:DrawModel()
                                                render.SuppressEngineLighting(false)
                                        end
                                cam.End3D()
                end
end)
I recall having done something like this, I'm not quite sure what the problem is, so I'll leave it to the people that are.
Although, I do recall the $ignorez thing being limited by sv_pure.
Quote Originally Posted by Gray View Post
I recall having done something like this, I'm not quite sure what the problem is, so I'll leave it to the people that are.
Although, I do recall the $ignorez thing being limited by sv_pure.
Do you still have the code? I'm going for the kind of old-school combat arms chams.


Quote Originally Posted by MeepDarknessMeep View Post
try this pseudo code:

stencil: on
stencilclear
stenciloperation: stencil_always
stencilpassoperation: stencil_replace
stencilzfailoperation: stencil_increase
stencilfailoperation: stencil_keep
stencilreferencevalue: 2
stencilwritevalue: 2
start3d
for all players: DrawModel()
end3d
stenciloperation: stencil_equal
set color for regular seeing
drawquad
stencil off
@MeepDarknessMeep I looked up render.SetStencil stuff but I couldn't find WriteValue or StencilOperation.
Could you have meant WriteMask?
I couldn't find some sort of alternative for StencilOperation
Quote Originally Posted by Trollaux View Post
I'm having trouble making chams.
I want it to be so the visible player color is green, non-visible player color is blue, and the weapon color is red.
This is my code right now.
Code:
Hkrs.Chams.Mat = CreateMaterial("deznutz", "VertexLitGeneric", { ["$basetexture"] = "models/debug/debugwhite", ["$model"] = 1, ["$ignorez"] = 1 })
Hkrs.Chams.Mat2 = CreateMaterial("deznutz", "VertexLitGeneric", { ["$basetexture"] = "models/debug/debugwhite", ["$model"] = 0, ["$ignorez"] = 0 })
hook.Add("RenderScreenspaceEffects", "nutzjpg", function()
                local allents = ents.GetAll()
                for k = 1, #allents do
                        local v = allents[k]
                                cam.Start3D(EyePos(), EyeAngles())
                                        if (v:IsPlayer() and v:Alive() and v != LocalPlayer()) then
                                                local color = Color(0,255,0,255)
                                                local colour = Color(0,0,255,255)
                                                local colours = Color(255,0,0,255)
                                                render.SuppressEngineLighting(true)
                                                // Visible Player Chams
                                                render.SetColorModulation(color.r/255, color.g/255, color.b/255, 1)
                                                render.SetModelLighting(color.r/255, color.r/255, color.r/255, 255)
                                                render.MaterialOverride(Hkrs.Chams.Mat)
                                                v:DrawModel()
                                                // Swaggy Weapon Chams ( Already Work ) 
                                                render.SetColorModulation(colours.r/255, colours.g/255, colours.b/255, 1)
                                                render.SetModelLighting(colours.r/255, colours.r/255, colours.r/255, 255)
                                                render.MaterialOverride(Hkrs.Chams.Mat2)
                                                v:GetActiveWeapon():DrawModel()
                                                // Non-Visible Player Chams
                                                render.SetColorModulation(colour.r/255, colour.g/255, colour.b/255, 1)
                                                render.SetModelLighting(colour.r/255, colour.g/255, colour.b/255, 255)
                                                render.MaterialOverride()
                                                v:DrawModel()
                                                render.SuppressEngineLighting(false)
                                        end
                                cam.End3D()
                end
end)
try this pseudo code:

stencil: on
stencilclear
stenciloperation: stencil_always
stencilpassoperation: stencil_replace
stencilzfailoperation: stencil_increase
stencilfailoperation: stencil_keep
stencilreferencevalue: 2
stencilwritevalue: 2
start3d
for all players: DrawModel()
end3d
stenciloperation: stencil_equal
set color for regular seeing
drawquad
stencil off
Quote Originally Posted by Trollaux View Post

@MeepDarknessMeep I looked up render.SetStencil stuff but I couldn't find WriteValue or StencilOperation.
Could you have meant WriteMask?
I couldn't find some sort of alternative for StencilOperation
I meant CompareFunction, sorry
Quote Originally Posted by MeepDarknessMeep View Post
I meant CompareFunction, sorry
Ok I will try it later. Also I love your sig, did you make that yourself or is it fake?
Quote Originally Posted by Trollaux View Post


Ok I will try it later. Also I love your sig, did you make that yourself or is it fake?
Overv made it, yes it's real
Posts 17 of 7 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?