PAYDAY 2

PAYDAY 2

51 ratings
[Tutorial] How to port a Custom Weapon
By Babyforce and 1 collaborators
Ever wanted to port a weapon from any game to Payday 2 but never knew how to proceed? If that's the case, this tutorial is for you.
   
Award
Favorite
Favorited
Unfavorite
Tools you will need

Blender is used mostly because it's free (and I can't get used to 3DS Max. And for Maya, don't even ask...)
I - Prepare your modding space
One of the keys to successfully mod a game is to prepare a special space on your computer where you will drop all your files. You wouldn't want to get a lot of random files in the same folder with weird names, you'd just be lost and you'd eventually give up (I talk from experience).

The weapon I'll replace is the Bernetti 9 and the weapon that will replace it is the AMJ9 from
Far Cry 3 - Blood Dragon


For this, I have created multiple folders. One named PAYDAY2 followed by Weapon then Bernetti 9 and finally Original. This is where I will copy and paste the original files of the weapon.


I created another folder with the name Modded too. This is where all my files from the custom weapon will go.
Of course, you can organize everything as you like if you don't like my way of organizing. This presentation is only subjective. Just do something you know you won't be lost with.
Inside these folder, you could separate the models from the textures to gain some more visibility. I know it's a lot of folders for very few files but it's better than giving up.

Alright, you should be good to go now.
II - Time to get those models
Okay, now we have organized our folders. But without the models and the textures, there is nothing more we can do. You will need the original models of the Bernetti 9, directly extracted from the game files. The best (and only) way to get them is to use the Bundle Modder Tool. Like that, you'll get fresh original models and you will have no chance to mistake them.

So, how to proceed?
I'd recommend creating a folder in Payday 2's main folder and puting all the files from Bundle Modder inside it. Then:
  • Launch PDBundleModPatcher.exe
  • In Options/About, set the path to your Assets folder, located in Payday 2's root folder
  • Go in Game File Extraction, be sure to check Use every bundle, set the path to a folder (where the extracted files will go).
  • Wait for some time. The process is usually very long. Do not close the software during the process, even if it looks stuck.

Now we got all the files of the game, it's time to find the models and textures we need.

When you open the folder with the extracted content, you will find many folders everywhere. This is not the time to panic. Base game weapons are usualy located in:
units/payday2/weapons/


But if the weapon you want to mod comes from a DLC:
units/ followed by the ID if the DLC.


Like Bonnie (That is a free DLC) on the screenshot.

It sometimes can be tricky to find the weapons we are searching for. All these IDs that have nothing related to what we are searching for. In these type of situation, you are given 2 choices:
  • You can either play a guessing game and search in all the folders one by one until you find it (If you ever do)
  • Or you can go to Mod Workshop[modworkshop.net] and download any mod related to the weapon you want to mod. By doing that, you'll get the direct path to the folder of the desired weapon.

For me (and for you if you follow this tutorial with the assets I will link later), the weapon is the Bernetti 9, a gun that was there when the game came out. We will find it in units/payday2/weapons/

Important note: The folder containing the actual models and textures do have _pts at the end of their name. Be aware of this or you'll end up getting a model that is a box and no texture.

That being said, the folder I am aiming for is wpn_fps_pis_b92fs_pts. To quickly check if you got the right weapon, you can use the LemonCat Right Click Menu (if you installed it) to convert all the .texture to .dds in the folder then open the .dds with the DDS viewer (if you got it too). For most weapons, you will recognize their texture if you are familiar with the game.

Here we got the content:


I hope you didn't get a heart attack from the amount of files that are present. It can be hard at first to see something in this ♥♥♥♥♥♥♥♥♥. Thankfully, we will not take all of them for our mod. We only need the .model for now. Something easy you can do to locate them very quickly is typing in the search bar .model


As a result, all the .model got highlighted. Now, we just have to pick up only the one we want. Maybe you don't know what are the main models? Simple.
  • body_berreta is pretty self explanatory, just the main body of the gun
  • g stands for Grip
  • m stands for Magazine
  • o means that it is the base Iron Sight
  • sl stands for Slider
  • std here stands for Standard (What we want)


Copy all these files to the folder you created especially for this but, keep this window open, you will need it later. Forget about copying wpn_fps_pis_beretta_b_std, it's an empty file (1Kb).
Ok now, you got a bunch of .model files but there is nothing you can do with them. What's the point of getting them then? There is a tool that will convert them into .obj files for you to open them.

Open PD2ModelParser.exe from the Diesel Model Tool and you should see this:


What you will do now is loading each model one by one in the tool. To do this, click the Browse button next to the text box that is near Input File:. Once in the files selection, go in the folder where you saved the .model files and as said, open them one by one in the tool but wait a few seconds before loading the next one. Give the tool the necessary time to decompile all the models.
You should get a folder with all of these:


Delete all the files with _pattern_uv at the end of their name, they are useless and will just create a mess for nothing. If you want to check which part of the gun just to be sure, you can use the OBJ Model Viewer if you downloaded it before and open the .obj files.

You should have all the main parts. Check again if you're not sure and repeat all the steps above until you get them all.
Right, having these part is good but we need the model now. If you came here with a model, it's a very good thing. If not, you should consider browsing the internet for one.
For this tutorial, I uploaded the model I use for this guide {LINK REMOVED}. Use it if you are following the tutorial with the same assets.

Note that I had to fix this model before uploading it. If your model is broken, it's good to have a little knowledge of the software to repair it. I'll maybe make a tutorial on how to fix common issues on models later.

This is what I got in my folder:


We should have everything to create our custom weapon. Let's now launch Blender!
III - It's Blender time! 1/2
It's time to launch Blender if you haven't opened it yet. Once you opened it, you should see this:


This is the startup scene of the software. Each time you launch Blender, you'll systematically see this first. But we will need nothing on this scene. Press A to select everything then DEL or X and click the little window to accept the modifications.

Important note: In Blender, to select something, you must RIGHT CLICK something, not LEFT CLICK. The left click will just move the 3D Cursor. You can still change this in the User Preference :



Now, open your model (In File > Open if the files you want to open is a .blend like the model of this tutorial or File > Import > "choose your extension" if it isn't a .blend)

Once you opened your file, you should see something like this:


As you probably noticed at the top right corner, there are weird names like LOD_1_1_0.


These are all our objects. Each object is a single part of the gun. Depending on if your model is separated piece by piece or not, you may see more or less objects when you open your file. In our case, they have really weird names. I recommand in this case to rename them all. To do this, select the part by Left Clicking the name in that box and see what it highlights in the 3D Window. By doing this, you'll know how to name them all:


Much better!
Now you know what these objects are, open the first file of the original gun you want to mod. You can do this by going in File > Import > Wavefront (.obj) then select the first model. This is what I get:


2 Objects were added to the scene: g_body and g_hammer. These are the names your body and your hammer will need to have for the game to recognize them. But this isn't the most important for now. Press A to unselect everything. What you will do is select all the parts of the custom gun and rotate it. Maintain SHIFT and Left Click all the parts of your gun in that box and in the 3D view, once all the parts got selected, press R, then X then type 90 with your numpad if you have one. your gun should now be rotated like this:


If not, try to rotate it again until you get it right. You can press R then rotate it according to an axis. In 3D, 3 axis exists:
  • X
  • Y
  • Z

Importante note: Do NOT move/resize/rotate the original objects. They only are here to help us knowing where to put each part of our gun.

When you rotate, you can press the button on your keyboard according to an axis for your object to rotate around it. To know what axis you want to rotate around, just look at this:


It's at the bottom left corner of the window and will greatly help you for your rotations.

Now your model is well rotated, you need to resize it to make both body fit each other. You can do this by pressing S. You will also have to move it. By default, you can see the 3 different axis with arrows when you select something:


Use this to move your model around and play with the resizing tool until you get a good enough result. This part can be hard as sometimes the weapon hardly fits the one you chose. Just do as best as you can. This should work:


As long as the result in-game isn't bad, you should be good to go. Now, for me at least, I also need to move the hammer that was included in the main body's .obj of the original model. In some .obj files you open, you could have more than 1 object inside and you will have to move them manually like you just did. Select the object you need to move without pressing SHIFT and move it WITHOUT RESIZING IT to the position of the other object.

Side note: In a lot of models you will open, the rotation point can be a pain to use:


Of course you don't have to keep it here, you can change it. For this, select your object, go in
Edit Mode


Then press A to unselect everything if something got selected, go in Face Selection Mode, select both sides of your model's few faces (With Right Clicks) to make your "rotation point" be in the middle. It's very hard to explain with words so here in a screenshot:


Then press SHIFT+S and select Cursor to Selected. Get back in Object Mode and in the Set Origin, select Origin to 3D Cursor:


You should be done after that, the rotation point is now well placed. Now move your object and rotate it like the original one is:


Should be good enough.

I almost forgot! You can hide objects you don't want to see here:


They will just go invisible and unselectable this way, they aren't deleted, don't worry.

Alright. After you have moved all your objects according to the original positions, you will have to give the new objects the same name as the original one. This is very important, if you don't do that, the Model Tool won't give you a custom .model so be sure to do everything correctly.

First of all, hide everything except the objects you moved earlier. Now you will copy the name of the original body that is g_body and you will rename the custom body the same name. You can also add _old to the name of the original models if you want to keep them. Do same for every model you replaced in the scene:


Now ONLY select these new objects you renamed and Export them (File > Export > Wavefront (.obj)) with these settings:


Save it in the folder you want. If you want to be sure you exported the right models, you can check with the OBJ Model Viewer:


Seems like I got the good one.
III - It's Blender time! 2/2
Now, you need to use the Diesel Model Tool to convert the .obj to .model. In Input File, click Browse then be sure to select the .model you want to replace. Select the .model of the original gun. In my case, it's wpn_fps_pis_beretta_body_beretta.model. Then select a root point if available. Usually, the first one is the one you should select. It should begin with a rp_ at the beginning of the name. Then, click Import Model (.obj) and select the .obj you've just created with Blender, the one which's supposed to replace the model you selected in Input File. A windows is supposed to appear telling you your model has been successfully loaded. Then finally, next to Output File, write the name for the new .model you want to create and make sure to add .model at the end. Click Export and you should get your model inside the tool's folder.
IV - Get those models in your game
Now you got the .model with the new objects you wanted inside, you can try to put them in-game with a mod_overrides folder.

HOWEVER, before you try, you should consider checking if your custom .model isn't a blank file or just a copy/paste of the original model (can happen if we did something wrong in Blender). For this, check if the size of the original .model match the new .model's size. If it doesn't and your custom .model > 1Kb, you are good to go.


My .model seems to be good. Now, we need to see if the game can read our file. This is why I prefer to make the gun a mod_overrides before making it a standalone, it allows to see if the weapon is well placed.

If you know how to make a mod_overrides mod folder, then do it for your weapon. If you don't know, it's very easy.
The reasons I said not to close that folder with all the original files is because we'll need it to create folders with the exact same names. For me replacing the Bernetti 9, I created a mod_overrides with this name and path:
lasergun > units > payday2 > weapons > wpn_fps_pis_b92fs_pts


You will of course use the path to your weapon except if the gun you're modding is the Bernetti 9.

Now, copy/paste the custom .model you created in that last folder and give it the name of the original .model, wpn_fps_pis_beretta_body_beretta.model. This is also why you should keep your windows open, to work with efficiency.

Now is the moment to see if the game will recognize your custom .model. Launch your game and preview the weapon you have modded. If done correctly, you should see your model but with a screwed up texture.


It's normal, we didn't give to the game the texture of the gun. You can also check in your safehouse if the weapon doesn't glitch too much through a heister's arm or hand. As for my port, everything seems to be fine, I don't need to move anything.

However, we only ported 1 model and we need to port more to recreate the gun entirely. What you will do is repeat each and every steps above for every model you have.

For example, you take the magazine model from the Bernetti 9 and you move and rotate the custom magazine to make it fit the original one. All these steps but WIHTOUT RESIZING ANYTHING. You already resized before so no need to do that anymore. I know it is time consumming but this is the only way.

And this part is where the Refresh Model mod is helpful. You don't have to close your game to check if the placement of your object is correct. It is best if you play the game in Borderless Windowed too. Use Refresh Model to save some time, I really recommend it. Just be sure to carefully read the description of the mod on how to use it.

Tip: If you have too many separated objects, you can join the parts you think should be together by selecting the objects you want to join the press CTRL+J.
V - I want to hide a model I can't replace
Sometimes, when you mod a weapon, there are models like here, the grip, you don't want to create custom one meaning they obstruct your view of the final model. You can get rid of them by deleting them directly into the .model. It's very easy to do and usefull only if you want to keep it as mod_overrides or you really want to see the final weapon without anything that could spoil your view.
In this case, you can open the .obj of the model you want to get rid of separately as you won't need to make it fit anything.

Load the .obj of the model you want to get rid of. For me, it's that grip I talked about earlier:


As always, before opening, you can check with the OBJ Model Viewer if this is the right model.

Now go in Edit Mode and Face Selection.


Unselect everything with A and select 1 face of the model: it can be any. Then, press CTRL+i to invert the selection then X or DEL and select Face.


After doing this, you should on have a single face remaining. Select the last face and reduce it a lot with S so you don't see it anymore.


Important note: The reason I only leave a single face is because the game will load a lot less things like this. You can see this as an optimization as we wouldn't want it to load a tiny grip we don't even see. This is why I recommend doing this.

Go back in Object Mode and Export your file as Wavefront (.obj) with the settings you can see above.

Now follow the normal steps to convert it back to .model and load it into your game.


As you can see, there is no more grip. You can do this for anything you want to remove from your custom weapon.
VI - Hang on! What about the textures?
I didn't talk about the textures in the last part. Don't worry, I haven't forgotten about them.

When you downloaded your model, you probably got the texture with it (If not, I really don't know......)

In this part, we'll make the texture readable by the game and we'll apply it to our weapon.

If you downloaded the assets I use for this tutorial, there is the texture of the gun as a .PNG.


The game can't read this. This is why we will need either Photoshop or The Gimp to convert it to a .DDS.

I will use Photoshop CS6 in this tutorial but this should be same in CS2. As for The Gimp..... I can't even draw a line with it. Just use what you want as long as you're used to use it.
In this part, I'll show you how to use the Alpha Layer to create glossiness wherever we want on the texture.

Basically, the Alpha Layer is a layer that only supports Black and White and will determine whether some parts of your textures are glossy or not.


First of all, load the AJM9_Diffuse.PNG into your software:


Diffuse is the normal texture, the one that is directly applied to the model. We don't have to change anything in the image itself. All we need is to create an alpha layer to avoid getting a glossy texture once loaded by the game. For this:


Now created a new layer, select the other layers at the same time by clicking the eye icons:


After you have selected the part you want to make glossy, just focus on the alpha layer and unselect the other layers (with the eyes tied to them). Apply a shade of grey according to how glossy you want this part of the texture to be:


For me, I only want this part to be glossy. The rest should stay not glossy so black colour. Now you need to save it as .DDS with the Alpha Layer saved in:


Then you'll see another window appear. There are 2 ways to convert your texture. You can choose the uncompressed way:


You can also save it with MipMaps or not. MipMaps are reduced versions of the texture you are saving. They will allow the game to use these reduced textures on lower texture settings and will make the texture look awful on very low settings like every other textures. You can choose to create them or not in this menu.
The line with DXT5 is the line that will determine if your file will be compressed or not. When compressed, the texture will lose some quality and you'll see some artifacts on the file. I usually prefer to use this actual setting on the screenshot above. Compression will allow your texture to have a smaller size than uncompressed but with the downside of "screwing" it up. It's all up to you. If you want to compress your texture:


Now you saved it, check if your file is ok with the DDS Viewer:


Make sure to uncheck Show alpha channel ( A ) or just press A. You can still use this to see if your alpha layer is how you set it in the 2D Editing software.
Now we have our texture, we can put it in the folder of the .model we edited earlier. There is just one more thing we should do. We need to rename the texture according to the original one. Go in the folder of your original files in the extracted game files and search for the name of texture for the part you modified. For me, it is wpn_fps_pis_beretta_body_beretta_df.texture. If you don't know what are these _df and _nm, here their meaning:
  • df is Diffuse meaning the texture displayed
  • nm is Normal meaning the texture that will give depth to your displayed texture

In our case, we want to replace the _df:


Now we launch the game and see the result:


Pretty good! But as you could notice, there are weird lines on the gun. This is caused by the original's gun Normal Map Texture. Usually, when you download a model, you also get the Normal Map Texture with it. In this case, you only have to make is a .DDS and put it into your game. The process is the same except this time, you copy the coloured layer to the Alpha Layer and you save as .DDS (Uncompressed here is very recommended). Now put it in your game the same way you did for the diffuse texture but replace the _df by _nm at the end of the Normal Map Texture:


This is what we get in-game:


Much better isn't it?

Important note: There are times you will get a texture with every part of the gun inside, unlike Payday 2 that will give you each part of the gun in different textures. As it is better to keep everything in 1 texture (for optimization purpose), we will have to tell the game to use only 1 texture. I will show you how in the next chapter.
VII - Finishing the weapon replacement mod
After some time of work, this is with what I could come up:


Looks to be not too bad. but as you have probably noticed, the textures applied to the other parts of the gun are kind of wrong. This is because the game use the separated textures from the original gun. There is a way to tell to the game that we want the main texture as texture for the whole gun.

For this, go into the folder of the original weapon in the extracted files of your game and search for the .material_config of the parts you want to define the texture on them. For me, it's:
wpn_fps_pis_beretta_m_std.material_config
wpn_fps_pis_beretta_o_std.material_config
wpn_fps_pis_beretta_sl_std.material_config


Copy/paste them in the folder you put all the .model and the .texture:


Now, edit them with your favourite text editing software:


What I highlighted here is what should be replaced by the name of the main Diffuse texture (wpn_fps_pis_beretta_body_beretta_df for me) and you should replace the same string below but with _nm at the end.

These are my final files:




Save them, launch your game and preview the weapon:


And in hand:


Perfect!

There's nothing more we can do here. If you read this and succeeded at creating your gun, congratulations! You can be proud of yourself.

If you couldn't understand something, just ask me in the comments, I will reply asap.

And you may be asking yourself "How do I make it a standalone weapon now?". It's true, the only thing we did is making a mod_overrides that replace a weapon and not add one. Starting next chapter, we'll see how to make it a Standalone.

For now i'm taking a little break, go download the template[modwork.shop] and see if you can do it by yourself. We'll use this template for the next chapter as well, just make sure to have it.
18 Comments
S41TM Dec 29, 2021 @ 5:21am 
Oh okay, well thanks either way!
Babyforce  [author] Dec 28, 2021 @ 2:00pm 
I'm saying I haven't modded the game in ages, so I cannot be much of help since I do not even remember the details at all!
S41TM Dec 28, 2021 @ 5:46am 
Thank you for your answer, but do you know how i could fix it?
Babyforce  [author] Dec 27, 2021 @ 2:56pm 
It's usually a problem with the materiel_config files I think, but I'm not sure. As I said, I haven't modded the game in years.
S41TM Dec 27, 2021 @ 7:00am 
Hi, so i think everything works for me until i try to preview the gun in payday 2, it just doesn't show up anywhere i look. Do you know what could be causing this?
FoxYin_11♥♣• Dec 12, 2021 @ 12:12am 
ok, thanks
Babyforce  [author] Dec 11, 2021 @ 4:36pm 
Being ok or not only depends on your own perspective (op or not op). There is technically no downside in using them since you can't get banned from anywhere, or you won't get penalized in any way. Even random people who do not have the mod will only see a generic weapon, so they won't even know you'll be using a custom weapon. They've been OK when I started modding, and I believe this is still the case today, even if I stopped modding a few year ago.
FoxYin_11♥♣• Dec 9, 2021 @ 1:28am 
question, is it ok to use custom weapons in multiplayer?
Dinnye Aug 23, 2018 @ 3:53am 
Note: I used 3D Builder instead of Blender.
Dinnye Aug 23, 2018 @ 3:52am 
Hi, can you help me? The Diesel Model Tool is not doing what it should for me. I mean... I can only get the same file size as the original file had, after trying to convert my .obj to .model
Do you have any ideas?