Can someone tell me what I've done wrong? Pointshop, bodygroups and derma.
0 replies, posted
What I'm trying to do: Allow players to modify their playermodel's bodygroups within pointshop.
What I have done: Created derma stuff with sliders for separate bodygroups, includes a preview window of changes to the playermodel.
What's the problem?: Everything works great, the sliders and preview window are fantastic; however, when I click the button to "apply" the changes, nothing is happening, it just closes the modifications window without actually applying the changes. I suck at lua, but I'm not asking for someone to fix things for me. I won't learn anything otherwise, but, It would be greatly appreciated if you could point me in the right direction.
After clicking the apply button there are no errors shown in the console.
-- Apply button
self.Button = self:Add ('DButton')
self.Button:Dock (BOTTOM)
self.Button:SetText ('Apply')
-- Send modifications
self.Button.DoClick = function ()
if not self.Item.ID then
self:Close ()
print ('could not get self.Item.ID')
return
end
for i, slider in pairs (self.Sliders) do
self.Modifications [i] = slider:GetValue ()
end
PS:SendModifications (self.Item.ID, self.Modifications)
self:Close ()
end
I've looked around what feels like the entire internet searching for solutions to this problem, with no luck.
I'm running the derma stuff from lua/autorun/client
I'm using _undefined ps
I'm using these functions in the playermodel lua files in pointshop -
local FileName = "haku.lua"
function ITEM:OnEquip(ply, modifications)
if not ply._OldModel then
ply._OldModel = ply:GetModel()
end
timer.Simple (2, function()
ply:SetModel(self.Model)
ply:SetBodygroup (1, modifications.group1 or 0)
ply:SetBodygroup (2, modifications.group2 or 0)
ply:SetBodygroup (3, modifications.group3 or 0)
ply:SetBodygroup (4, modifications.group4 or 0)
ply:SetBodygroup (5, modifications.group5 or 0)
ply:SetBodygroup (6, modifications.group6 or 0)
ply:SetBodygroup (7, modifications.group7 or 0)
ply:SetBodygroup (8, modifications.group8 or 0)
ply:SetBodygroup (9, modifications.group9 or 0)
end)
end
function ITEM:OnHolster(ply)
if ply._OldModel then
ply:SetModel(ply._OldModel)
end
end
function ITEM:PlayerSetModel(ply)
ply:SetModel(self.Model)
end
function ITEM:Modify (modifications)
local BGPicker = vgui.Create ('PS_BodygroupPickerWindow')
BGPicker:SetParams (self, modifications)
BGPicker:AddSkin ('Skin', 7)
BGPicker:AddBodygroup ('Hair', 3, 1)
BGPicker:AddBodygroup ('Ribbon', 4, 1)
BGPicker:AddBodygroup ('Ears', 5, 1)
BGPicker:AddBodygroup ('Glasses', 6, 1)
BGPicker:AddBodygroup ('Bracelet', 7, 1)
BGPicker:AddBodygroup ('Pareo', 8, 1)
BGPicker:AddBodygroup ('Underware', 9, 1)
BGPicker:AddBodygroup ('Legs', 10, 1)
BGPicker:AddBodygroup ('Sandles', 11, 1)
end
function ITEM:OnModify (ply, modifications)
self:OnEquip (ply, modifications)
end
Sorry, you need to Log In to post a reply to this thread.