New Weapon and Inventory System

Started by adair_19 3 posts 95 views

Reply on sbox.game
  1. #1
    adair_19
    Very new to sbox and just learning/playing around. Can someone explain to me how to implement the new inventory and weapon system onto the included player controller? I get as far as making the weapon prefab, having it in the characters starting loadout. When the game launches I get the reticle and can "shoot" but having a hard time figuring out the view and world models. I have been using the facepunch weapons but I am for sure doing something wrong. Any and all help is appreciated, talk slow I'm new.
  2. #2
    Richard 23,090
    I'm no dev so someone correct me if I'm wrong here. I think the thing with s&box is that weapons actually need two separate sub-prefabs linked to work right(?)

    Try making a prefab for 1st-person using a skinned model renderer and a BaseWeaponModel and then a prefab for 3rd-person using a model renderer and a BaseWeaponModel component. Then on your main weapon prefab drag those two into the view model prefab and world nodel prefab slots and finally set hold bone to hold_R (so it snaps to the hand instead of floating at your feet) and pick a hold type (like pistol or rifle) for the arm poses

    If 1st-person is still invisible double-check that your view model prefab isn't positioned off-screen or behind the camera 
  3. #3
    adair_19 Started this
    Awesome I will give that a try and report back, thank you!