Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Adding a new weapon with custom model


Recommended Posts

Im having a bit of an issue when it comes to trying to figure out how to add a new gun using the fpsweapon script. Ive already made a new script for my gun, but Im really unsure how to actually get a functioning weapon with animations. Around line 58 within my weapon script is this line


local tag = self.entity:FindChild("akm")


Which seems to be how I load my custom model, but it is offset and Im not sure how to change that either.

Link to post

FindChild don't load the model, it will just seek for some model named "akm" that is already attached to some bone or directly to your character.You must use Load function to load something.




Just look at this example where all is procedural code and no animations at all : How make it simple without animations :


So you can make it simple :like above :

Weapon 1 : Arm model + gun as one FBX model

Weapon 2 : Arm model + Rifle as one FBX model


And just use code to rotate or turn, move your model to mimik firing and reloading, in example above, when reloading , the model is almost hidden , so you don't see that is no reload animations for the hands.


Hope to see as good FPS script in Leadwerks 3.

Link to post

I figured out after I posted this that FindChild is probably used to tell where the muzzleflash should be on the gun, but my problem still remains as to how to get the gun positioned in front of the camera like the default pistol is. Whenever I load a gun it is always out of sight on my screen, and not directly in front of the camera like I would like it to be. Most games that Ive modded use a bone or camera that the code detects and places that in front of the camera. But Im not seeing anything of the likes here in leadwerks.

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Facebook Twitter Youtube Github Steam
  • Create New...