Skip to content

Creating a Bro Via a JSON File

Alex Neargarder edited this page Feb 21, 2024 · 1 revision

Create the File

There are 2 ways to create the file

  1. Create a file inside Broforce\BroMaker_Storage then change the extension to .json. Insert The following text inside
{
  "name": "ExampleName",
  "characterPreset": "CustomHero",
  "parameters": {},
  "cutscene": {},
  "abilities": {},
  "beforeAwake": {},
  "afterAwake": {},
  "beforeStart": {},
  "afterStart": {}
}
  1. Launch the game, inside of the BroMaker GUI, go to Create New Object tab, give a name to the file then click Create.

Explanation of the Keys

Inside the JSON there are multiple keys and values. Each has its purpose.

  • "name" is the name of the bro
  • "characterPreset" is the "base" of the character. It can be the name of a vanilla bro or a custom preset such as "CustomHero" or "SwordHero"
  • "parameters" have keys that can be enabled or disabled to make some things easier to do. 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.

  • "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
  },
  [...]
}

Variables

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

Handled Types

  • 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)
  • SpriteSM or Material or Texture or Texture2D : 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.
  • Grenade or subclass of Grenade : value is string ; it's the name of the grenade. Names
  • Projectile or subclass of Projectile : value is string ; it's the name of the projectile. Names

Example

{
  [...]
  "beforeAwake": {
    "speed": 150, // float
    "originalSpecialAmmo": 2, // int
    "canChimneyFlip": true, // bool
    "projectile": "Sniper", // Projectile
    "specialGrenade": "HolyWater" // Grenade
  },
  [...]
  "afterStart": {
    "sprite": "Bronobi_anim.png" // Texture
  }
}

Change a Value of a Variable Class

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"
  }
}