Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(2 edits)

Awesome plugin, thank you for this! I've had it for a couple days now and I've been working on adding in a fifth ingredient slot, which I am just finishing up tonight. I also centered the 'Craft' text at the bottom of the ingredients list. 

One thing I am having trouble with is removing the 'Craft' function from the fifth ingredient entry slot. After loading up some ingredients for a recipe, I can still craft the item from selecting the fifth slot. [See attached Image]


Another question I have is about running a block of code on every successful crafting of a recipe. I'd like to show certain data, like the last item crafted, the most valuable item crafted and the total value of all the items crafted within a given category and if I could control variables on every successful attempt, I would be able to do that.

I am currently looking at the function on line 6622:

Window_CraftingResult.prototype.callSuccessResult = ...

but I'm not sure exactly what to do from there...Any chance you'd be able to help me implement this?


-EDIT-

I was able to figure out how to remove the 'Craft' Function from the fifth ingredient slot by changing the condition:

'if (index < 4)'  of line 5984's function:

Window_IngredientSlot.prototype.isEnabled

to: 'if (index < 5)'

So disregard the attached image.

I still need to test a recipe with 5 ingredients and then test out some partial recipes as well as that will be the true test to see if I did this properly.

(+1)

Heya.

I'm not sure how much luck you're going to have trying to use a fifth slot like that. In the end, a lot of the functions that check for recipe matches are hard coded to only check for four items in the recipe, so there's probably going to be a lot of slight things you're going to have to change.

For example, the code that checks for a partial match specifically only checks for recipes that contain one less, and then two less ingredient items than the ingredients provided, because it is impossible for a recipe to only have one ingredient, a check for n-3 was not needed. But if you can provide 5 ingredients, a recipe with only two ingredients would never be partially matched because it would have 3 less ingredients than what was provided.

As for your second question, there is a new(ish?) feature that was added a couple of updates ago which you may find useful. The CraftingCompleteRunOnce plugin parameter located inside the result item list is a block of code that is run once when the item is crafted the first time. You can use this to track what you're looking for, and then edit the part of the function that turns it off after it's run once to make it happen every time the item is crafted instead.

That is located inside the Window_CraftingResult.prototype.callSuccessResult function. It starts on line 6550, and specifically line 6563 is what sets it to never run again after the first time $gameParty._craftingRunOnce[Ramza.CSParams.resultItem.indexOf(result[1])] = true . If you comment out this line, it should cause the code to run every time.

-Ramza

(+1)

Oh, the line number I gave was for if you have it set to not allowing soft failures.

If you have soft failure chance the line is actually 6616.

-Ramza

(2 edits)

Thank you!! That worked. Since I added some lines of code, the number values didn't match up but I just stared by editing out all 4 of the instances of that for now, did a console.log('test') and it seems to be working for the main recipe. It doesn't run on a partial soft fail/success, which might be normal.

As for the fifth ingredient slot, I'm making decent progress but have 2 factors to resolve currently.

1. When I have 4 ingredients loaded into their slots, the 5th ingredient slot still acts as a 'Craft' button, but only when all 4 ingredients are present. 

2. Since I haven't been able to load a 5th ingredient, I can't tell if the partials are working properly. They are working with 3 and 4 ingredients but it seems to be giving the 'craft successfull' scene but taking the additional items, which I am not sure if that is normal. I'll have to check more after work today. Thanks again for all your help and for the amazing plugin. 

(+1)

You can call Ramza.CS.findRecipe(ingredientsquantity) from the console to test if it will find a recipe with any ingredients.

ingredients is an array of 2-4 (or 5 in your case) items, so [$dataItems[12], $dataItems[13], $dataItems[14], $dataItems[15]] would be an example of four ingredients being provided to the function. quantity is also an array, this is the for quantity of items given. So calling the above function with the below code is a good test to see if it's working, and in fact, was how I did testing on the recipe functions before I'd coded the interface for it:

var inglist = [$dataItems[12], $dataItems[13], $dataItems[14], $dataItems[15]]
var qtylist = [1,1,1,1]
Ramza.CS.findRecipe(inglist, qtylist)

That should return some stuff in the console if it found a match. It returns true, the result item (which is the first list in the recipe list plugin parameter), and then the recipe element of that result item. So if you have multiple recipes for one item, it'll tell you which recipe it found successfully. 

In the case of a partial match, the first value it returns will be false, but the other two will be the same thing. If no match at all is found, it only returns false.

Your other issue is probably because the function Scene_Crafting.prototype.onIngredientSlotOk is used both for clicking on an empty (or filled) ingredient slot as well as the craft button, because all of those are all items in the command list. I had to make it so it knew which one of those things you were clicking 'Ok' on, so it does an index check. Change the <= 3 to <= 4 and it should work from there.

-Ramza

(1 edit)

So I seem to have successfully added the fifth ingredient slot!

Thank you for pointing me to the onIngredientSlotOk function, I totally missed it, but it definitely worked!
Also, thank you for the code to check recipes in the console, that will make filling out the recipes a lot easier.

I'm really glad I got this plugin, I've been looking at it for a while now and I'm excited to put it into effect!

I am still debating whether or not to keep Yanfly's synthesis around for the basic synthesis aspect as I have put a lot of work into some custom synthesis effects.

I am wondering if there is a way to reference the price of the result item in the recipes on creation code block?

Also, are you familiar with a plugin by DreamX that uses Yanfly's Item Core to apply random prefix and suffix attributes to synthesized weapons and armors?

That would be a cool plugin to create compatibility with. If that's something you'd be open to, I'd be interested in talking further about a commission. 

I can't thank you enough for all your help.

(+1)

The codebox can actually reference the variable resultItem to get the properties of the item returned, so you could use resultItem.price to get the gold value of the base item. I think that value will be different than the actual value of the actual item given if you're using random affixes that end up changing the price of the result, though.

This probably won't entirely work as a replacement for the synthesis plugin, but you could use my recipe list extension in tandem with the default crafting plugin. Recipe list makes it so that the player can raft known recipes from a list, without having to put the individual ingredients into the slots every time, or having to keep mental notes of the ingredients involved in each recipe. You could set it up so that the player learns recipes through experimentation, and then can synthesis them more easily from the recipe list menu instead. Of course, if you used that, you'd also need to modify it to make use of the fifth ingredient slot you've added, so that might add some difficulty to it.

As for your custom synthesis things, I don't have a particularly good replacement for those. You can use an <on creation eval> note tag from item core on the items, and do all kinds of modifications to the result item if it was given to the player on the crafting scene, like attach augments, or use item upgrades on them, but without knowing exactly what you were doing with synthesis, suggestions for replacements will have to be vague like that.

You could also look into the 'Additive Ingredient Traits' I have in this plugin to add some stuff to your crafted gear from the ingredients used. Those aren't random, though.

I am aware of that plugin by DreamX, but I've never used it myself, and I'm not entirely sure there's a way to get it to work together with my system. I'd need to look more closely at how it works to see how it does what it does, and see if that can be taken into account.

-Ramza

(+1)

Awesome, I'll take a look at the extension shortly. And I guess I wouldn't worry about the DreamX plugin, as it makes more sense to let the player decide which stats to apply through attachments after the creation process. I think the additive traits will work just fine for me, especially having an additional slot. 

Thanks again!