Syntax for editing crap in peoples hands?

Dunno the syntax for editing shit in people’s hands.

I used bone manipulation to move their body parts around to get the pose I needed but I am trying to figure out the bone name that allows me to edit whatever they are holding (phone, gun, whatever).
How would I do that, is it even possible with bone manipulation?

Bonemerging can do it.

[editline]4th December 2016[/editline]

Here’s a file that gives you a hint of how it works

A way to do it without using an addon and without having to spawn any entites?
Because I need to code it.

You can’t parent a model to another model without first spawning the other model?

The other file I linked shows the way to do it without the addon - you just need to use

Entity:AddEffects with EF_BONEMERGE as the effect and then do a couple other things

This isn’t another entity or model, this is the weapon the guy holds. For example, how would I edit the pistol postion that the person holds? If they have a pistol swep.

I’m guessing something along the lines of



gun:SetParent(person)
gun:Fire("setparentattachment", "righthand")
gun:AddEffects(EF_BONEMERGE)


Sorry, I should be testing this, just a rough idea

I see what you are saying now. Thanks.

I just tried this and it seems to work serverside - except it doesn’t move to the hand…



local ent = Entity(1):GetEyeTrace().Entity
ent:SetParent(Entity(1))
ent:Fire("setparentattachment", "righthand")
ent:AddEffects(EF_BONEMERGE)


Maybe there’s a way to do an offset or something, I’m not sure, I’m not familiar with bonemerging

Ll nvm, let me show you.

This isn’t a second model or entity dude, it’s a swep. It’s part of the swep.

Something like this?

Yea, now if it was a world model and I could set it, that would be great.

Edit*

Just gonna use DrawWorldModel(). Now onward to figure out how to actually edit it.

Use ClientsideModel

The only question is, how do I edit the positions. I have no clue :confused:



local model = ClientsideModel( "models/XQM/Rails/gumball_1.mdl" )
model:SetPos(Vector(0,0,0))


???

I don’t think that will move with the body though, (if the person crouches, jumpes, etc)



local cvm = ClientsideModel( "models/XQM/Rails/gumball_1.mdl" )
    cvm:SetNoDraw( true )
function SWEP:PreDrawViewModel(vm)
        if not self:GetSnowball(false) then
            -- lazy way to hide viewmodel if there's no Snowball
            local bcount = vm:GetBoneCount()
            local b = Matrix()
            b:SetScale(Vector(0,0,0))
            for i = 0,bcount do
                vm:SetBoneMatrix(i, b )
            end
            return
        end
        local a = vm:LookupBone("ValveBiped.Grenade_body")
-- Make empty matrix to use for 0 scale
        local b = Matrix()
        b:SetScale(Vector(0,0,0))
-- Get bone matrix of the grenade
        local m = vm:GetBoneMatrix(a)
-- Get local pos and angle for the snowball
        local pos, ang = LocalToWorld( Vector(0,0,-1), Angle(0,0,0), m:GetTranslation(), m:GetAngles() )
-- Set pos and ang
        cvm:SetPos( pos )
        cvm:SetAngles( ang )
        cvm:SetModelScale(0.15)
-- Draw clientside model
        cvm:DrawModel()
-- Remove the grenade 
        vm:SetBoneMatrix( a, b )
-- Remove the grenade pin
        local a = vm:LookupBone("ValveBiped.Pin")
        vm:SetBoneMatrix( a, b )
    end


Used in my snowball swep, replaces the grenade from hl2 viewmodel with a ball. I think this is the example you’re looking for?

Kevlon has a very good example. If you want to go an incredibly easy route as well, there’s the Swep Construction Kit.