Coding Help Need help with custom animal mod

WonkyPenguin

Newcomer
I want to make a mod that makes new animals available to buy from Marnie, along with new animal products that will be produced by these animals. I need help with how to code such a mod. I can't find any tutorials anywhere and I tried just downloading other people's custom animal mods and looking at the content.json files but I am new to modding and confused about what does what in the code. Please help!
 

mightygaspar

Newcomer
That is how I am figuring out how to mod. My best advice is to find several mods that have similar principles to what you wish to make.
To begin with, in your created mod folder you need to have a folder named "assets" and two .json files. Your images used for your mod will be placed in the "asset" folder. Required images will be one adult image, one baby image, one shop image and an image for each produce item. The two .json files, One file named content.json (the location for all of the code) and a manifest.json which has the information for version, author and other things.
I made a custom animal of a naked molerat by combining two different mods. I knew the Animal I wanted to create had a similar functionality as the pig.(dig up items)
I found the mod void pigs by angeltear. here is the .json code. I'll try to annotate where I can.


{
"Format": "2.0.0",
"Changes": [
This section allows for the mod to load the assets from the included asset folder.
{
"LogName": "Load assets",
"Action": "Load",
"Target": "assets/VoidPig1, assets/BabyVoidPig1, assets/voidpigshop1, assets/voidtruffle, assets/voidtruffleoil",
"FromFile": "assets/{{TargetWithoutPath}}.png" Target without path is because in this mod all assets were in one folder and not separated into specific folders.
},
This section creates the custom animal data, shop information and new produce.
{
"LogName": "Animal Data",
"Action": "EditData",
"Target": "Data/FarmAnimals", Designates what data is being edited
"Entries": {
"VoidPig": {
"DisplayName": "Void Pig",
"House": "Barn", Designates building animal lives in
"Gender": "MaleOrFemale",
"PurchasePrice": 18000,
"ShopTexture": "assets/voidpigshop1", This line is calling back to the asset file loaded in the above section
"Sound": "pig", This line can be changed to other animals such as "chicken" or "Cow" etc.
"ShopSourceRect": {
"X": 0,
"Y": 0,
"Width": 32, This is the size of the icon in the shop in pixels.
"Height": 16
},
"RequiredBuilding": "Deluxe Barn", This could be "barn, Big Barn or Deluxe barn or coops. Animal will not show up in shop before this requirement is met.
"ShopDisplayName": "Void Pig",
"ShopDescription": "A species of pigs coming from the dark corner of the world",
"ShopMissingBuildingDescription": "???",
"BirthText": "A new void pig has been born!",
"DaysToMature": "8", How quickly animal becomes adult
"DaysToProduce": "1", How often animal produces goats take 2 days for instance.
"ProduceItemIDs": [ This section designates the produce item animal produces
{
"Id": "Default",
"Condition": null,
"MinimumFriendship": 0, Friendship level required to produce. default is 0
"ItemID": "VoidTruffle" Item is created below
}
],
"HarvestType": "DigUp", This tells what type of produce. Chickens "drop daily" for example
"HappinessDrain": 3, How much happiness is lost when you forget to feed or pet
"GrassEatAmount": 1,
"ShowSummitCredits": false,
"CanGetPregnant": false, If you want animal to reproduce or to lay eggs.
"BabiesFollowAdults": true,
"Texture": "assets/VoidPig1", calls up the asset for the adult pig from the first section
"BabyTexture": "assets/BabyVoidPig1", calls up the asset for the baby pig from the first section.
"SpriteWidth": "32",
"SpriteHeight": "32"
}
}
},
{ Creates produce item for void truffle
"LogName": "Item Data",
"Action": "EditData",
"Target": "Data/Objects",
"Entries": {
"VoidTruffle": {
"Category": -18,
"Description": "A strange-looking grey truffle. It doesn't not look edible at all.", In game description
"Displayname": "Void Truffle", In game display name
"Name": "Void Truffle",
"Price": 375, sell price
"Texture": "assets/voidtruffle", Calls up the produce asset from the first section
"Type": "Animal Product",
"Edibility": -15, Not sure about this, I'm new at this and didn't test. probably hurts the player 15 since it is a negative.
Who liks/hates

"GiftTastes":
{
"Love": ["Krobus", "Wizard"],
"Hate": ["Abigail", "Alex", "Caroline", "Clint", "Demetrius", "Dwarf", "Elliott", "Emily", "Evelyn", "George", "Gus", "Haley", "Harvey", "Jas", "Jodi", "Kent", "Leah", "Leo", "Lewis", "Linus", "Marnie", "Maru", "Pam", "Penny", "Pierre", "Robin", "Sam", "Sandy", "Shane", "Sebastian", "Vincent", "Willy"],
},
}
}
},
{ Creates the new truffle oil data without replacing regular truffle oil
"LogName": "Truffle oil Data",
"Action": "EditData",
"Target": "Data/Objects",
"Entries": {
"VoidTruffleOil": {
"Name": "VoidTruffleOil",
"DisplayName": "Void Truffle Oil",
"Description": "A glowing tar-like oil. Smells horrible. Probably tastes worse.",
"Type": "Artisan Goods",
"Category": -26,
"Price": 750,
"Texture": "assets/voidtruffleoil",
"Edibility": "-25",
"IsDrink": false,
"GiftTastes":
{
"Love": ["Krobus", "Wizard"],
"Hate": ["Abigail", "Alex", "Caroline", "Clint", "Demetrius", "Dwarf", "Elliott", "Emily", "Evelyn", "George", "Gus", "Haley", "Harvey", "Jas", "Jodi", "Kent", "Leah", "Leo", "Lewis", "Linus", "Marnie", "Maru", "Pam", "Penny", "Pierre", "Robin", "Sam", "Sandy", "Shane", "Sebastian", "Vincent", "Willy"],
},
}
}
},
{
"LogName": "Oil Maker Data", This is the code to allow the oil maker to output the void truffle oil.
"Action": "EditData",
"Target": "Data/Machines",
"TargetField": [ "(BC)19","OutputRules" ], This specifies the oil maker machine. The mayo maker is (BC) 24. I do not have a list, just other mods to reference.
"Entries": {
"VoidTruffleOil": {
"ID": "VoidTruffleOil",
"Triggers": [
{
"RequiredItemID": "VoidTruffle" Void Truffle in
}
],
"OutputItem": [
{
"ItemID": "VoidTruffleOil" VoidTruffle oil out
}
],
"MinutesUntilReady": 360
}
}
}
]
}
Now, this is my edited version of the same code creating the new Nakedmole rat.
{
"Format": "2.0.0",
"Changes": [

{
"LogName": "Load assets",
"Action": "Load",
"Target": "assets/NakedMoleRat, assets/NakedMoleRatBaby, assets/NakedMoleRatShop, assets/irradiatedtruffle, assets/irradiatedtruffleoil",
"FromFile": "assets/{{TargetWithoutPath}}.png"
},

{
"LogName": "Animal Data",
"Action": "EditData",
"Target": "Data/FarmAnimals",
"Entries": {
"NakedMoleRat": {
"DisplayName": "Mole Rat",
"House": "Barn",
"Gender": "MaleOrFemale",
"PurchasePrice": 8000,
"SellPrice": 16000,
"ShopTexture": "assets/NakedMoleRatShop",
"Sound": "rabbit",
"ShopSourceRect": {
"X": 0,
"Y": 0,
"Width": 32,
"Height": 16
},
"RequiredBuilding": "Big Barn",
"ShopDisplayName": "Mole Rat",
"ShopDescription": "A species of mutated mole rat common throughout the capital wasteland.",
"ShopMissingBuildingDescription": "???",
"BirthText": "A new mole rat has been born!",
"DaysToMature": "8",
"DaysToProduce": "1",
"ProduceItemIDs": [
{
"Id": "Default",
"Condition": null,
"MinimumFriendship": 0,
"ItemID": "IrradiatedTruffle"
}
],
"HarvestType": "DigUp",
"HappinessDrain": 3,
"GrassEatAmount": 1,
"ShowSummitCredits": false,
"CanGetPregnant": true,
"BabiesFollowAdults": true,
"Texture": "assets/NakedMoleRat",
"BabyTexture": "assets/NakedMoleRatBaby",
"SpriteWidth": "32",
"SpriteHeight": "32"
}
}
},
{
"LogName": "Item Data",
"Action": "EditData",
"Target": "Data/Objects",
"Entries": {
"IrradiatedTruffle": {
"Category": -18,
"Description": "A glowing grey truffle. Your geiger counter is melting.",
"Displayname": "Irradiated Truffle",
"Name": "Irradiated Truffle",
"Price": 375,
"Texture": "assets/irradiatedtruffle",
"Type": "Animal Product",
"Edibility": -15,
"GiftTastes":
{
"Love": ["Krobus", "Wizard"],
"Hate": ["Abigail", "Alex", "Caroline", "Clint", "Demetrius", "Dwarf", "Elliott", "Emily", "Evelyn", "George", "Gus", "Haley", "Harvey", "Jas", "Jodi", "Kent", "Leah", "Leo", "Lewis", "Linus", "Marnie", "Maru", "Pam", "Penny", "Pierre", "Robin", "Sam", "Sandy", "Shane", "Sebastian", "Vincent", "Willy"],
},
}
}
},
{
"LogName": "IrradiatedTruffle oil Data",
"Action": "EditData",
"Target": "Data/Objects",
"Entries": {
"IrradiatedTruffleOil": {
"Name": "IrradiatedTruffleOil",
"DisplayName": "Irradiated Truffle Oil",
"Description": "A viscous black cooking oil. A staple in any sophisticated ghoul household",
"Type": "Artisan Goods",
"Category": -26,
"Price": 750,
"Texture": "assets/irradiatedtruffleoil",
"Edibility": "-25",
"IsDrink": false,
"GiftTastes":
{
"Love": ["Krobus", "Wizard"],
"Hate": ["Abigail", "Alex", "Caroline", "Clint", "Demetrius", "Dwarf", "Elliott", "Emily", "Evelyn", "George", "Gus", "Haley", "Harvey", "Jas", "Jodi", "Kent", "Leah", "Leo", "Lewis", "Linus", "Marnie", "Maru", "Pam", "Penny", "Pierre", "Robin", "Sam", "Sandy", "Shane", "Sebastian", "Vincent", "Willy"],
},
}
}
},
{
"LogName": "Oil Maker Data",
"Action": "EditData",
"Target": "Data/Machines",
"TargetField": [ "(BC)19","OutputRules" ],
"Entries": {
"IrradiatedTruffleOil": {
"ID": "IrradiatedTruffleOil",
"Triggers": [
{
"RequiredItemID": "IrradiatedTruffle"
}
],
"OutputItem": [
{
"ItemID": "IrradiatedTruffleOil"
}
],
"MinutesUntilReady": 360


Hope this helps a little bit.
 
Last edited:
Top