Hello, so I've been trying to make a DNumSlider that can change a DModelPanel's bodygroups/skins, I've been trying to do the code that it's in the default player_editor, but I'm having some trouble, this is the code I've got below:
if playerchosemodel.Entity:SkinCount() >= 2 then
for k = 1, playerchosemodel.Entity:GetNumBodyGroups() do
skinslider = vgui.Create( "DNumSlider", charinfo )
skinslider:SetPos( 0, 390 )
skinslider:SetSize( charinfo:GetWide(), 30 )
skinslider:SetText( "Character Skin" )
skinslider.Label:SetColor( Color( 255, 255, 255 ) )
skinslider:SetDecimals( 0 )
skinslider.type = "skinslider"
skinslider.typenum = k
skinslider:SetMax( playerchosemodel.Entity:GetBodygroupCount( k ) )
skinslider.Slider.Paint = function(s,w,h)
draw.RoundedBox( 0, 0, s:GetTall() / 2 - 1, w, 2, Color( 255, 255, 255 ) )
end
skinslider.OnValueChanged = function( self )
playerchosemodel.Entity:SetBodygroup( skinslider.typenum, math.Round( self:GetValue() ) )
end
end
end
The default player model selector has built in support for body groups.
I know, making a character creation screen, wanting to add a slider to show different bodygroups/skins.
Sorry for the confusion.
Ay, I'm a dummy, trying to change bodygroup on skin slider, didn't even notice...
Aha, all works fine!
Sorry, you need to Log In to post a reply to this thread.