Skip to main content

Troubleshoot Custom Weapons/Attachments for Modders

You're working on a custom weapon/attachment and run into a specific issue you have no idea how to deal with?
Then this is for you, this is a collection of known common/uncommon problems you might run into while working on a custom weapon/attachment and how to deal with them.

  • Softlock

  • [Description]

When your game freezes while trying to load an asset (for example trying to inspect a weapon or attach an attachment) its called a softlock.

  • [What to do]

[Custom Weapon]
You try to preview your new custom weapon for the first time and it causes a softlock, those are the things you can do:

  1. Check your default_blueprint. Are the attachment IDs correct? Are there attachments listed that don't even exist?
  2. Check the BLT Log for any errors related to missing assets on your custom weapon
  3. Check if the paths in your default_blueprint part assets (unit/object/mat_cfg) are all correct.
  4. Use an elimination method in which you only try to preview the gun one attachment at a time and comment the rest out to find the attachment thats causing the issue. Then use step 3.
    smg_example.png

[Custom Attachment]
You try to preview your new custom attachment for the first time and it causes a softlock, those are the things you can do:

  1. Check the BLT Log for any errors related to missing assets on your custom attachment
  2. Check if the paths in your part assets (unit/object/mat_cfg) are all correct.
  • Weapon Crash

  • [Description]

Equipping or previewing a specific custom weapon crashes your game. The crash looks something like this: (Note the _add_part() lib/managers/weaponfactorymanager)

Application has crashed: access violation

-------------------------------

Callstack:

         payday2_win32_release  (???)     ???                                                 
         payday2_win32_release  (???)     ???                                                 
         payday2_win32_release  (???)     ???                                                 
         payday2_win32_release  (???)     ???                                                 
         payday2_win32_release  (???)     ???                                                 


-------------------------------

Current thread: Main
Script stack:
                   _add_part()  lib/managers/weaponfactorymanager.lua:743           
                   _add_part()  lib/managers/weaponfactorymanager.lua:708           
     assemble_from_blueprint()  lib/managers/weaponfactorymanager.lua:627           
     assemble_from_blueprint()  @mods/WeaponLib/modules/different_akimbos/menuraycastweaponbase.lua:18  
                        clbk()  lib/managers/menu/menuscenemanager.lua:2186         
                                lib/managers/dynamicresourcemanager.lua:220         

-------------------------------
  • [What to do]
  1. First find the attachment thats causing this issue (If you can't find it use an elimination method like on Softlock step 4)
  2. Your based_on for the attachment is not the same as the .object/.unit files. (For example the luger magazine as based_on for magazine assets from the 5/7)

Note: This is a WIP page, more problems and solutions will be added over time. Everyone who knows a specific issue and how to deal with it is welcome to contribute.