Custom Content

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!

Custom Subtitled Dialogue and Sound

If your heist or mod needs custom dialogue that includes subtitles follow the following steps.

  1. Add your Sounds, for this example I will add sounds to a level for a custom map.
		<sounds directory="assets">
			<sounds directory="sounds">
				<sound id="cus_rex_test_1" path="cus_rex_test_1.ogg" subtitle_id="cus_rex_test_1"/>
				<sound id="cus_rex_test_2" path="cus_rex_test_2.ogg" subtitle_id="cus_rex_test_2"/>
			</sounds>
		</sounds>
  1. Set up the Dialogue Script Data, this will add the dialogue to the dialogue element in editor.

    In the Main.xml file add this to your levels script data:

		<script_data_mods directory="scriptdata">
			<mod replacement="new_dialogue.dialogue" replacement_type="custom_xml" target_ext="dialog" target_path="gamedata/dialogs/rex">
				<options merge_mode="add" mode="add"/>
			</mod>
			<mod replacement="index.dialog_index" replacement_type="custom_xml" target_ext="dialog_index" target_path="gamedata/dialogs/index">
				<options merge_mode="add" mode="add"/>
			</mod>
		</script_data_mods>

In your Scriptdata folder in the Project add 2 txt files: ('new_dialogue' can be renamed to anything you wish)

index.dialogue_index:

<table>
	<include name="new_dialogue"/>
</table>

new_dialogue.dialogue:

<table>
	<dialog id="cus_rex_test_1" priority="1" sound="cus_rex_test_1"/>
	<dialog id="cus_rex_test_2" priority="1" sound="cus_rex_test_2"/>
</table>
  1. From there your Dialogue should be added to the game!

Additional Notes! If you want your sound to play in 3D space (from a speaker or character) make sure its a mono-sound. If you instead want your sound to play as if in the players ears (like Bain dialogue) make sure its in stereo-sound. Make sure you localise your subtitles or players will see 'ERROR:text' ingame.