• Problems with viewmodel bodygroups
    7 replies, posted
Earlier today I asked about bodygroups in view models, and found a solution that worked pretty well - this line of code, to be exact. [code]function SWEP:Deploy() self.Owner:GetViewModel():SetBodygroup(1, 1) return true end[/code] However, I've come across a problem. It doesn't only change the bodygroups for that one model - it changes them for any and all weapons that have a bodygroup in that category. So a SWEP meant to not have its 1 bodygroup set to 1 will irreversably have it set to 1 once the other SWEP has been drawn. Is there any way I can prevent this from happening?
Yeah, you must reset it every time you switch away from the weapon or drop it or remove it, etc.
What function should I place to do this? Should I set the bodygroups to 0, 0 on holster or something like that?
Set all changed bodygroups to 0
With function SWEP:Holster, or something else? [editline]25th June 2015[/editline] Is there another function I could try out...? SWEP:Holster didn't really seem to do much of anything when I tried this: [code]function SWEP:Holster() self.Owner:GetViewModel():SetBodygroup(0, 0) return true end [/code]
Bumping because I didn't get a clear answer on how I would go about clearing it when the weapon is put away. I know I'd have to set the bodygroups back to 0, 0, but how? Putting that information in SWEP:Holster did nothing, as I said in the above post.
The arguments on SetBodygroup are not just the same two numbers in a row; the first argument is [I]which[/I] Bodygroup to change, and the second is [I]what to change it to.[/I] in your case, you would wanna do SetBodygroup(1, 0)
[QUOTE=Zet0r;48052368]The arguments on SetBodygroup are not just the same two numbers in a row; the first argument is [I]which[/I] Bodygroup to change, and the second is [I]what to change it to.[/I] in your case, you would wanna do SetBodygroup(1, 0)[/QUOTE] You know now that I think about it this makes total sense and I'm not entirely sure why I didn't put two and two together at first, but thank you tons!
Sorry, you need to Log In to post a reply to this thread.