creating a bro via a json file - Gorzontrok/Bro-Maker GitHub Wiki
Inside your BroMaker_Storage folder, create a subfolder for your bro named after it, then create a file inside that subfolder with a .json extension. Insert the following text inside:
{
"name": "ExampleName",
"characterPreset": "CustomHero",
"parameters": {},
"cutscene": {},
"abilities": {},
"unlockConfig": {},
"beforeAwake": {},
"afterAwake": {},
"beforeStart": {},
"afterStart": {}
}Any .png files referenced by this JSON (sprite, gun sprite, avatar, cutscene sprite, etc.) must be in the same folder as the JSON file.
A bro JSON file isn't loaded on its own. BroMaker finds bros through a .mod.json file that lists them. See Creating a Mod File for how to set that up.
Inside the JSON there are multiple keys and values. Each has its purpose.
-
"name"is the name of the bro as it appears in BroMaker's menus -
"characterPreset"is the "base" of the character. It can be the name of a vanilla bro or a custom preset you've created via programming. For a custom preset, this value must match the first argument of your bro class's[HeroPreset(...)]attribute. -
"parameters"have variables that can be set to control various aspects about the character's avatar, special icons, etc. See Parameters -
"cutscene"contains variables that control the cutscene that is played when you unlock the character. See Cutscenes -
"abilities": contains abilities to call at a certain moment. Example:
{
"abilities": {
"GrenadeThrow": ["UseSpecial"]
}
}The grenade throw ability is going to be called when the player presses the special key/button.
-
"unlockConfig"controls how the bro is unlocked. By default bros are always available, but you can require rescuing bros or completing a custom level. See Unlock Configuration -
"beforeAwake" "afterAwake" "beforeStart" "afterStart"are called before or after the methods Start or Awake.
Inside them, you put the variable name and the value you want to assign to it.
e.g.
{
"beforeAwake": {
"speed": 200
}
}To see what variables you can assign values to, you can take a look at this page which has most of the variables.
To find more you can use dnSpy or RuntimeUnityEditor
-
bool: true or false -
int: a number (e.g. 123) -
float: a floating number (e.g. 12.345) -
Enum Type: a string or an int (e.g. from BloodColor | Red or 0) -
SpriteSMorMaterialorTextureorTexture2D: value is string which is the name of the file with the extension. The image should be located in the same folder as the JSON file. -
Grenadeor subclass ofGrenade: value is string ; it's the name of the grenade. -
Projectileor subclass ofProjectile: value is string ; it's the name of the projectile.
{
"parameters": {
"Sprite": "Bronobi_anim.png", // Main character sprite
"GunSprite": "Bronobi_gun.png" // Gun sprite
},
"beforeAwake": {
"speed": 150, // float
"originalSpecialAmmo": 2, // int
"canChimneyFlip": true, // bool
"projectile": "Sniper", // Projectile
"specialGrenade": "HolyWater" // Grenade
}
}Let's say you want to change the damage of a projectile, how do you do it ?
To navigate through variables, you need to place a . between the variable
e.g.
{
"afterAwake": {
"projectile.damage": 50
}
}So if you want to change the avatar sprite
{
"afterStart": {
"player.hud.avatar": "MyCoolAvatar.png"
}
}