Crafting Script v3.8 - Updated 2/26/2015

The screens for version 1.3 look great.
I guess I don't understand. You can set if it cost coins or not
Whenever I set it to cost 0 but still require mats the script crashes and it gives me an error about it trying to divide by 0, the only thing that fixes it is to make the craft cost something over 0.
How do you set it to "cost 0"? 😳


If you don't want it to cost any gold, just remove the "[:gX]" part from the ingredients list (X can be any number there). That should eliminate the gold cost.


0 shouldn't be used at all when setting up ingredients. Just remove the things from the ingredients list if you don't want them to be ingredients.
It should be possible to edit the script to not "divide by zero" in the first place.
If the user has set up the recipes properly, there will never be any "divide by zero" cases, so editing the script is not necessary at all.


Why would anyone include something there with an amount of 0 anyway?
Because maybe some beginner in using RM might not understand this type of thing, that a cost of zero can be omitted. The average game maker does not seem to always understand things from a programming perspective, at least not the same way someone making scripts would.


I understand it, but the reason for seeing so many help-requests are just as much about the scripter's lazy coding as it is about the end-user's understanding or lack thereof. Why some game maker would put a cost of zero, is perhaps they would assume the tag is required; without proper documentation in the script or on the forum post, they simply go with what they know.
Because maybe some beginner in using RM might not understand this type of thing, that a cost of zero can be omitted. The average game maker does not seem to always understand things from a programming perspective, at least not the same way someone making scripts would.

I understand it, but the reason for seeing so many help-requests are just as much about the scripter's lazy coding as it is about the end-user's understanding or lack thereof. Why some game maker would put a cost of zero, is perhaps they would assume the tag is required; without proper documentation in the script or on the forum post, they simply go with what they know.
Exactly I figured the tag was needed therefore put cost 0...amd such has lead to "divide by 0" lol
I don't want to be mean, but the script itself came with a demo, there are perfect examples in the script itself also and the description of each symbol is above understandable.


If 10 sample recipe is not enough to see that the gold symbol ([:gX]) can be omitted at will, than I have no idea what do you expect from the scripter...


Yes, I agree, there are some scripts out there without proper documentation (I am trying to figure out one of them right now 😀 ), but this one is surely not from that category.


But hey, at least the issue is fixed, right? 😛
I don't want to be mean, but the script itself came with a demo, there are perfect examples in the script itself also and the description of each symbol is above understandable.

If 10 sample recipe is not enough to see that the gold symbol ([:gX]) can be omitted at will, than I have no idea what do you expect from the scripter...

Yes, I agree, there are some scripts out there without proper documentation (I am trying to figure out one of them right now 😀 ), but this one is surely not from that category.

But hey, at least the issue is fixed, right? 😛
I never said it was the scripter's fault or problem, I just was curious about it. The example words it as put 0 not omit the gold. Either way it doesn't matter cuz it's been figured out.
Bug report time! Yay! 😀

In the 'Actor Stat Changes Add on', in the 'draw_primary_stats' definition, you put:

if Venka::Crafting::Track_Extra 9.times do |i|This makes TP Regen not show up, because there are 10 X-params, not 9. 😛 Also the Randomization Addon "breaks" this addon, because apparently, it can not get the 'etype_id' of the randomized items, which is weird, because the regular equip scene surely can, or else the error would pop up instantly when opening the equip menu while having a randomized item.

I just made a return command if the item is an array to temporary get rid of that error.

Still couldn't managed to get it to work with randomized items. >.>

I also made another twist into the Randomization Addon, which makes it possible to include more items in the crafted items setup by using a variable number which will randomly get added to the base crafted item ID. This makes it possible to make some recipes with more than one possible outcome if successful.

Of course, this little addition assumes that the user has set up his/her item database in accordance of this new feature.

I will add this feature if I finish the testings and implement the same for the failed and pre-failed items too, which shouldn't take too long, as I already did this with another script and that one turned out fully functional.

So yeah, time to make even more random recipes! 😀
oh.. that was probably my bias at play subconsciously. I never saw the point of TP regen. I'll get that fixed up. I'll also take a look at the etype with the randomized items and see what I can do. I'm trying to put some finishing touches on my code-off challenge and then I'll look into these fixes (the code is done, just working on the demo project setup).
I love this script! I am having some issues though.

I downloaded the demo and spoke with the merchant to open his craft shop.

However, as soon as I exit his shop, I get this error:

Script 'Crafting Script v3.1' line 761: NoMethodError occurred.

Error ocurred, check the debug console for more information.
I tried replacing it with the standalone version.
That works just fine.

However, that breaks regular crafting for me and gives me this error:

Script 'Crafting Shop Craft & Decompile' line 501: NoMethodError occured.

Error ocurred, check the debug console for more information.
Anyone know what could cause this?

I don't have any scripts installed besides the ones in the demo.
Wow, nice find!

Line 761 is

return false if recipe.req_level > $craft[@craft_id].levelin the demo.And I wondered how could that produce an error, when Venka make a check to ditch that level check if on the Shop scene. Yet it returns the original method as soon as the player leaves the shop. o.o

Anyway, I changed that line above to this:

if SceneManager.scene_is?(Scene_Crafting) || SceneManager.scene_is?(Scene_Recipes) return false if recipe.req_level > $craft[@craft_id].level endand this fixed the issue.There might be a more suitable fix for this, as I don't know if it breaks something or not (it shouldn't but one can never know 😀 ), but this was a quick one for sure.

And another little bug found by me:

When crafting through the actor stat addon, the first item crafted with the "Craft this item for #{actor}?" popup works well.

But anything after will not display the popup window. It is still possible to press confirm button twice to start the craft, but no popup window will show up.

Edit:

Found one again!

The error itself is in the Actor Stat Addon, line 179:

if @status_window && @items != [] && @status_window.item != @items[@index].crafted_itemThe error is invoked by the second check, specifically the 'crafted_item' part.It happens on the Recipe scene.

Open the recipe book. Go to a recipe type which got at least 2 recipes unlocked/shown.

Press the confirm button on one of it, go to any recipe other than the first one and press the cancel button. Now press either the right or left button.

Poof, the error kicks in if the recipe type left/right does not have the same amount or more recipes learned than where the cursor was.

If it was on the 3rd recipe, and there are only 1 or 2 recipe(s) learned on the recipe types from the left or right, pressing left or right produces this error.

A simple:

return if !@items[@index]before the mentioned line kinda fixes it, but the cursor will still be on a non-existent item, which is not very decorative.It should jump to the first recipe on the list if the '@items[@index]' returns 'nil', I guess.

And just noticed that there is no "Press this button to view the stats" description line in the Recipe scene.
^Yep, this at least fixes the issue with the regular crafting shop.
got all the issues fixed.. here's the new actor stats add on

https://www.dropbox.com/s/4m7xkhajz842li5/Crafting%20Actor%20Stats.txt

This issue with the same is related to the actor status add on.. I just put what sixth said in there and fixed the other issues.
I must be annoying by now... 😀


Found a typo which could mess up things easily.


Line 827 looks like this:

if $imported["YEA-AceEqui pEngine"]And wow, didn't expect to see the compatibility fix for the randomizer addon so soon. Thanks!
Well, tried the new Actor Stat Addon and it still won't work with the randomized items.


Now it throws an error at line 818:

equip_item(@actor, $craft.results[1][2])Apparently, for some reason it won't recognize the results if the item crafted is a randomized one. Putting that line in a conditional check with 'unless $craft.results == []' will negate the error, but the item is not equipped after the craft, obviously.
Btw, what happened with the 'Individual Recipe Sounds Add-on'?


I am still using it, just wondering where did it disappear from your demo/addon list. 😳
Oh that add on was a personal favor for someone and I didn't mean to release it. The fixes will have to wait because my daughter woke before me and loaded up her video playlist of songs. She actual told me last night that it's her "puter". Being how she's 3.5 years old, it's kind of cute.
try this now

https://www.dropbox.com/s/4m7xkhajz842li5/Crafting%20Actor%20Stats.txt
Hello, first of all, i'm really thankful for this script of yours, Venka, it's an excellent crafting script and i'm currently using it in a small project.

I have no complaints about the main crafting menu and it's functions, but there's a little thing that's been bugging me and perhaps has already been solved.

I've tried to make crafting only available with NPC's and i found that your Shop/Decomp add-on actually does that easier, except that with that add-on there are no actual results, the crafting gives me no items. Both in the Demo and my own project, when you enter the Shop and attempt to craft, the materials are taken from the inventory (with the gold from the fee) but there's no actual response, no items crafted, even the "Results window" does not appear...

So, i made this small topic to let you know about this "bug"? (Or maybe it's something already known that i didn't find), if it's like that i'm sorry.

Otherwise is it possible to make the crafting menu without the levels and the exp? So items can be crafted regardless of the level? Just finding the recipes?

Thanks for everything, Venka, great job! 😀
I'm swearing off add ons =P seems they always introduce a ton of bugs. What's weird is I have some extra add ons in my personal project and it works but something is broken in the released demo. So I'll get that figured out and will see about setting up the script to not show exp messages anywhere if the recipe is set to 0 exp, then if you set all the recipe levels to 1, you should be fine 😉

Also on the shop side I didn't bother with the pop up window because there was no chance of failure if a NPC crafted the item for you (also no chance of exp earned or recipes learned.. etc).

I'll see if I can get these things fixed in the next few hours, if not I should have it done tomorrow.

edit: still working on the exp fix for the main script, but here's the shop add on. Sorry about that bug

https://www.dropbox.com/s/5vic3mihvb4i06h/Crafting%20Shop%20Craft%20%26%20Decompile.txt

Original thread: https://forums.rpgmakerweb.com/threads/crafting-script-v3-8-updated-2-26-2015.17560/