Applying SWEP Base to Default HL2 Weapons

Hey guys. I’m a beginner, and I want to code a dash gun mechanic (weapon is lowered, and sways when player is sprinting, much like in any modern FPS shooter, e.g. Battlefield) for the default HL2 weapons, (specifically talking about the crossbow, but not relevant atm). I’ve been recommended to code an entirely new SWEP base.

I think I understand how SWEP bases work, but I don’t yet understand how to apply a SWEP base to the default HL2 weapons without somehow recreating them.

I’d be happy if someone could explain in short (or big, the more the better ^^) how SWEP bases work in general (less the technical side, more the idea) and then, technically speaking, how to actually apply a SWEP base to the default HL2 weapons.

I’m sorry if I was unclear or did not elaborate enough. Please let me know if I should have mentioned something I’m overlooking. Also I hope I’m not asking for too much, I don’t know how much of it there is. :stuck_out_tongue:

Thanks a bunch!

Short answer: you don’t.

Thanks for replying.

So what is an alternative approach to this? Surely something can be done to change the position and angle of HL2 weapons, just like its done in the context menu, when hovering the cursor on the screen?

Use this to move it: http://wiki.garrysmod.com/page/WEAPON/PostDrawViewModel

For anything else, you’re out of luck. HL2 weapons use a non-modifiable C++ base.

You could use GM:CalcViewModelView afaik.

Thanks Robotboy. I started working with it, it serves me best. For now I’ll spare other fancy gun mechanics I thought about using.

Cheersnstuff