how to install mods payday 2
UnKnoWnCheaTs Sticky Thread
Join Date: Oct 2014
Posts: 230
Using and installing mods/scripts using SuperBLT
This guide is for everyone who wants to use the various mods and scripts found on this forum to cheat in or change the behavior of PAYDAY 2.
This will be an exhaustive guide with step-by-step instructions so that everyone, even those without any background knowledge in modding or programming, can get everything working and set-up the way they want to.
Background Information
First a little information that is not a necessity, so if you're not interested in the why and only in the how, scroll down to the next paragraph.
PAYDAY 2 uses the lua scripting language to perform almost all of the game's logic. The nice thing about lua is that it is relatively easy for us to run our own lua scripts that can interact with the game the same way that PAYDAY 2 does.
To do this, however, we need to have access to some of the code that lua uses internally, to make it do what we want to do. These are called hooks.
When PAYDAY 2 first came out, we had our own home-made hook here at UC. But, as the needs of the cheaters and the modding community grew, so did the hook.
Eventually, a small group of people created BLT, which was fully open-source and had many contributors (it stands for B etter L ua injec T or).
This hook served us for many years, but with the downfall of the payday2mods website, the hook stopped being updated.
Now, the final iteration and the most recent version of this hook is called SuperBLT. This hook is still actively being worked on and has many features that the original BLT did not have.
Installing SuperBLT
To install SuperBLT we will need to download it from their official website here:
https://superblt.znix.xyz/
Find the link with the text Latest Release DLL under the Installation header.
Alternatively, you can download it directly from this link (this link will always download the latest most up-to-date version).
This will download a .zip file containing only the file WSOCK32.dll. We will have to copy this file to the base PAYDAY 2 directory.
To find this directory, you need to find where you have steam installed, this is usually in C:\Program Files (x86)\Steam. Once in the Steam directory, navigate to steamapps\common\PAYDAY 2.
This is what's called the base directory of PAYDAY 2. Note how this folder contains the payday2_win32_release.exe file, which is the game's main executable!
Drop the WSOCK32.dll file we downloaded earlier in here and start the game as you normally would.
You should now get a pop-up that looks like the following picture:
https://i.imgur.com/zfTglPS.png
Click 'Yes'. A console window will pop up with all kinds of text, let it run for a little while, it is downloading some extra necessary files.
When it is done, another pop-up will show, to which you will click 'OK'.
https://i.imgur.com/XiiJvob.png
Congratulations! You've just installed SuperBLT!
Creating a Mod
Now that we've installed SuperBLT we can start creating our mods for it.
Here, a "mod" simply means one or more scripts, doing one or more tasks. It is up to you to decide how you want to organize things.
You can have one mod containing every script you need, one mod for each script, or a combination of the two!
To create a new mod you will have to open the mods folder in the base PAYDAY 2 directory from before. There are already a few folders in there, but pay no mind to them.
Here we will make a new folder, with the desired name of our mod. In this guide we will be creating a test mod simply called "Test Mod", how original!
One thing every mod needs is a mod definition file, which is a simple text document inside our mod folder called mod.txt, so we create an empty text file and give it the proper name.
To begin writing our mod.txt file, we start by typing an open curly bracket on the first line, followed by a blank line and ending with a closing curly bracket.
These curly brackets simply define the beginning and the end of our definition file.
The first few lines we will write inside these brackets are about the basic mod information. The format of these lines are an identifier in quotes, followed by a colon, followed by the contents also in quotes.
Don't worry if this doesn't make sense yet, the example will clear everything up.
There are 5 identifiers we need to fill, these are:
name - The friendly name of your mod.
description - A description of your mod, and what it does.
author - You, your collaborators, anybody who worked on the mod.
contact - Some form of contact details for your users to contact you from.
version - A friendly version number that will displayed in the in-game mod manager.
Here is an example of what we should have filled in by now, this is the entire mod.txt file:
Code:
{ "name" : "Test Mod", "description" : "Just a mod to test our scripts", "author" : "rogerxiii", "contact" : "@rogerxiii on unknowncheats.me", "version" : "1.0" }
Here we notice a few things. First of all, I have indented every line by 1 tab. This is not necessary, but it does greatly improve readability, especially when the definition file gets larger, so it is recommended that you keep to the style in this guide.
Secondly, a very important part, is that there is a comma behind every line except the last one. This comma indicates that there is more information to come.
If there is no comma behind a line, that means that we are done with this section, and since the only section in our definition file thusfar is the basic information of our mod, that means that no comma means the end of the file.
Now comes the part where we add information about our lua scripts.
There are four types of lua scripts: Hooks (also called postrequire), Pre-Hooks , Persist Scripts and Keybinds .
We will
discuss Pre-Hooks as they rarely happen in practice.
We will also not discuss Persist Scripts because THEY SHOULD NEVER BE USED . Seriously.
If you ever come across a script where the author claims you have to run it as a persist, DO NOT USE IT.
It won't crash your game or anything bad, it's just an old relic of older hooks that does not have a single use case. It will completely slow down your game and it is a clear sign of a badly written script.
So, let's discuss the two types of scripts we will be using.
Hooks / Postrequire
A postrequire script gets loaded/executed immediately after a specific script has been loaded by the game.
This is extremely useful for when we want to change some values from before they get used, but after they have been initialized. Think of weapon damage or mission rewards.
To create our hooks we will add one more identifier to our mod.txt file called "hooks", but instead of simply giving it another quoted value, we want to give it a list of hooks as a value. To do this we write an open square bracket, followed by a blank line and a closing square bracket, similarly to our beginning curly brackets.
Our mod.txt file should look like this now:
Code:
{ "name" : "Test Mod", "description" : "Just a mod to test our scripts", "author" : "rogerxiii", "contact" : "@rogerxiii on unknowncheats.me", "version" : "1.0", "hooks" : [ ] }
Do not forget the comma after our version! We will also indent our text between the square brackets by 2 tabs instead of 1.
We want to be able to define multiple hooks for multiple scripts. To do this we start and end a hook entry with curly brackets, and separate them with a comma, as we are used to by now.
Before we write our hook definition, we will need a lua script containing the desired code.
Go back to our mod folder and create a new text file, but instead of giving it a .txt extension, we give it a .lua extension!
It is usually beneficial to give it a name that is recognizable, but it is not necessary.
For our example we will take a script that increases all weapon damage and put it in a file called damage.lua.
The place where you found the code or script should clearly state one piece of information, and that is where to hook it to, also called the hook ID.
These IDs look like normal filepaths, for our example it will be lib/tweakdata/weapontweakdata.
Now that we have our two pieces of information, we can add them to our mod definition file!
Inside the square brackets we will add a hook entry with curly brackets, and inside there we add two entries called "hook_id" and "script_path", both of which are pretty self-explanatory.
Note that script_path is relative to your mod.txt file. If our damage.lua file is in the same folder as our mod.txt file, then that is all we have to write.
If, however, it is in a sub-folder called, for example, "Lua", then
becomes "Lua/damage.lua".
Our mod.txt file now looks like this:
Code:
{ "name" : "Test Mod", "description" : "Just a mod to test our scripts", "author" : "rogerxiii", "contact" : "@rogerxiii on unknowncheats.me", "version" : "1.0", "hooks" : [ { "hook_id" : "lib/tweakdata/weapontweakdata", "script_path" : "damage.lua" } ] }
Please note all the indentation and where to place commas. It should all make sense!
To make sure we understand, let's add one more postrequire script.
This one changes some things about ECM jammers so we name the script file ecm.lua and the hook ID is lib/units/equipment/ecm_jammer/ecmjammerbase.
Let's add it to our definition file!
Code:
{ "name" : "Test Mod", "description" : "Just a mod to test our scripts", "author" : "rogerxiii", "contact" : "@rogerxiii on unknowncheats.me", "version" : "1.0", "hooks" : [ { "hook_id" : "lib/tweakdata/weapontweakdata", "script_path" : "damage.lua" }, { "hook_id" : "lib/units/equipment/ecm_jammer/ecmjammerbase", "script_path" : "ecm.lua" } ] }
This concludes the section on postrequire scripts and hooks.
A final note to say that these scripts automatically perform their function, without any user input, which brings us to our next section...
Keybinds
Keybinds are useful for when we want to execute a piece of code when the user presses a certain key. Think of refilling ammo or finishing a heist with one button press.
To start with adding keybinds, we add a new entry to the main part of the definition file (so after the closing bracket of the hooks!) and call it "keybinds".
Once again we also add the square brackets, since we want to be able to add multiple keybinds:
Code:
{ "name" : "Test Mod", "description" : "Just a mod to test our scripts", "author" : "rogerxiii", "contact" : "@rogerxiii on unknowncheats.me", "version" : "1.0", "hooks" : [ { "hook_id" : "lib/tweakdata/weapontweakdata", "script_path" : "damage.lua" }, { "hook_id" : "lib/units/equipment/ecm_jammer/ecmjammerbase", "script_path" : "ecm.lua" } ], "keybinds" : [ ] }
Each keybind entry needs a few more values than just the 2 of hooks. However, they are pretty self-explanatory.
The only one that need some extra explaining is the keybind_id .
This ID is a unique identifier that SuperBLT uses internally to refer to your keybind.
Make this some descriptive string that's unique to your script, see examples later for ideas.
All the other keybind identifiers are:
name The name of the keybind to display in the keybinds menu.
description A short of description of your keybind.
script_path The path to the script that should be ran when the keybind is pressed.
run_in_menu A boolean (either true or false) of whether this keybind should run when pressed during the menu state.
run_in_game A boolean (either true or false) of whether this keybind should run when pressed during the game state.
localized A boolean (either true or false) of if the menu should attempt to use the name and description as localization keys (set this to false unless you know what it means).
Let's add a keybind for refilling ammo (which we put in a file called ammo.lua) as an example to our mod.txt file:
Code:
{ "name" : "Test Mod", "description" : "Just a mod to test our scripts", "author" : "rogerxiii", "contact" : "@rogerxiii on unknowncheats.me", "version" : "1.0", "hooks" : [ { "hook_id" : "lib/tweakdata/weapontweakdata", "script_path" : "damage.lua" }, { "hook_id" : "lib/units/equipment/ecm_jammer/ecmjammerbase", "script_path" : "ecm.lua" } ], "keybinds" : [ { "keybind_id" : "keybind_test_refillammo", "name" : "Refill Ammo Keybind", "description" : "A keybind to press in-game which completely refills your ammo" "script_path" : "ammo.lua", "run_in_menu" : false, "run_in_game" : true, "localized" : false } ] }
Note all the indentation and commas again.
We will add one more keybind to complete our example and understanding.
This is a keybind to instantly finish the heist with a win, located in win.lua:
Code:
{ "name" : "Test Mod", "description" : "Just a mod to test our scripts", "author" : "rogerxiii", "contact" : "@rogerxiii on unknowncheats.me", "version" : "1.0", "hooks" : [ { "hook_id" : "lib/tweakdata/weapontweakdata", "script_path" : "damage.lua" }, { "hook_id" : "lib/units/equipment/ecm_jammer/ecmjammerbase", "script_path" : "ecm.lua" } ], "keybinds" : [ { "keybind_id" : "keybind_test_refillammo", "name" : "Refill Ammo Keybind", "description" : "A keybind to press in-game which completely refills your ammo" "script_path" : "ammo.lua", "run_in_menu" : false, "run_in_game" : true, "localized" : false }, { "keybind_id" : "keybind_test_instantwin", "name" : "Instant Win Keybind", "description" : "A keybind to press in-game which makes you instantly win the heist and exit" "script_path" : "win.lua", "run_in_menu" : false, "run_in_game" : true, "localized" : false } ] }
Read the next section to see how to configure the keybinds.
Testing and Configuring Our Mod
Now comes the time to test out our mod to see if everything works. Let's launch PAYDAY 2 as we normally would.
Once on the main menu, click on Options, there should be three new entries here somewhere in the middle, BLT Mods, Mod Options and Mod Keybinds.
Let's look inside BLT Mods to make sure our mod is actually properly loaded.
If the mod is mentioned there, click on it for more information. Here you can also click Toggle Developer Info to see that our hooks have properly been initialized:
https://i.imgur.com/BRwp63l.png
The last thing we need to do is configure our keybinds. Let's go back to the Options menu and click Mod Keybinds.
Here is a list of all the keybinds defined in all your mods. Simply click one then click a key, that key is now registered to that mod keybind.
Whenever you press that key, the script associated with the keybind will be run.
For example, I have set our refill ammo to insert and have not set the instant win keybind yet:
https://i.imgur.com/3ZmT4qf.png
That concludes all you need to know, congratulations!
More Information & Development
This section is for those who want to do a little more research on how to configure their mods to the fullest extent and for those who want to develop their own scripts instead of using those of others.
The documentation for the original BLT can be found here. SuperBLT supports this exact format, which is the one we used in this guide.
However, SuperBLT supports a lot more, and the documentation for that is:
XAudio API
Automatic Updates
XML Tweaker (used for modifying base game files!)
XML Configuration Files (a different way to create mod definition files)
If you want to develop your own lua scripts then you will need access to the decompiled lua files that PAYDAY 2 uses internally.
This GitHub page gets updated every time PAYDAY 2 gets an update thanks to the owner:
https://github.com/mwSora/payday-2-luajit
You will need at least a basic understanding of the lua programming language before you begin creating mods and scripts.
If you do, the best way to learn is to look at other people's scripts and learning from them.
How are they made, why do they work, et cetera.
Closing Words & FAQ
I hope this guide makes it possible for everyone to modify the game we all love playing.
As always, please ask any questions you might have, either in the threads or by sending a PM.
If you want a particular script made but don't have the know-how to do it yourself, try asking on this request thread:
New lua scripts/snippets collection + will create requests
Q : What do I do when the script author doesn't state whether it's a keybind or a postrequire hook?
A : Use it as a keybind! Most postrequire scripts still work as a keybind, and if it doesn't you can always ask the author.
Q : What do I do when I have to postrequire a script to multiple paths?
A : Simply add an entry to the hooks for each path to the same script, like this:
Code:
"hooks" : [ { "hook_id" : "lib/path1", "script_path" : "script.lua" }, { "hook_id" : "lib/path2", "script_path" : "script.lua" }, { "hook_id" : "lib/path3", "script_path" : "script.lua" }, ],
Q : What triggers the cheater tag as a client? And does it stay forever?
A : The cheater tags stays only for the current game, and these are all the triggers:
https://www.unknowncheats.me/forum/2859518-post5.html
Q : Where is the crash log located?
A : %localappdata%/PAYDAY 2/crash.txt
__________________
Last edited by rogerxiii; 24th January 2021 at 02:40 PM.
how to install mods payday 2
Source: https://www.unknowncheats.me/forum/payday-2-a/383999-using-installing-mods-scripts-using-superblt.html
Posted by: winshipforre1939.blogspot.com
0 Response to "how to install mods payday 2"
Post a Comment