__FORCETOC__
==Mods==
Most mods for Battle Brothers can be found at [https://www.nexusmods.com/battlebrothers/mods/ Nexus Mods] or [https://www.moddb.com/games/battle-brothers/mods Mod DB].
==Modding==
Modding is the process of modifying files to change the gameplay.
===The mod kit===
Battle Brothers doesn't have official modding tools. Rather, modders use [http://www.adammil.net/blog/v133_Battle_Brothers_mod_kit.html#modkit Adam Milazzo's mod kit] to decrypt and decompile the game scripts.
===Accessing the files===
This is a step-by-step tutorial for Windows.
# Extract the contents of the game 'data_001' archive with a file archiver like [https://www.7-zip.org/ 7zip]
# Download and extract the kit
# Open a command prompt (type 'run' in the Windows search bar and enter), then type 'cmd'
# Go to the kit bin directory by typing 'cd .../bbros/bin', where '...' is a path to the directory where you extracted the kit (use 'cd /d' instead of just 'cd' if the kit is located on another drive than the current one)
# Type in 'massdecompile.bat .../data_001/scripts' where '...' is a path to the directory where you extracted 'data_001'
The scripts are now decompiled and can be opened, read and edited with a text editor. [https://notepad-plus-plus.org/ Notepad++] can add the 'data_001' folder as a workspace which comes handy for navigation and folder wide searches.
===Adding new asset===
The mod kit includes bbrusher, a program that can pack images into sprite sheets and create brushes. This is a step-by-step tutorial using the [https://www.nexusmods.com/battlebrothers/mods/57 More Named Weapons mod] as an example.
# Access the bin folder of the mod kit following the guidelines of the [[Modding#Accessing_the_files|Accessing the files]] section
# Optionally, unpack the game assets with this command: bbrusher unpack brush, where 'brush' is the full path (including the directory) to a brush ending with the brush name, for example: entity_icons.brush (weapons). The brush sprite sheet (for example, entity_icons.png) must be present somewhere in the parent folder (preferably use the data_001 structure to avoid any issues).
# Create the assets
Orientation is north west for two-handed weapons, north east for one-handed weapons. Image size should stay close to the size of similar base game weapons (see 2. to unpack sprites).
## A normal version ## A bloodied version #Create a metadata.xml file for the brush (example) ##Add brush tags, specifying a name and version 17 (this number could change with updates)##Insert sprites inside the brush tags (replace the '...')...
##* 'id' is the unique identifier used to refer to the icon ##* 'ic' has no know application; it could refer to a color; use a similar weapon ic ##* 'img' is the icon path inside the folder where metadata.xml is located ##* 'offsetY' is an offset on the Y (vertical) axis; modifying it will change the asset elevation ##* 'left', 'right', 'top', 'bottom' are relative positions; use a similar weapon position; the intervals must equal the image size (in pixels) otherwise bbrusher will return an error #Create the brush with this command:
bbrusher pack brush directory, where 'brush' is the name of a brush, for example: entity_icons_abel.brush and 'directory' the folder path to where metadata.xml is stored
#Add the generated sprite sheet to 'preload/on_running.txt' gfx/entity_icons_abel.png
#Create a new file for the asset if required, using a similar file as a template and input the new values
#* file object name this.named_crypt_cleaver
#* ID "weapon.named_crypt_cleaver"
#* Name "Named Crypt Cleaver"
#* IconLarge (full path to file) "weapons/melee/named_crypt_cleaver_01_70x140.png"
#* Icon (full path to file) "weapons/melee/named_crypt_cleaver_01_70x70.png"
#* ArmamentIcon (unbloodied version id) "icon_named_crypt_cleaver_01"
#* and other variables if necessary
#Assign the asset to an entity if necessaryFor example, modify the assignRandomEquipment() function inside 'scripts/entity/tactical/enemies/skeleton_heavy.nut' by inserting this line: this.m.Items.equip(this.new("scripts/items/weapons/named/named_crypt_cleaver")); so that Ancient Legionaries will show with the new weapon.
Optionally, an archive can regroup all files and folders.
#* Brushes in the 'brushes' folder #* Sprite sheets in the 'gfx' folder #* Melee weapon inventory icons in the 'gfx/ui/items/weapons/melee' folder #* Named weapon files in the 'scripts/items/weapons/named' folder #* Enemy files in the 'scripts/entity/tactical/enemies' folder #* And so on for other files, respecting the base folder structure and file location