Creating Custom Contractors

Creating Custom Contractors

Introduction

Hello! Ever wanted to make a custom contractor for your custom heist? Well, here's an easy-to-follow guide on how to make a (possibly good) custom contractor

Disclaimers This is all mostly unavailable using the visual project editor. This also mainly applies to Windows, since I haven't used any other operating systems.

First of all, open your Steam folder!

Mac - ~/Library/Application Support/Steam/steamapps/common/PAYDAY 2

Linux - ~/.local/share/Steam/steamapps/common/PAYDAY 2

Windows 64bit - C:\Program Files (x86)\Steam\steamapps\common\PAYDAY 2

Windows 32bit - C:\Program Files)\Steam\steamapps\common\PAYDAY 2

This might be different depending on where you installed PAYDAY 2. Make sure you actually have BeardLib & BeardLib Editor

Making The Contractor Exist

Go into the 'Maps' folder, and into the heist you created previously. If you didn't create a heist, follow this tutorial. Part 1 of map editing: Creating your first heist

Then with a text editor such as 'Notepad++', 'Atom', or 'Sublime Text', right click the file labeled 'main.xml'. Add a string underneath the 'Localization' tag.

The string is this:

<contact assets_gui="guis/mission_briefing/preload_contact_bain" desc_id="contact_placeholder_desc" id="placeholder" name_id="contact_placeholder_name" package="packages/contact_bain"/>
I'll explain what each of these parameters mean.

assets_gui - I'm heavily certain this is the video used when displaying heists made by the contact, just use the one by Bain.

desc_id - This is the ID for the string in localization for the description of your contractor located in the Crime.net Codex.

id - This is the ID that your contractor uses, self-explanatory, make sure it's not equal to another contractor or you might mess stuff up.

name_id - This is the ID for the string in localization for your contractor's name, highly important if you don't want error text!

package - I honestly don't know what this is, it's probably important for 'assets_gui'.

Customize these properly, don't just leave them all as placeholder. With the exception of assets_gui and package.

Localizing Your Strings

After you're done making your contractor in 'main.xml' go to the 'loc' folder in your heist folder, and then open 'english.txt'. This can be opened with ANY editor, including Windows Notepad.

This is where information like your contractor name & description, heist name and briefing, and map name and briefing goes. Copy the following stuff into the file. Make sure you only have one set of the curly brackets.

{
  "contact_placeholder_name" : "Placeholder"
  "contact_placeholder_desc" : "The placeholder description."	
}

You should absolutely edit all the information in here, if you set a different ID than contact_placeholder than change it to what you used in 'main.xml'. The right side text is what the text will look like in-game.

The Extra Polish

Without using hooks, you won't actually see the description of your contractor pop up. Using a specific hook you can make it appear in the Codex. This isn't necessary but it is a very nice touch.

Hooks:PostHook( GuiTweakData, "init", "maowcraftcontacttemplate", function(self) # Change maowcraftcontacttemplate
	local contact_data = {
		id = "placeholder", # Change placeholder
		name_id = "contact_placeholder_name", # Change contact_placeholder_name
		{
			desc_id = "contact_placeholder_desc", # Change contact_placeholder_desc
			video = "dragon1", # Not necessary to be changed
			post_event = nil
		}
	}

	table.insert(self.crime_net.codex[1], contact_data)
end)
  1. Copy this into a text editor, and save it as guitweakdata.lua.
  2. Change all the parameters to the information you put in your contractor.
  3. Create a new folder in your heist folder named 'Hooks'.
  4. Go back to 'main.xml'.
  5. Make a new tag at the top of 'main.xml'
<Hooks directory="Hooks">
		<hook file="guitweakdata.lua" source_file="lib/tweak_data/guitweakdata"/>  
</Hooks>

Make sure to test that everything works, if something goes wrong, check again, or send a message at the #help channel of the official ModWorkshop discord server. Link to modworkshop.net Discord Server - #help

Have a great day!