How do I make Consumable items? - Catman-232/Homebrewery GitHub Wiki
First go into the mod's own HomebreweryFiles > Template folder and Copy the Template_ConsumableItem folder
Paste the item folder into HomebreweryFiles > Consumable
Rename the folder to something you can recognise and don't change it again!
Inside the folder you will see icon.png and param.txt
icon.png is a 32x32px sprite you can use to represent the item however you like.
param.txt contains the details the game needs in order to define the item and what it contextually does.
{
"_itemName": "This text is the Consumable's display name",
"_itemDescription": "This text goes in the space beneath the Consumable's name",
"food": 2,
"damage": 5,
"cooldown": 5,
"usesound": "Catman-Homebrewery-SFX-MeteorSmash-UseSound",
"_consumableObject": "Nothing",
"cond1name": "knockback",
"cond1power": 100,
"cond2name": "gravity",
"cond2duration": 5,
"cond2power": 0.15,
"cond3name": "damage",
"cond3duration": 5,
"cond3power": 5,
"cond3interval": 1
}
This item params is a mash up of other items that come with Homebrewery, just to serve as an example of all the optional properties you can have. If you aren't using specific ones, they don't need to be in the params at all!
Edit the text within the speech marks ("") to change the text the item displays in-game.
"_itemName": "Very Cool Consumable",
"_itemDescription": "This Consumable is Very Cool!",
"food" is an optional property that sets how much of your food capacity the item takes up when you eat it, any custom consumable without this property set has it defaulted to 2. Your capacity is 5 and it drains back to 0 at a rate of about 1 per 60 seconds. If you think this is silly or inconvenient and want to bypass it entirely, there is a config option BypassFoodCapacity
which will allow you to always eat Homebrewery consumables.
"food": 2
There isn't really any limit to what number you can make the food property, but if it was above 5, you'd probably never be able to eat the item. You can also use a negative value to make an item that empties your capacity, but it can't go below 0.
"damage" is an optional property that sets how much of your health drains when you eat it, it works like the Bunbag in reverse, it directly drains health. This does not do the damage numbers particle effect, but thanks to a tweak in the patch that enables this to work, it will make your character use the hurt eyes for a bit.
"damage": 10
"cooldown" is an optional property that sets how long it takes for you to be able to use the item again, the minimum is 1 second, the default is 8 seconds (which was what the Bunbag had when I implemented this).
"cooldown": 5
"usesound" is an optional property that adds a sound effect to using the item, this should work even if the server does not have the item, not sure if others who do have the item will still hear it though.
"usesound": "Catman-Homebrewery-SFX-MeteorSmash-UseSound"
Sound effects are referenced similar to how custom model parts are, you need an SFX folder in your content pack, the name of the folder and the name of the file are used in the import process. So for example Catman-Homebrewery-SFX-MeteorSmash-UseSound
means the content pack "Catman-Homebrewery" (HB itself in this case), the "SFX" folder, a "MeteorSmash" folder inside SFX, and an mp3 file called "UseSound" inside that MeteorSmash folder.
The MP3 file must be named correcly to establish context, the aliases are:
"use", "consume", "onuse", "onconsume", "usesound", "consumesound", "onusesound", "onconsumesound"
"_consumableObject" is an optional property that sets a particle effect, often with a sound, to using the item. By default this will be the Bunbag's green circle and sound they make. For custom dyes, they will use the effect added in 72025.a3 for dyes, specifically the Black Dye's one. If you want the item to not have any effect when you use it, you can use "Nothing" to remove the default effect. These will only work if the server has the item, since it relies on the callback of the item being used, I don't think I can really do anything about that right now.
"_consumableObject": "innerFocusEnd"
"cond1name" to "cond5name" are optional properties that allow you to add effects to be applied when using the item, this has replaced the previous system of the "extra" properties keywords that relied on custom ScriptableStatusEffects, instead HB itself now handles these using a component added to all Players. Click here to jump to the list of effects.
"cond1name": "knockback"
"cond1duration" to "cond5duration" are optional properties that allow you to set durations for the effects, some effects do not actually use this property as they are either only applied once (e.g. Knockback), or are a constant effect (e.g. Rainbow Hair).
If you set the duration value to -1 (Or anything below 0 really), the effect will roll a random duration before being synced to others. This range is 2 - 3.5 seconds.
If you set the duration to 0, the effect will apply a single tick only.
"cond1duration": 10
"cond1power" to "cond5power" are optional properties that allow you to set potencies for the effects, some effects do not actually use this property as they wouldn't really have any use for it (e.g. Rainbow Hair). Effects that concern character proportions are limited by the config files in the HBLimitCFGs folder (In BepInEx > config), as such if an effect is strong enough that the tick would push you outside of the relevant range, it will not apply.
"cond1power": 2
"cond1interval" to "cond5interval" are optional properties that allow you to set a tick rate interval for the effect. By default, and at minimum, this is 1/60 (0.16666666~) - about once per frame at 60fps. For example, setting this value to 2 will make the effect only happen every two seconds rather than constantly. Effects that do not use duration, also logically do not use this either.
"cond1interval": 1
And here we are: