• Bodygroups
    3 replies, posted
Hi, firstly i have permission with phoenix on modifieing this code, im trying to assign that when i loot a winter coat item loot in gmod dayz, its give out a certain body group for a player model, its has 5 bodygroup first is skin, torso, headgear, legs, gloves, i want it so that when i pick it up and equip it its give out the second torso type for exemple i have tried codding it into one of my normal clothing items and this is what i got: ITEM = {} ITEM.Name = "Winter Jacket" ITEM.Angle = Angle(90,90,90) ITEM.Desc = "Standard winter coat" ITEM.Model = "models/props_c17/SuitCase001a.mdl" ITEM.Weight = 1 ITEM.ReqCraft = { "item_fabric", "item_fabric" } ITEM.SpawnChance = 25 ITEM.SpawnOffset = Vector(0,0,10) ITEM.Body = true ITEM.WeightFor = 10 ITEM.BodyModel = "models/half-dead/metroll/m1b1.mdl" ITEM.EquipFunc = function(ply, item, class, rarity) ply:AddAdditionalWeight( rarity, 10) end function ITEM:OnEquip(ply, modifications)     if not ply._OldModel then         ply._OldModel = ply:GetModel()     end     timer.Simple(2, function() ply:SetupHands()         ply:SetModel(self.Model)         --ply:SetSkin(1)         PrintTable(modifications)         ply:SetBodygroup(2, 2)          end)                        end ITEM.DEquipFunc = function(ply, item, class, rarity) ply:AddAdditionalWeight( rarity, -10) end ITEM.SpawnAngle = Angle(0,0,0) ITEM.LootType = { "Industrial", "Weapon" } ITEM.Rarity = 1 ITEM.LevelReq = 2 BUT still i dont get why but when i equip it i dont get any error or anything but its stay the same skin and bodygroup somehow :|
This might be too obvious of a mistake but I'm willing to shed some light on it nonetheless: suppose that your library of bodygroups looks like this: https://files.facepunch.com/forum/upload/321820/af7d14d6-474e-497c-bb11-a4b77367f3d8/image.png Very straight forward syntax; supposedly also accurately reflecting on what you have described above in your post; at least as far as I can understand it. Now, if you try to use 2, 2 as an argument for your SetBodygroup-function, you are going to run into a problem, because this coordinate doesn't actually exist in the qc-snippet above. In fact, both coordinates, body, value are ids that start from 0, 0 where 0, 0 is the first value in the first bodygroup category.* What 2, 2 is actually looking for is thus a third option in the third category, which definitely doesn't exist. This makes me want to speculate that while you are not getting any errors because your syntax is still correct, nothing is happening because you are trying to access a phantom bodygroup that doesn't exist according to the schematic above. This might be the cause, and it might also be something else; I am not going to skim through all the code because this isn't really that much of my forté, but I felt it particularly necessary to elaborate on the SetBodygroup()-function in this case. *Entity/SetBodygroup
What if i can ITEM = {} ITEM.Name = "Winter Jacket" ITEM.Angle = Angle(90,90,90) ITEM.Desc = "Standard winter coat" ITEM.Model = "models/props_c17/SuitCase001a.mdl" ITEM.Weight = 1 ITEM.ReqCraft = { "item_fabric", "item_fabric" } ITEM.SpawnChance = 25 ITEM.SpawnOffset = Vector(0,0,10) ITEM.Body = true ITEM.WeightFor = 10 ITEM.BodyModel = "models/half-dead/metroll/m1b1.mdl" ITEM:SetBodygroup( 2, 1 ) ITEM.EquipFunc = function(ply, item, class, rarity) ply:AddAdditionalWeight( rarity, 10) end  ITEM.DEquipFunc = function(ply, item, class, rarity) ply:AddAdditionalWeight( rarity, -10) end ITEM.SpawnAngle = Angle(0,0,0) ITEM.LootType = { "Industrial", "Weapon" } ITEM.Rarity = 1 ITEM.LevelReq = 2 what if i turn it like this?< ITEM = {} ITEM.Name = "Winter Jacket" ITEM.Angle = Angle(90,90,90) ITEM.Desc = "Standard winter coat" ITEM.Model = "models/props_c17/SuitCase001a.mdl" ITEM.Weight = 1 ITEM.ReqCraft = { "item_fabric", "item_fabric" } ITEM.SpawnChance = 25 ITEM.SpawnOffset = Vector(0,0,10) ITEM.Body = true ITEM.WeightFor = 10 ITEM.BodyModel = "models/half-dead/metroll/m1b1.mdl" ITEM:SetBodygroup( 2, 1 ) ITEM.EquipFunc = function(ply, item, class, rarity) ply:AddAdditionalWeight( rarity, 10) end  ITEM.DEquipFunc = function(ply, item, class, rarity) ply:AddAdditionalWeight( rarity, -10) end ITEM.SpawnAngle = Angle(0,0,0) ITEM.LootType = { "Industrial", "Weapon" } ITEM.Rarity = 1 ITEM.LevelReq = 2
Can anyone help out
Sorry, you need to Log In to post a reply to this thread.