Thread: Lua Chams

Results 1 to 7 of 7
  1. #1
    Trollaux's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Posts
    2,074
    Reputation
    137
    Thanks
    792

    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)
    d e a d b o y s
    Quote Originally Posted by Dave84311 View Post
    What do you call a troll with shitty jokes?
    Trollaux
    Quote Originally Posted by Kyeran View Post
    Foot job with lots of oil.
    Quote Originally Posted by Kyeran View Post
    If she's 12, I'm 12.

  2. #2
    Gray's Avatar
    Join Date
    Nov 2012
    Gender
    male
    Location
    Sweden
    Posts
    13,557
    Reputation
    2516
    Thanks
    10,618
    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.

  3. #3
    MeepDarknessMeep's Avatar
    Join Date
    Aug 2012
    Gender
    female
    Posts
    725
    Reputation
    22
    Thanks
    922
    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

  4. The Following User Says Thank You to MeepDarknessMeep For This Useful Post:

    D3M0L1T10N (01-24-2014)

  5. #4
    Trollaux's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Posts
    2,074
    Reputation
    137
    Thanks
    792
    Quote Originally Posted by Antipathy 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
    Last edited by Xenocide; 01-25-2014 at 05:25 AM. Reason: Double post.
    d e a d b o y s
    Quote Originally Posted by Dave84311 View Post
    What do you call a troll with shitty jokes?
    Trollaux
    Quote Originally Posted by Kyeran View Post
    Foot job with lots of oil.
    Quote Originally Posted by Kyeran View Post
    If she's 12, I'm 12.

  6. #5
    MeepDarknessMeep's Avatar
    Join Date
    Aug 2012
    Gender
    female
    Posts
    725
    Reputation
    22
    Thanks
    922
    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

  7. #6
    Trollaux's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Posts
    2,074
    Reputation
    137
    Thanks
    792
    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?
    d e a d b o y s
    Quote Originally Posted by Dave84311 View Post
    What do you call a troll with shitty jokes?
    Trollaux
    Quote Originally Posted by Kyeran View Post
    Foot job with lots of oil.
    Quote Originally Posted by Kyeran View Post
    If she's 12, I'm 12.

  8. #7
    MeepDarknessMeep's Avatar
    Join Date
    Aug 2012
    Gender
    female
    Posts
    725
    Reputation
    22
    Thanks
    922
    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

Similar Threads

  1. Green Body Mini-Chams Purple head Chams
    By Taylor Swift in forum Combat Arms Mods & Rez Modding
    Replies: 20
    Last Post: 07-13-2010, 09:01 PM