BrainBread 2

BrainBread 2

Not enough ratings
Adding your favorite playermodel(s) to BrainBread 2!
By BerntA
Assuming you've gone through the trouble to port some model to BrainBread 2, this guide will teach you how to setup a proper character script so that you can use the model(s) you've ported over and make sure that anyone else who has subscribed to your addon will also be able to see your model(s)!
   
Award
Favorite
Favorited
Unfavorite
Porting a model to BrainBread 2
This guide will not cover any technical aspects regarding porting any model to BrainBread 2, however the first step is to take a look at the original models referenced in the BrainBread 2 Mod Tools, make sure to download the mod tools so that you have some working .QC templates which contain everything you need, such as the bodygroups we use, attachments, etc...

Bodygroups Available
Gibs
  • head
  • arms_left
  • arms_right
  • legs_left
  • legs_right

Accessory
  • extra_head
  • extra_body
  • extra_leg_left
  • extra_leg_right

Important Attachments for Gibs
  • gore_head
  • gore_body_lower
  • gore_arm_left
  • gore_arm_right
  • gore_leg_left
  • gore_leg_right

Disclaimer
You aren't required to include any of these bodygroups or attachments, however if you want to use gibs you should include the respective bodygroups and attachments, if you want extra customization choices like different hats, chest pieces or leg pieces you should include the respective bodygroup(s).

Important
If you decide to drop gibbing, don't include any gib stuff in the script(s) either...
Creating the script(s)
Luckily this is the easiest part, but can be confusing for some.
BrainBread 2 does a wildcard search for any character scripts (.txt files) that lie under "brainbread2/data/characters/", this is necessary otherwise you'd have to override one certain script everytime, meaning other addons would fight for priority.

There can still be duplicates, so be sure to give your character script a unique name.
Create a random script, for example some_model_pack.txt, you can include multiple playermodels in one file.

An example script
"Survivors" { "bb_chris_v1" { "name" "Chris Johnson" "description" "Some random description" "sequence" "menu_idle03" "gender" "1" "hands" "models/weapons/arms/c_bb_chris_human.mdl" "hands_zmb" "models/weapons/arms/c_bb_chris_zombie.mdl" "modelname" "models/characters/player/chris_johnson.mdl" "modelname_zmb" "models/characters/player/chris_johnson_zombie.mdl" "body" "models/characters/player/body/chris_johnson.mdl" "body_zmb" "models/characters/player/body/chris_johnson_zombie.mdl" "origin_x" "140" "origin_y" "0" "origin_z" "-43" "angles_x" "0" "angles_y" "190" "angles_z" "0" "CustomizationInfo" { "extra_head" "0" "extra_body" "0" "extra_leg_right" "0" "extra_leg_left" "0" "skins" "0" } "GibInfoHuman" { "head" "models/gibs/player/bb/chris_head.mdl" "arms_right" "models/gibs/player/bb/chris_arm_right.mdl" "arms_left" "models/gibs/player/bb/chris_arm_left.mdl" "legs_right" "models/gibs/player/bb/chris_leg_right.mdl" "legs_left" "models/gibs/player/bb/chris_leg_left.mdl" } "GibInfoZombie" { "head" "models/gibs/player/bb/chris_head_z.mdl" "arms_right" "models/gibs/player/bb/chris_arm_right_z.mdl" "arms_left" "models/gibs/player/bb/chris_arm_left_z.mdl" "legs_right" "models/gibs/player/bb/chris_leg_right_z.mdl" "legs_left" "models/gibs/player/bb/chris_leg_left_z.mdl" } } "bb_chris_v2" { "name" "Chris Johnson" "description" "Some random description" "sequence" "menu_idle03" "gender" "1" "hands" "models/weapons/arms/c_bb_chris_human.mdl" "hands_zmb" "models/weapons/arms/c_bb_chris_zombie.mdl" "modelname" "models/characters/player/chris_johnson.mdl" "modelname_zmb" "models/characters/player/chris_johnson_zombie.mdl" "body" "models/characters/player/body/chris_johnson.mdl" "body_zmb" "models/characters/player/body/chris_johnson_zombie.mdl" "origin_x" "140" "origin_y" "0" "origin_z" "-43" "angles_x" "0" "angles_y" "190" "angles_z" "0" "CustomizationInfo" { "extra_head" "0" "extra_body" "0" "extra_leg_right" "0" "extra_leg_left" "0" "skins" "0" } "GibInfoHuman" { "head" "models/gibs/player/bb/chris_head.mdl" "arms_right" "models/gibs/player/bb/chris_arm_right.mdl" "arms_left" "models/gibs/player/bb/chris_arm_left.mdl" "legs_right" "models/gibs/player/bb/chris_leg_right.mdl" "legs_left" "models/gibs/player/bb/chris_leg_left.mdl" } "GibInfoZombie" { "head" "models/gibs/player/bb/chris_head_z.mdl" "arms_right" "models/gibs/player/bb/chris_arm_right_z.mdl" "arms_left" "models/gibs/player/bb/chris_arm_left_z.mdl" "legs_right" "models/gibs/player/bb/chris_leg_right_z.mdl" "legs_left" "models/gibs/player/bb/chris_leg_left_z.mdl" } } }

Some important notices here are
  • bb_chris_v1 and bb_chris_v2 are the identifiers for the two playermodels, this string is used to lookup the actual data in-game. IMPORTANT: Ensure that your strings are unique!!!
  • You don't need to specify CustomizationInfo, GibInfoHuman or GibInfoZombie.
  • Gender is important to ensure the right soundset,
    "gender" "1"
    is male,
    "gender" "0"
    is female.
    One soundset supports a male and female version, so for instance if you wish to use the same soundset for two characters and they are not the same gender, simply make sure that the gender keyvalue is different. The gender defaults to 1.
  • modelname, modelname_zmb, hands, hands_zmb, body, body_zmb are required!
  • If you don't want to render any body for your character model you can set body and body_zmb to some NULL model / invisible model.
  • origin_<x,y,z> and angles_<x,y,z> sets at which angle and origin the playermodel will render in the character preview, play with these parameters until you're happy. You can rotate the model and zoom in/out with the mouse by default. (Hold LMB to rotate)
  • sequence sets which animation should be looped while the playermodel is rendered in the character preview.
  • Currently accessories have been limited to max 32 different helm, chest and leg pieces.
  • Skins use the default HL2 limit which should be around 1024.
  • name and description are just some friendly values which are displayed when you browse / display playermodels in the character preview.

Disclaimer
Don't use localization for name & description, since then you'll have to override for example brainbread2_english.txt, this file gets updated from time to time, workshop addons have priority meaning if you add localization you'll break newer localization for other features in the game.

A compressed script example, as simple as possible
"Survivors" { "bb_chris_compressed" { "name" "Chris Johnson" "description" "Some random description" "sequence" "menu_idle03" "hands" "models/weapons/arms/c_bb_chris_human.mdl" "hands_zmb" "models/weapons/arms/c_bb_chris_zombie.mdl" "modelname" "models/characters/player/chris_johnson.mdl" "modelname_zmb" "models/characters/player/chris_johnson_zombie.mdl" "body" "models/characters/player/body/chris_johnson.mdl" "body_zmb" "models/characters/player/body/chris_johnson_zombie.mdl" "origin_x" "140" "origin_y" "0" "origin_z" "-43" "angles_y" "190" } }
Creating the soundset(s)
There's already a thorough guide related to this, if you intend to make a new soundset, check this guide: HowTo - Creating a soundset

I'll add a few points though:
  • You can associate any soundset with multiple characters.
  • You can associate it with only a human player or zombie player.
  • Same rules applies for NPCs.
  • BrainBread 2 wildcards for all soundsets (.txt files) located under "brainbread2/data/soundsets", like for characters - keep the filenames unique!

Adding a bunch of soundsets to our previous bb_chris_v2 character
"SoundData" { "HumanPlayer" { "Name" "Default" "Prefix" "Pantsman" "CharacterLink" "bb_chris_v2" } "HumanPlayer" { "Name" "Charlie" "Prefix" "Charlie" "CharacterLink" "bb_chris_v2" } "ZombiePlayer" { "Name" "Default" "Prefix" "Default" "CharacterLink" "bb_chris_v2" } "HumanPlayer" { "Name" "Josh" "Prefix" "Joshua" "CharacterLink" "bb_chris_v2" } "ZombiePlayer" { "Name" "Josh" "Prefix" "Joshua" "CharacterLink" "bb_chris_v2" } "HumanPlayer" { "Name" "Johnsson" "Prefix" "SecurityJohnsson" "CharacterLink" "bb_chris_v2" } "HumanPlayer" { "Name" "Postal Dude" "Prefix" "PostalDude" "CharacterLink" "bb_chris_v2" } "ZombiePlayer" { "Name" "Postal Dude" "Prefix" "PostalDude" "CharacterLink" "bb_chris_v2" } }

To be clear
  • Name can be anything, this is the string which appears in the character preview soundset combo box.
  • Prefix is the actual soundscript prefix. The prefix 'Postal' would have a soundscript 'HumanPlayer/ZombiePlayer_Postal_Male/Female.<sound>', Male/Female is decided by the character's 'gender' keyvalue.
  • CharacterLink is the character identifier.

Soundscripts
By default all HL2 soundscript files had to be added into game_sounds_manifest.txt, this would be a major issue for BrainBread 2, because different addons could have different game_sounds_manifest.txt files, omitting default and other addon soundscript files.
Therefore, game_sounds_manifest.txt is generated dynamically, you don't have to care about this file, forget about it!
When you create the actual soundscripts, just put them in "brainbread2/data/soundscripts/**somewhere**/. BrainBread 2 does a wildcard through every directory under that folder, but still, keep unique filenames!

Check out BrainBread 2's data folder for more examples!
Creating the workshop addon
You're in luck again, a guide has already been made for this, check HowTo - Create a workshop addon.

However, be sure to verify that you have setup a correct filestructure when you select the folder where you want to upload files @ Workshopper App.

For example when you select a folder to upload from, that folder should contain some of these folders:
  • data
  • models
  • materials
  • sound
  • maps
  • etc....
Finished!
That's it, you have now successfully added new playermodels for BrainBread 2!

Some handy in-game commands: (sv_cheats must be set to 1!)
  • reload_gamebase_server <- Reloads inventory items, maps, npcs, etc...
  • reload_gamebase_client <- This will reload all characters and soundscripts. + inventory, items, maps...
  • setmodel <- Example setmodel bb_chris_v1

Disclaimer
Client-Side playermodels will not work in any BrainBread 2 version prior to v1.0.2.4!