Jump to content

adding custom evolved recipes, is it possible?


Deadend

Recommended Posts

So I can modify existing evolved recipes. But Whenever I try to add my own the whole evolved recipe system breaks down. Like I can't make anything with evolved recipe.

An example is that say I'll make for example

evolvedrecipe VeggieJuice{           BaseItem:JuiceMaker,	   MaxItems:6,	   ResultItem:Juice,}

and then say I'll take the tomato item and add my recipe..

item Tomato	{		Type				=		Food,		DisplayName			=		Tomato,		Icon				=		Tomato,		Weight				=		0.2,		HungerChange 		=		-10,		ThirstChange		=		-15,		DaysFresh 			=		4,		DaysTotallyRotten 	=	 	12,		EvolvedRecipe       =       VeggieJuice:2;Soup:10;Stew:10;Pie:10;Stir fry:10;Sandwich:5;Burger:10;Salad:10;Roasted Vegetables:10,		FoodType    =   Vegetables,	}

Then I'm unable to make neither my custom evolved recipe or any of the default ones...

Link to comment
Share on other sites

That you are unable to make the other ones suggests you broke the script you edited with a syntax error.

 

Go through and find it. Maybe check your Juice item.

 

Keep in mind that you'll need to append lua script onto IsAddItem to convert the fruit's hunger to thirst in some proportion. Since the lua script already checks recipe composition, you might also use it to change the icon based on ingredients, so that apple juice doesn't look like lemon juice.

 

My mod added custom cooking recipes, so it's totally possible =)

Link to comment
Share on other sites

 

That you are unable to make the other ones suggests you broke the script you edited with a syntax error.

 

Go through and find it. Maybe check your Juice item.

For starters, I can see an excess comma in the VeggieJuice recipe.

 

?

 

 

That you are unable to make the other ones suggests you broke the script you edited with a syntax error.

 

Go through and find it. Maybe check your Juice item.

 

Keep in mind that you'll need to append lua script onto IsAddItem to convert the fruit's hunger to thirst in some proportion. Since the lua script already checks recipe composition, you might also use it to change the icon based on ingredients, so that apple juice doesn't look like lemon juice.

 

My mod added custom cooking recipes, so it's totally possible =)

Well I looked through it and couldn't spot anything. Either way I decided to go about it in a different way. Gonna write a regular (not evolved) recipe for what I'm trying to do and have a a lua script hook onto the recipe when its being used. Seems to be working. What I primarily needed was a way to carry over remaining Hunger/ThirstChanges in one food (ingredient) item to the result item. Figured I had to indulge in lua scripting at some point xD.

 

Thanks nonetheless.

Link to comment
Share on other sites

There are no syntax errors in what you posted, but that doesn't mean there are no syntax errors in your script. I can promise you that if the other evolvedrecipes are not working that your script is throwing an error at game load that prevents the other recipes from loading, or causes an error in the evorecipe part of additem that prevents them from working.

 

You should make sure that you are importing the correct classes and requiring the correct files as well. Look in the cmd when you load the game for errors.

 

The other guy is wrong, btw. Lua allows that comma at the end, unlike most other languages. You might regret naming it VeggieJuice, though, since that will be what the player sees when he makes it.

 

Anyway, just use the IsAddItemInRecipe lua. It already does exactly what you want...

Link to comment
Share on other sites

There are no syntax errors in what you posted, but that doesn't mean there are no syntax errors in your script. I can promise you that if the other evolvedrecipes are not working that your script is throwing an error at game load that prevents the other recipes from loading, or causes an error in the evorecipe part of additem that prevents them from working.

 

You should make sure that you are importing the correct classes and requiring the correct files as well. Look in the cmd when you load the game for errors.

 

The other guy is wrong, btw. Lua allows that comma at the end, unlike most other languages. You might regret naming it VeggieJuice, though, since that will be what the player sees when he makes it.

 

Anyway, just use the IsAddItemInRecipe lua. It already does exactly what you want...

 

maybe is my lack of lua understanding but after going through the IsAddItemInRecipe.lua the only thing that script seems to be doing is how to set up the name of the end-item and making sure you have all the required items to perform the recipe. I don't see anything regarding how it will take whatever HungerReduction is left in an ingredient-item and add it to the end-result-item. I'll take a look at your mod.

 

 

EDIT: so I've noticed in your mod pile mod, the FoodRecipe.lua file you have you're using this function

function MakeBowlOfCasserole4_OnCreate(items, result, player)    for i=0,items:size() - 1 do        if items:get(i):getType() == "CasseroleRaw" then            result:setBaseHunger(items:get(i):getBaseHunger() / 4);            result:setHungChange(items:get(i):getBaseHunger() / 4);        end    endend

which is the same I was using for what I'm trying to do (working on my canning mod, not a juice mod). I wanted to make sure if you consumed a bit of an ingredient-item that the remaining hungerChange/Reduction carried over to the end-result-item. And using

result:setBaseHunger(items:get(i):getBaseHunger());result:setHungChange(items:get(i):getBaseHunger());

which is also what the game uses in recipecode.lua to carry over the hunger property in certain items (like from a pie to a slice of pie), turns out to be very inconsistent. I tried for example making a pot of soup that had -25 hunger reduction. Had I split this into 2 bowls it would have given me -12 hunger reduction per bowl, which is correct. But I didn't use a full pot of soup, to test the consistency of this I consumed 1/4 of the pot of soup (down to -18 hunger reduction) and split it in 2 bowls of soup. The bowls of soup had -12 hunger reduction instead of -8.

Maybe I'm being too neatpicky but I guess if even the game can't get this to work properly I won't be getting anywhere with the modding tools available unless I went into the source code which is a bit too much.

Edited by Deadend
Link to comment
Share on other sites

function ISAddItemInRecipe:perform() -- when your character executes the action to add an item to a recipe...    -- needed to remove from queue / start next.    ISBaseTimedAction.perform(self);    if self.character:getPrimaryHandItem() == self.baseItem then        self.character:setPrimaryHandItem(nil); -- unequip it from main hand    elseif self.character:getSecondaryHandItem() == self.baseItem then        self.character:setSecondaryHandItem(nil); -- unequip it from off hand    end    --this function references several magic vars, one of which is an object called 'recipe' that contains all the items in the recipe so far    self.baseItem = self.recipe:addItem(self.baseItem, self.usedItem, self.character); -- add the item to the recipe object    ISAddItemInRecipe.checkName(self.baseItem, self.recipe); --reevaluate the recipe object for its nameend

That you ignored the primary calling function at the top of the script and only read the big naming function suggests to me that you need to read either more carefully or properly investigate the function tree. Anyway, I spelled it out for you.

 

The evolvedrecipe is tracked with an object called 'recipe' that contains all the food objects added to it. Adding a new food object to the recipe object will add that object's stats to the summation. If you said VeggieJuice=5 back when you defined the food object, then when the function reads that food object during the summation, it will only add a max of -5 hunger or hungerbase, whicever is absolutely greater.

 

If you want to turn fruits into juice, you have to splice in a function that checks for primary object in the recipe such as VeggieJuice or w/e, then edit that specific food object to replace its thirstchange to a proportional multiple of its basehunger before it gets added to the recipe object.

 

The bug you are talking about you can fix with one line of code in the IsEatFoodAction file. The devs forgot/chose not to reduce the hungerbase value of food when you eat part of it. You can fix this bug by setting the hungerbase of the item to its hungerchange there. However, I have no idea if that's actually a mistake or a calculated sacrifice to protect hungerbase for its other intended functions, I chose not to do it when I was fucking with evolvedrecipes and new cooking professions.

 
 

 

Maybe I'm being too neatpicky but I guess if even the game can't get this to work properly I won't be getting anywhere with the modding tools available unless I went into the source code which is a bit too much.

 

 

You're not allowed to bitch about the developers not noticing a bug in the side of the code that they graciously reformatted from java specifically for people like you to play with and is one line in a hundred thousand for them when you can't even read the ten lines at the top of a script specifically given to you to fix your problem. 

Link to comment
Share on other sites

 

 

Maybe I'm being too neatpicky but I guess if even the game can't get this to work properly I won't be getting anywhere with the modding tools available unless I went into the source code which is a bit too much.

 

 

You're not allowed to bitch about the developers not noticing a bug in the side of the code that they graciously reformatted from java specifically for people like you to play with and is one line in a hundred thousand for them when you can't even read the ten lines at the top of a script specifically given to you to fix your problem. 

 

Modding the game can be convoluted and difficult depending on what you want to do and your experience with the game's code base. Nothing to get worked up about.

A reminder to everyone to be lovely, as always.

Link to comment
Share on other sites

 

 

 

Maybe I'm being too neatpicky but I guess if even the game can't get this to work properly I won't be getting anywhere with the modding tools available unless I went into the source code which is a bit too much.

 

 

You're not allowed to bitch about the developers not noticing a bug in the side of the code that they graciously reformatted from java specifically for people like you to play with and is one line in a hundred thousand for them when you can't even read the ten lines at the top of a script specifically given to you to fix your problem. 

 

 

 

Well I wasn't bitching. Simply stating that I can't use something that's not consistent in the game / seemed broken in the game (requiring a one line of code fix apparently, that I didn't know of). 

Link to comment
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
×
×
  • Create New...