creating a bro via a json file - Gorzontrok/Bro-Maker GitHub Wiki
There are 2 ways to create the file
- Create a file inside
Broforce\BroMaker_Storage\nameofyourbrothen change the extension to.json. Insert The following text inside
{
"name": "ExampleName",
"characterPreset": "CustomHero",
"parameters": {},
"cutscene": {},
"abilities": {},
"beforeAwake": {},
"afterAwake": {},
"beforeStart": {},
"afterStart": {}
}- Launch the game, inside of the BroMaker GUI, go to
Create New Objecttab, give a name to the file then click Create.
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 that you've created via programming. -
"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.
-
"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"
}
}