Recommended Posts

Kiibie    0
Posted (edited)

Hello there! I've been trying to make a custom crockpot burger food recipe for my character mod, by following this item sample: https://forums.kleientertainment.com/files/file/202-sample-mods/

Following this and even going to check out mods that succeeded the same doesn't quite work for me? The item DOES exist it the game, as I can spawn it in my inventory (using c_give, as c_spawn doesn't work for it), but it is impossible to put on the ground (it disappears instantly and doesn't exist at all anymore) And it also does not cook in the crockpot with the recipe I made.

I assume it has to probably do with the way I get the anim.zip to work. I didn't really find a tutorial that shows how to proceed once the art is done to make the zips and all, so I made a spriter in the exported folder to get it to compile the anim automatically. I don't really know if I do it properly, so any help would be amazing!

I have attached my whole mod folder as a zip to this topic, (below the gif)  if anyone is willing to help me! Thanks for reading! :)

Here's a gif of the issue in-game: 


570d4df5428016df3f2282c52db5910e.gif?_ga

 

Edited by Kiibie

Share this post


Link to post
Share on other sites
Lumina    2,089

You probably have more than one thing wrong if your item disappears on ground (and isn't just invisible, that could happens).

Verify your code, because you could miss something.

 

See this topic about how to make your food item so it will appears when you'll cook in on crockpot (but you'll have to solve the recipe failing because this isn't normal).

 

If you can't solve yourself the problem i'll try to take a look at your mod later, but at least do the anim part so this will be done.

Share this post


Link to post
Share on other sites
Kiibie    0
Posted (edited)

@Lumina Hey thanks for trying to helping me once again!

I have followed your tutorial and I think what I missed was adding the pivot to my asset. Although, now the burger shows up half a second on the ground and flickers. It also still does not show up in the crockpot at all.

EDIT: I added a second folder 'burger' in the folder 'burger' in exported, and it fixed the problem for it not showing up! THOUGH the recipe still does not work in the cookpot, it still makes chilli instead of my burger.

I attached a new zip to this post with my updated anim.zip, if you really are willing to look at it later (You're way too nice already)

 

 

Edited by Kiibie

Share this post


Link to post
Share on other sites
Lumina    2,089
10 hours ago, Kiibie said:


EDIT: I added a second folder 'burger' in the folder 'burger' in exported, and it fixed the problem for it not showing up! THOUGH the recipe still does not work in the cookpot, it still makes chilli instead of my burger.

This part is because the recipes work based on priority. If you put ingredients, the game will see what recipes are using this ingredients, then if multiples recipes could use the same ingredient, will choose which one is used based on priority.

10 is the highest priority (with some specific exceptions), 1 is the lower.

Your recipe is :


local burger = {
	name = "burger",
	test = function(cooker, names, tags) return names.meat == 2 and names.red_cap == 1 and names.eggplant == 1 end,
	priority = 1,
	weight = 1,
	foodtype="MEAT",
	health = 30,
	hunger = 65,
	sanity = 40,
	perishtime = TUNING.PERISH_SLOW,
	cooktime = 0.95,
}
AddCookerRecipe("cookpot", burger)

Hot Chili recipe is :


	hotchili =
	{
		test = function(cooker, names, tags) return tags.meat and tags.veggie and tags.meat >= 1.5 and tags.veggie >= 1.5 end,
		priority = 10,
		foodtype = FOODTYPE.MEAT,
		health = TUNING.HEALING_MED,
		hunger = TUNING.CALORIES_LARGE,
		perishtime = TUNING.PERISH_MED,
		sanity = 0,
		temperature = TUNING.HOT_FOOD_BONUS_TEMP,
		temperatureduration = TUNING.FOOD_TEMP_LONG,
		cooktime = .5,
	},	

red cap + eggplant give a total value of tag.veggie of 1.5, and two meat give a total value of tag.meat of 2. Meaning that your combination of ingredient fullfil the requirement for hot chili, and since chili has an higher priority than your burger, it will always result in a chili.

So as far as i can tell, it's not your code the problem.


Giving your dish a priority of 10 will result in half a chance to obtain a burger, half a chance to obtain a chili. Changing the recipe for chili isn't the best option, for me. I would not suggest to use a priority bigger than 10 since it's used for really special food (like the jellybean recipe). So better to keep it for real special cases, not classic foods.

 

The best option is, if possible, to change the recipe so it will not conflict with other recipes. But it's not easy since meat and veggies are common ingredients. I don't have a suggestion. Usually when i want to be sure that my custom recipe will not conflict with existing recipes and existing modded recipes, i use a custom ingredient. But creating a custom ingredient require some more work and idea, so it's not really a solution if you just want a small mod.

Share this post


Link to post
Share on other sites
Kiibie    0
Posted (edited)

Ohhhh! I had read about priority but never understood exactly how it affected the recipes that way! I'm very very grateful you take the time to help and explain it to me, it makes much more sense now :D
 

EDIT: I have made wheat and it appears correctly in the game, it doesn't have any problems so far (Still haven't checked if it grows in farms) but it cannot be added inside the crockpot, even if I tagged it as veggie.

Edited by Kiibie

Share this post


Link to post
Share on other sites
Lumina    2,089
Posted (edited)

You'll have to have your wheat prefab, define the rarity of the seed, and create the associated seed prefab (look at seeds.lua for example).

You also have to define cooking tags for your wheat, so it can go on the crockpot and be used in other recipes. In your modmain, add a line like this :

		AddIngredientValues({"myveggie"}, {veggie=1, squash=1, root=1})

(I do think there are the main steps to do but could forget some...)

You could add whatever tag you want, they don't necessarily have to already exist. Just keep in mind that without existing tag, your ingredient will only serve as a filler in existing recipes. A veggie without the tag veggie will not count as a veggie for recipe.

I suggest you two things :

- Give your prefab names that aren't too common. There is nothing wrong with burger, wheat and flour... But chances are high that another mod will use these names too, resulting in compatibility issues if someone use both mods. Use prefabs' names like "yourcharacterburger" or "eggplantburger" and it will be easier to avoid conflict.

- Look at waiter101 mod. This is probably the biggest mod adding food to the game and not only you'll find useful informations, you'll also see the tags used so you can use the same tags to ensure that someone using both of your mod will be able to make your burger using his flour and his sandwich using your flour. (Also, you could look at the name of his prefab, to avoid using the same).

 

By the way, using tag is better when you want the recipe to be generic, using name is better when you really want this specific ingredient being used.

 

 

Note : AddIngredientValues works fine for custom ingredients you created. Don't use it for existing food if you want to change their tags, this will overwrite other tags they have. There is a cleaner way to add tag to existing ingredients.

Edited by Lumina

Share this post


Link to post
Share on other sites
Kiibie    0

Wow, I must say you answered all my questions!  I tried everything you stated, and now all works like a charm! :D

Now I really understand better the logic and the steps behind the creation of custom food items, it's not even that hard once you know it. I learned more in a few posts asking you questions than all the hours of tutorial researches I've been doing.

Thanks a lot for helping willingly so much people on this forum! If you ever want character portrait art for your mods, I'm all up to draw that free for you ;v;

Share this post


Link to post
Share on other sites
Lumina    2,089

Thanks for the offer. I'm really a slow modder so at the moment i don't need it but it could be the case one day, so i'll remember the offer :)

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now