Tutorials
Tutorials for modding the game.
- Extracting the Game's Files
- Re-Extracting the Game's Files After an Update
- WeaponLib Mod Preparation
- Troubleshoot Custom Weapons/Attachments for Modders
- Voice Over Modding
- Legendary Armor Skins/LAS/MOOG/Outfit Module Guide
Extracting the Game's Files
This guide will go over how to extract the game’s assets. If you simply want to install mods, this guide is not for you! If you want to make some, you’re in the right place.
Prerequisites
To begin, you’ll need all of these. You don’t need to do anything with them yet, just make sure you have them all:
-
Diesel Bundle Modder - This allows us to extract the game’s files.
-
Microsoft .NET Framework 4.5 - Required for the Bundle Modder to function.
-
PAYDAY 2 Hashlist - Contains file paths and filenames of the game’s assets, necessary for extracting.
-
Around 40 GB of space on your hard drive. Extracting the files is almost the equivalent of having another copy of PAYDAY 2 installed.
Installation and Prep
Got everything? Let’s get started.
-
First, go ahead and run the installer for Microsoft .NET Framework 4.5. This should be fairly straight forward.
-
Once that’s done, go ahead and open up the .zip for the Bundle Modder that you got. You should see this:
Extract all of the files to a folder of your choosing. I’d recommend putting it in a folder called “Payday Bundle Modder”, to keep it organized:
- Next, you’ll want to open the PAYDAY 2 Hashlist zip. Extract the file inside to your Bundle Modder directory, as shown:
Once you've done this, you're ready to start with the Bundle Modder.
Using the Bundle Modder for extraction
Now that all of the prep work is out of the way, we can get started with the Bundle Modder. Despite the name, the Bundle Modder can be used to extract the game’s files. It used to be the only way to install mods in the past, but became outdated as modding tools improved. It’s still the preferred way to extract files however.
The UI is unfortunately a bit clunky and unintuitive, but this guide walk you through it:
- In the folder where you extracted the Bundle Modder files, run “PDBundleModPatcher.exe”. This should pop up if it’s your first time using it:
Ignore the scary warning and hit OK.
- You should see this screen now with a bunch of options:
Luckily, you can ignore most of it. The only part we care about is where it says “Game Asset Folder” on the top:
Hit “Browse” and locate PAYDAY 2’s “assets” folder. By default, this is:
C:\Program Files (x86)\Steam\steamapps\common\PAYDAY 2\assets
Not there, or forgot where you installed it? Click here for a guide on finding your install location.
Once you’ve found it, hit OK.
- After you’ve done that, the following message will pop up:
Ignore it and hit OK.
Click on the “Game File Extraction” tab:
- You can specify a Custom Extract Folder if you wish, but all you have to do is hit “Start” in the bottom right to start the extraction process:
If you did not specify a custom extract folder, this will pop up:
Hit “Yes” to proceed, or “No” if you want to go back and specify one.
-
Wait until it’s done. This depends on the speed of your hard drive, so find something else to do in the meantime.
-
When it’s done, this message will pop up:
The extracted files should be in the directory you specified, or
C:\Program Files (x86)\Steam\steamapps\common\PAYDAY 2\assets\extract
by default.
Congrats! You’ve successfully extracted the game’s files. Now you can get to work on a mod.
Re-Extracting the Game's Files After an Update
As you might be aware, PAYDAY 2 tends to update frequently with new content. It won’t magically appear in your extract folder however; you’ll need to extract the files once more.
This guide assumes that you're familiar with the Bundle Modder and already have an extract. If you don't have an extract or the Bundle Modder, check out the Extraction guide by clicking here.
Re-Extracting the Files
-
Check here to see if the Hashlist has been updated for the latest patch.. If it hasn’t, it’s recommended that you wait for an update before continuing. Otherwise, any content added by the patch will be extracted with an improper filename and file path. If it has, download it.
-
Open up the .zip, then extract “hashlist” to your Bundle Modder folder. Make sure you replace files if prompted.
-
Open up “PDBundleModPatcher.exe”. It should detect that the game has updated:
Just hit OK and go to the Game File Extraction tab:
- If you want to speed the extraction up, check the box that says “Ignore existing files” on the Game File Extraction page:
As the name implies, this will skip over the files you’ve already extracted to drastically reduce the extraction time. You can leave this option unchecked if you want to make sure all of your files are updated.
- Hit “Start” in the bottom right, and wait.
And you’re done! Now you have the latest content extracted.
WeaponLib Mod Preparation
You boot up Payday 2, intend to enjoy a few of new weapon mod that have appeared on the front page of MWS, but found out that most of them have the big red word Requires WeaponLib. You shudder in fear, you don't know what it is, how to use it, or where the other long list of Requires have gone.
This wiki will show you what needs to be done in order to move to WeaponLib
First of all, WeaponLib is a combination of previously-separated-standalone weapon functionality mod, into 1 big code library for weapon to use. Spearheaded by Cpone, many of the combined mod is Cpone's mod that you probably already heard of and then some other.
So if you want to move to WeaponLib, check first for this list of mod that you need to remove:
-
Attachment Animations
-
Custom Attachment Points
-
Extra Attachment Tweak Data
-
Custom Scope Effect (folder named "CustomScopeEffect")
-
Fire Rate Multiplier
-
New Magazine Size for Weapons (located in mod_overrides!)
-
Underbarrel Weapons Base
Almost all of them are located in mods folder, except a few that are probably in mod_overrides.
Nevertheless check assets/mod_overrides as well in case those old mod are left there from previous version.
After removing those mods you can place WeaponLib folder nicely into mods folder.
And you have successfully moved to WeaponLib! Where even bigger things are awaiting weapon modding!
Check out WeaponLib Fixes as well to fix several outstanding bug while the base mod is in 'hiatus'.
WeaponLib is still in "development", and many more standalone weapon functionality mod are considered to be integrated.
This wiki will be updated alongside for more mod that would be integrated (and removed from running in the game).
For Mod Developer
This is your resource on how to convert existing code/function to use WeaponLib standard: https://gitlab.com/cpone/WeaponLib/wikis/Home
For any other specific question, you can direct it to Cpone on MWS discord
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:
- Check your default_blueprint. Are the attachment IDs correct? Are there attachments listed that don't even exist?
- Check the BLT Log for any errors related to missing assets on your custom weapon
- Check if the paths in your default_blueprint part assets (unit/object/mat_cfg) are all correct.
- 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.
- Check if you didn't forget to add any needed asset paths (unit/model/object/mat_cfg)
[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:
- Check the BLT Log for any errors related to missing assets on your custom attachment
- 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 (can also apply to equipping or previewing an attachment).
-
Crash 1
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]
- First find the attachment thats causing this issue (If you can't find it use an elimination method like on Softlock step 4)
- 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)
-
Crash 2
The crash looks something like this:
PAYDAY 2 Crash log
Application has crashed: C++ exception
[string "lib/managers/weaponfactorymanager.lua"]:984: attempt to index a nil value
SCRIPT STACK
get_ammo_data_from_weapon() @mods/WeaponLib-Release/modules/weaponfactorymanager_caching/weaponfactorymanager.lua:51
original() @mods/WeaponLib-Release/modules/general_fixes/newraycastweaponbase.lua:211
_update_stats_values() @mods/base/req/core/Hooks.lua:260
make_fakeweaponbase() @mods/More Weapon Stats/lua/blackmarketgui.lua:787
mws_get_popup_data() @mods/More Weapon Stats/lua/blackmarketgui.lua:614
original() @mods/More Weapon Stats/lua/blackmarketgui.lua:560
show_stats() @mods/base/req/core/Hooks.lua:260
on_slot_selected() lib/managers/menu/blackmarketgui.lua:6672
ddi_original_blackmarketgui_mousepressed() lib/managers/menu/blackmarketgui.lua:6282
mouse_pressed() @mods/Drag and Drop Inventory/blackmarketgui.lua:19
mouse_pressed() lib/managers/menu/menucomponentmanager.lua:1458
mouse_pressed() @mods/base/lua/MenuComponentManager.lua:24
mouse_pressed() lib/managers/menu/menurenderer.lua:368
mouse_press() lib/managers/menu/menuinput.lua:570
lib/managers/mousepointermanager.lua:341
-------------------------------
Callstack:
payday2_win32_release (???) ???
payday2_win32_release (???) zip_get_name
payday2_win32_release (???) zip_get_name
-------------------------------
-
[What to do]
- First find the attachment thats causing this issue (If you can't find it use an elimination method like on Softlock step 4) (NOTE: this crash is caused by a stock type attachment)
- Your attachment tries to add a stock_adapter that doesn't exist on the gun, either add the stock_adapter to the gun or remove the line that tries to add the stock adapter.
Weapon Crash 2
-
[Description]
Clicking on the weapon causes a crash. The crash looks something like this:
PAYDAY 2 Crash log
Application has crashed: C++ exception
[string "lib/managers/weaponfactorymanager.lua"]:1617: attempt to index a nil value
SCRIPT STACK
_check_sound_switch() lib/units/weapons/newraycastweaponbase.lua:694
original() @mods/WeaponLib-Release/modules/general_fixes/newraycastweaponbase.lua:83
_update_stats_values() @mods/base/req/core/Hooks.lua:260
make_fakeweaponbase() @mods/More Weapon Stats/lua/blackmarketgui.lua:787
mws_get_popup_data() @mods/More Weapon Stats/lua/blackmarketgui.lua:614
original() @mods/More Weapon Stats/lua/blackmarketgui.lua:560
show_stats() @mods/base/req/core/Hooks.lua:260
on_slot_selected() lib/managers/menu/blackmarketgui.lua:6672
ddi_original_blackmarketgui_mousepressed() lib/managers/menu/blackmarketgui.lua:6282
mouse_pressed() @mods/Drag and Drop Inventory/blackmarketgui.lua:19
mouse_pressed() lib/managers/menu/menucomponentmanager.lua:1458
mouse_pressed() @mods/base/lua/MenuComponentManager.lua:24
mouse_pressed() lib/managers/menu/menurenderer.lua:368
mouse_press() lib/managers/menu/menuinput.lua:570
lib/managers/mousepointermanager.lua:341
-------------------------------
Callstack:
payday2_win32_release (???) ???
payday2_win32_release (???) zip_get_name
payday2_win32_release (???) zip_get_name
-
[What to do]
- You probably forgot to close one of your xml tags like
<Weapon>
, either try to find the unclosed tag manually or run it through an XML validator
Weapon Crash 3
-
[Description]
Going into a heist with a custom weapon causes a crash. The crash looks something like this:
Application has crashed: C++ exception
[string "lib/units/weapons/newnpcraycastweaponbase.lua"]:19: attempt to index a nil value
SCRIPT STACK
spawn_unit() =[C]
add_unit_by_factory_blueprint() lib/units/beings/player/huskplayerinventory.lua:144
add_unit_by_factory_name() lib/units/beings/player/huskplayerinventory.lua:134
_perform_switch_equipped_weapon() @mods/Third Person/thirdperson.lua:199
synch_equipped_weapon() lib/units/beings/player/huskplayerinventory.lua:21
set_equipped_weapon() lib/network/handlers/unitnetworkhandler.lua:61
@mods/BeardLib/Hooks/NetworkHooks.lua:105
send_to_peers_synched() @mods/Third Person/lua/basenetworksession.lua:52
send() lib/network/base/extensions/networkbaseextension.lua:11
_send_equipped_weapon() lib/units/beings/player/playerinventory.lua:389
equip_selection() lib/units/beings/player/playerinventory.lua:344
original() lib/units/beings/player/states/playerstandard.lua:5185
_start_action_equip_weapon() @mods/base/req/core/Hooks.lua:260
_update_equip_weapon_timers() lib/units/beings/player/states/playerstandard.lua:3291
_update_check_actions() lib/units/beings/player/states/playerstandard.lua:883
original() lib/units/beings/player/states/playerstandard.lua:435
update() @mods/base/req/core/Hooks.lua:185
original() lib/units/beings/player/playermovement.lua:271
@mods/base/req/core/Hooks.lua:260
-
[What to do]
- Note the
_perform_switch_equipped_weapon() @mods/Third Person/thirdperson.lua
this crash is caused by using both WeaponLib and the ThirdPerson mod, to fix it either disable or remove the ThirdPerson mod. If this exact crash still keeps hapening afterwards contact me on Discord (Killerwolf#2636)
Weapon Crash 4
-
[Description]
Trying to preview your custom weapon causes a crash. The crash looks something like this:
Application has crashed: access violation
-------------------------------
Callstack:
payday2_win32_release (???) ???
payday2_win32_release (???) ???
payday2_win32_release (???) ???
payday2_win32_release (???) ???
payday2_win32_release (???) ???
payday2_win32_release (???) ???
payday2_win32_release (???) zip_get_name
payday2_win32_release (???) ???
payday2_win32_release (???) ???
payday2_win32_release (???) zip_get_name
payday2_win32_release (???) ???
-------------------------------
Current thread: Main
Script stack:
_spawn_and_link_unit() lib/managers/weaponfactorymanager.lua:894
_spawn() lib/managers/weaponfactorymanager.lua:791
complete_clbk() lib/managers/weaponfactorymanager.lua:803
load() lib/managers/dynamicresourcemanager.lua:123
_add_part() lib/managers/weaponfactorymanager.lua:768
assemble_from_blueprint() lib/managers/weaponfactorymanager.lua:627
assemble_from_blueprint() @mods/WeaponLib/modules/different_akimbos/menuraycastweaponbase.lua:18
spawn_weapon() @mods/WeaponLib/modules/different_akimbos/menuscenemanager.lua:43
spawn_item_weapon() @mods/WeaponLib/modules/different_akimbos/menuscenemanager.lua:51
done_cb() lib/managers/blackmarketmanager.lua:4663
func() lib/managers/blackmarketmanager.lua:2018
call_next_update_functions() lib/setups/setup.lua:236
update() lib/setups/setup.lua:843
update() lib/setups/menusetup.lua:352
update() @mods/base/lua/MenuSetup.lua:5
core/lib/setups/coresetup.lua:557
-
[What to do]
- Note the
_spawn_and_link_unit() lib/managers/weaponfactorymanager.lua
this crash is caused by having a broken attachment model, either use the elimination method or look for suspiciously small attachment model files (less than 12kb for example). To fix it either replace that broken model or remove it.
Weapon Crash 5
-
[Description]
Loading into a heist with your custom weapon causes a crash. The crash looks something like this:
Application has crashed: C++ exception
[string "--mods/BeardLib/Classes/Utils/Utils.lua..."]:142: attempt to index local 'fac_part' (a nil value)
-
[What to do]
- Note the
attempt to index local 'fac_part'
this crash is caused by having a caused by using non existing ID for based_on. You probably made a spelling mistake, fix that by using the exact ID from the weaponfactorytweakdata in your based on.
Weapon Crash 6
-
[Description]
Trying to preview your custom weapon causes a crash. The crash looks something like this:
Application has crashed: access violation
-------------------------------
Callstack:
payday2_win32_release (???) ???
payday2_win32_release (???) ???
payday2_win32_release (???) ???
payday2_win32_release (???) ???
payday2_win32_release (???) ???
payday2_win32_release (???) ???
payday2_win32_release (???) ???
payday2_win32_release (???) ???
payday2_win32_release (???) ???
payday2_win32_release (???) ???
payday2_win32_release (???) ???
payday2_win32_release (???) ???
payday2_win32_release (???) zip_get_name
payday2_win32_release (???) zip_get_name
ntdll (???) RtlUpcaseUnicodeChar
ntdll (???) RtlRestoreLastWin32Error
??? (???) ???
??? (???) ???
??? (???) ???
??? (???) ???
??? (???) ???
??? (???) ???
??? (???) ???
??? (???) ???
??? (???) ???
??? (???) ???
??? (???) ???
??? (???) ???
??? (???) ???
??? (???) ???
??? (???) ???
??? (???) ???
??? (???) ???
??? (???) ???
-------------------------------
Current thread: Main
Script stack:
spawn_weapon() @mods/WeaponLib/modules/different_akimbos/menuscenemanager.lua:36
spawn_item_weapon() @mods/WeaponLib/modules/different_akimbos/menuscenemanager.lua:51
done_cb() lib/managers/blackmarketmanager.lua:5121
func() lib/managers/blackmarketmanager.lua:2339
call_next_update_functions() lib/setups/setup.lua:252
original() lib/setups/setup.lua:871
update() @mods/base/req/core/Hooks.lua:188
update() lib/setups/menusetup.lua:358
update() @mods/base/lua/MenuSetup.lua:5
core/lib/setups/coresetup.lua:557
-
[What to do]
- This crash is caused by having a wrong root point in your main weapon model, say the object file has the root point (orientation_object)
rp_mauser1891
while the model itself still has the vanilla root point, in this caserp_wpn_fps_snp_mosin
. To fix either replace the orientation_object in the object file with them model root point, or replace the model root point with the orientation_object from the object file.
Weapon Crash 7
-
[Description]
Opening the black market causes a crash. The crash looks something like this:
Application has crashed: C++ exception
[string "lib/managers/menu/blackmarketgui.lua"]:13508: attempt to index a nil value
SCRIPT STACK
callback() lib/managers/menu/blackmarketgui.lua:13418
first_btn_callback() lib/managers/menu/blackmarketgui.lua:12656
press_first_btn() lib/managers/menu/blackmarketgui.lua:7089
mouse_double_click() lib/managers/menu/blackmarketgui.lua:6996
mouse_double_click() lib/managers/menu/menurenderer.lua:413
lib/managers/mousepointermanager.lua:381
-------------------------------
Callstack:
payday2_win32_release (???) ???
payday2_win32_release (???) ???
payday2_win32_release (???) ???
payday2_win32_release (???) zip_get_name
ntdll (???) RtlAllocateHeap
-
[What to do]
- This crash can be caused by having an inconsistent/non-existent GlobalValue in your xml.
For example
Weapon Crash 8
-
[Description]
Loading into a heist with a custom weapon causes a crash.
The crash looks something like this:
-
[What to do]
- This crash can be caused by badly written stance code (note the PVM mention in the crash log).
For example
- The rotation here is missing the 4th value, it should instead look like this
- A good way to avoid this is using the Copy to Xml button in the Perfect View Model UI
(the button only copies the values to your clipboard, so you have to paste them manually in the xml).
This is how a correct stance setup would look like after copying the PVM values
Custom Attachment Points Issues
-
[Description]
Custom attachment points from your weapontweakdata don't have an effect ingame, i.e changing the values doesn't move them.
-
[What to do]
- Check if you weapontweakdata is hooked
- Check if your hook has a unique name and isn't being overwritten by a post hook with the same name (this usually happens when copying files from another custom weapon and then forgetting to change stuff for the new weapon)
- If all the above isn't the issue check if your weapons .unit and npc.unit have the correct values example:
<extensions>
<extension class="ScriptUnitData" name="unit_data" />
<extension name="base" class="NewRaycastWeaponBase" >
<var name="name_id" value="tti" /> <!-- value should be the same as your weapons ID -->
</extension>
</extensions>
Weapon disappears from your inventory
-
[Description]
When you restart your game the custom weapon is gone from your inventory.
-
[What to do]
- A part defined in the
default_blueprint
is either not in theuses_parts
or doesn't exist at all
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.
Voice Over Modding
Things you need:
- wwise_ima_adpcm (to encode/decode .stream files)
- Audio editor
- Extracted soundbanks folder (check attachments)
Post extraction/downloaded from gdrive
Easy steps
- Get the tools needed in attachment, set up volume preset
- Prepare your replacement files, adjust their volume level beforehand and organize them
- Listen the vanilla lines one by one and save replacements corresponding to their vanilla id, make sure saved audio files are wave formatted
- Once you're done with saving replacements use wwise_ima_adpcm to encode sound files to .stream
What you should do:
- Mod pathing must be: modname/soundbanks/streamed/char_name, robbers_mission_gen and safehouse_vo (for older characters such as OG gang, houston, clover, wick its regular_vox instead of char_name)
- Replacement files MUST contain only sound id in their name (not .1/.english)
Side note: Some of the character lines such as AI war cry, marking specials on control phase (more for characters older than Bodhi) are encoded ogg files and since we don't have a proper tool we can't replace them for the time being. Replacing them with encoded wave files will result in not playing anything. If you have the game files extracted you will see that wwise_ima_adpcm can't decode all stream files which are encoded .ogg files. My decompiled extract on Gdrive included with extracted .ogg based stream files, sort the folder by bit rate. For char_name folders they are 768 kbps if mono, 1536 kbps if stereo, mostly same for robbers_mission_gen though some are 576, 512 kbps
There are some misinformations going on regarding voice over modding:
- Some people still think they have to match replacement audio's length with the vanilla's otherwise it won't work which is NOT true, longer audio files may make it spammy
- Renaming the .wav/.ogg extensions to .stream does NOT work
- Trying to compress .ogg to .rar/zip and renaming the extension to .stream does NOT work, stop with this shit, seriously.
Legendary Armor Skins/LAS/MOOG/Outfit Module Guide
Coming soon :-)