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

Hello Venka 🙂
 

Thanks for this AWESOME script!
I only have one Question. Where can i translate the Words "Ingredients" "Needed" and "Owned"? Because my Game would be german 🙂

Thanks a lot and best wishes!
Oh I thought I had gotten all those words in the customize section for just that reason. Sorry I missed those.

If you open up the script editor and press cntrl+shfit+f it will search through all the scripts and search for just those things "Ingredients:" and "Needed/Owned" (make sure you use the quotes on the search). They should be around line 776 in the  main script. And 381 if your are using the Shop Crafting/Decon Add on
This script is so awesome!!! I'm adding it to my project. 


Keep up the great work! Look at all your support troughtout 10 pages! Very nice.


EDIT.:


I am getting the same error as @Ultimuh.:


The thing is, I didn't change anythign on the script, it is default.


Am I missing something?

undefined method 'icon_index' for nil:NILClass


line 644
EDIT2.:


Nevermind, it was really idiotic of me! I had to have the items to be crafted on the database!


Sorry for the dumb post.
Awesome script, thanks for making this free for everyone! Also I found no problems when transferring the scripts to my game 😀
Thank you so much 🙂 it works great!!! 
Thank you for making this awesome script free! <3

[IMG]http://666kb.com/i/cpqlmesu2galfnw0t.jpg[/IMG]
Thanks for the kind words on the script.

@luiscesjr: sorry i didn't see the edit to your post, but glad you got it worked out 🙂
Edit: Nevermind...
Although it would be intersting if one could use the crafting script with the timer as well as the simplified one... So if you want to spam for potions you can, or you can try to get better stuff.
Uh sorry if this has been asked already, but how exactly do I choose what items are used for what? I got the demo and played around with it, and even looked in the script but I really didn't see any instructions on how to get started. I have very little scripting knowledge so any help would be appreciated.
I'll try to help explain things better. I know the script is kind of big and there's lots of info thrown at you all at once. To set up a craft (cooking, smithing, alchemy, woodsman, etc) then you'd find this area of the customize section:

Spoiler
Craft_Info[1] = { # Cooking :craft_name => "Cook", :exp_table => [ 10, 5, 12, 20], :max_level => 3, :mastered => "Top Chef", :bg_image => "Book", :bg_music => nil, :active_sound => ["Fire", 100, 100], } # <-DO NOT REMOVEIn the demo there's 3 crafts already set up - Cooking, Smithing, Alchemy. You can change any of these to what you'd like in your game, or add new ones. You could have as few as one craft or as many as you'd like to set up.

To set them up, they must each start with the first line you see in the code "Craft_Info[1] = {  # Cooking". In scripts, anything behind the "#" is a comment and doesn't do anything other then let you make notes about stuff. So I like to label all the crafts so I can remember what they  are 🙂 Anyway, like I said in the demo there are 3, so notice the []'s and the number inside the brackets. That number must be unique to each craft. Any duplicated number will overwrite the first one. So if you changed the Alchemy's Craft_Info number to 1 instead of 3, then you'd no longer have a cooking craft in the demo.

So let's say you want to make a Wood Crafter you'd do something like this:

Craft_Info[4] = { # Wood CrafterI'd make the craft ID 4 because it's the next number in the line and I'm not trying to erase any of the already made crafts. The next line would look like:

:craft_name => "Woodsman",I changed the name of the craft to Woodsman. This is the text that will appear in the craft windows when using recipes from this craft.

:exp_table => [ 10, 5, 12, 20],Setting up the exp curve is confusing, but if you look at the Exp Curve option when setting up a class you'll see some numbers there. That's exactly how it works for the craft. So you can play with the numbers in that part of the database til you come up with something you like and then copy those 4 numbers over to the script.

The next line is

:max_level => 30,You can set the max level of the craft from 1 to 99 (or higher if using some script that will extend levels past 99).

:mastered => "Mastered!",When you open the craft windows, the top window has the craft's name and a gauge that shows the progress made into the level. When the max level of a craft is reached, the exp gauge will go away and be replaced with the text in the above line of code. So in this case, it'll simply say Mastered!

:bg_image => "Book",This line of code will look for a image placed in the Graphics/Picture folder and use it as the back drop when looking at recipes set up for the Woodsman. The demo has 3 images placed in the folder (they are originally title images I just moved over). But you can download/create any image you'd like.

:bg_music => ["Dungeon7", 90, 100],This sets the music that will play while the Woodsman's craft windows are open. You can set it to nil and it will continue to play whatever was already playing on the map/menu. However, you can set it to a music file found within the Audio\BGM file. The first entry is the name of the audio file, the first number is volume (this number can be 1 to 100), the last number is the pitch (or speed). 100 is normal, lower is slower and higher is faster. The last number can be any number from 50 to 150. So again, this is much like setting up a bgm via an event or setting the sounds in the database.

:active_sound => ["Bow3", 100, 100],This last entry is the sound file that will play while actively crafting an item. If you have opted to use no timer in one of the other settings, then this setting won't matter. You can also set this setting to nil if you don't want a sound to play continuously while crafting an item. The formatting is the same as the other sound file, but for this one it will look for an audio file in the Audio/BGS first (this is normaly sounds like fire back ground noises, storm noises etc). If it doesn't find a matching file in that folder, then it'll look in the Audio/SE folder (this folder holds sounds like weapon attacks, door closing/option, chest sounds etc). If the audio file is in the SE folder then it'll repeat the sound every 2 seconds, so you could loop a hammer sound.

} # <-DO NOT REMOVEThat is the line that closes out the settings for the craft. Now you can set up your next craft or skip on down to recipes and start setting up recipes.
To read about creating new recipes, look in the spoiler tag below

Spoiler
This is what the first recipe in the demo looks like:

Recipes[1] = { # Loaf of Bread :recipe_type => 1, # Cooking Recipe :auto_learn => true, # Auto-learn this recipe when level is reached :req_level => 1, # Level required to use this recipe :shop_fee => 20, # Fee charged if crafted at a shop :craft_time => 200, # Time it takes to make the item :earned_exp => 3, # Exp gained on success :crafted_item => [:i20, 2], # Makes 2x Loaf of Bread :failed_item => [:i29, 1], # 1x Piece of Charcoal if failed attempt 😛re_failed => [:i19, 1], # Failed item if crafted before timer :ingredients => [ # 2x Eggs, 1x Flour, 1x Fresh Milk, 5 Gold [:i21, 2], [:i22, 1], [:i23, 1], [:g5], ]} # <- DO NOT REMOVEAgain, just like with the craft info from the first spoiler tags, you can keep what's in the demo or scratch them and start with all new ones.

Going with the example from the first spoiler tags where I showed how to make a new craft.. I'll make a new recipe for the new craft. The first line should get changed to something like this:

Recipes[10] = { # SpearI set the recipe's id to 10 just so it doesn't stop on the toes of any of the other already made recipes.

:recipe_type => 4, # Woodsman RecipeWhen I made the Woodsman craft, I set it's ID to 4, so this recipe will be set to 4 on this line so the script will know it's a recipe that should be shown for the Woodsman and not any of the other craft types. It is also how it determines where the exp goes.

:auto_learn => true, # Auto-learn this recipe when level is reachedThis line is optional. Only use it if you want a recipe to be learned automatically when the crafting level is reached. So say you can craft spears as a level 3 woodsman, and auto_learn is set to true, then as soon as you reach level 3 as a woodsman, then this recipe will instantly show up in you recipe list. If you omit this line or set it to false then you can only learn this recipe with a script call used in an event in game.

:req_level => 3, # Level required to use this recipeJust set the required level to start crafting a spear to level 3.

:shop_fee => 25, # Fee charged if crafted at a shopYou only need to worry about this line if you're using the shops add on script. If you don't plan to use that script add on then just leave this line out. If you plan on using the add on, then this is the amount of money the shop keeper will charge the player to craft the recipe for them (plus some extra ingredients, you can set how much more ingredients the shop keeper will charge in the add on script).

:craft_time => 180, # Time it takes to make the itemThis is how long it will take the player to craft the item. If you are not using the timer gauge, then this line won't matter. If you set it to timer, this is how long the gauge will last, if using the active setting, then this is how long they must wait before then can trigger a successful item, if they wait too much longer after this time, then they'll fail. For this time, 60 = 1 second in real time. So 180 would be 3 seconds real time.

:earned_exp => 3, # Exp gained on successThis will set the recipe to reward 3 exp for the Woodsman craft if an item is successfully made. Failures can get less or no exp (depending on how you set it up elsewhere in the script).

:crafted_item => [:w13, 1], # 1x SpearThis is where you set what item you'll receive when you successfully make an item. In this case, we're making a Spear. If you look in the default database on the weapons tab, Spear is number 13. So for this script you can craft items from the Items tab in the database, or the Weapons tab or the Armor tab. So without getting into too much coding... we'll use an "i" for items, "a" for armor, and "w" for weapons. So when we tell the script we want to make a Spear from the weapons tab use ":w13". The last number is how many of the items to craft.. in this case we are only going to create 1 spear at a time.

:failed_item => [:i35, 1], # 1x Wooden Shaft if failed attemptIn the demo, I have already created some new items for the crafting system. The Wooden Shaft is one of the created items not found in the default database. So to tell the script which item to recieve on a failed attempted, I used the letter i to let it know it can be found in the Items tab and used ID 35 because that's the Wooden Shaft's ID in the Item tab. Then the last number is 1 because only one item is needed. You could set it to 2 or 10 or whatever you'd like. You can also omit this item if you don't want any item created on failure. Failed items can only ever be created if  you are using the active style gauge (a setting towards the top of the script). This is the item that would be created if the player never presses the action button while crafting or if they press it after their window of opportunity.

😛re_failed => [:i35, 1], # Failed item if crafted before timerThis is exactly the same as the previous line, but this is the item the player will get if they hit the action key too soon.

:ingredients => [ # 1x Wooden Shaft, 1x Knife [:i35, 1], [:w37, 1],These are the ingredients needed to make the recipe. Each ingredient needed to make the recipe will be inside the square brackets []. So the first required item is a Wooden Shaft (item 35 in the Items tab of the database). The second required item is a Knife from the weapons tab.

]} # <- DO NOT REMOVELike with the craft into, this is the line that tells the script that you are finished setting up the recipe.
Hope this helps, if you still have questions, let me know and I'll try to help
@Venka

Thank you very much. That does actually clear things up a lot. I look forward to giving this amazing script a try.
Hello, i'd like to thank you very much for this free script but i have a question i haven't seen on the forum.

What should i do to have a shop where you can buy recipes with the crafting shop recipes add on AND a shop where you can buy/sell weapons and armors? Because it seem i can't do both with the add on.
You know what, that was an oversight on my part.. I meant to have it do both and I think I forgot to finish it! I've got an update I'll be posting soon with some changes, so I'll get that fixed too 🙂

Thank you for pointing it out for me
GREAT script!!! I am really enjoying it. Thank you for your hard work and dedication to it.
script updated with the ability to craft stacks of items. Also some heavy changes to the shop/decomp add on script. You can now change the way the timer works for shop crafters, they can use no timer and instantly make/decomp an item or use a timer and make the player wait for the item. They can also now craft or decomp stacks of items at a time. The shop now lets you buy and sell items like normal as well (sorry for that oversight).

To anyone using the Tool Add-on, I incorporated it into the main script so the add on won't be needed any more.
script updated with the ability to craft stacks of items. Also some heavy changes to the shop/decomp add on script. You can now change the way the timer works for shop crafters, they can use no timer and instantly make/decomp an item or use a timer and make the player wait for the item. They can also now craft or decomp stacks of items at a time. The shop now lets you buy and sell items like normal as well (sorry for that oversight).

To anyone using the Tool Add-on, I incorporated it into the main script so the add on won't be needed any more.
Great work Venka, but came across a bug in your demo and in my game.

When you open your regular menu (not crafting menu) to go see the recipes, there's an error.

[IMG]http://i.imgur.com/Ilir7EZ.jpg[/IMG]
Ooops! That's for an add on I've been working on but haven't perfected yet.. no clue how that ended up in there.

This will fix it:

https://www.dropbox.com/s/bdz0lexj9buxp7k/Crafting%20Menu%20Access%20Add-on.txt
Ooops! That's for an add on I've been working on but haven't perfected yet.. no clue how that ended up in there.

This will fix it:

https://www.dropbox.com/s/bdz0lexj9buxp7k/Crafting%20Menu%20Access%20Add-on.txt
Hehe it happens 😛 thanks for the quick fix
@Venka No problem man, it was totally my fault to have forgotten 

to put the itens on the list! Surely the script couldn't work lol.

Anyway, I'm also grateful I didn't really start to put recipies 

on it, I added only one! With the update I would have a little more work to do

in order to import the recipes hehe.

Or do you usually only update the main script?

Thanks a bunch anyway!!! Will update it later.
the goal is to try to not update the main script.. but it seems like something always needs touching. But if you have your recipes already made. Just select all the text for your older script for the recipes and copy them over to the new one. Nothing in those settings changed (and they usually don't). The customize section changes only a little bit to allow for more text control settings.. like being able to set the test that appears in the recipe window. So you can set the word for exp, level, items owned... etc. I also added a couple of settings so you can adjust the windows opacity and the crafting of stacks. I separated the customize section from the main script so that folks didn't have to keep updating that part.. but for some reason I just can't stop adding stuff to it. I keep thinking the script is done and there isn't possibly anything else to add to it, and then someone will come up with a neat or very practical idea and so I fix the script 😉
I know exactly what you mean =)

Anyways, I thought of doing that, I know, but it's work, and I'm LAZY.

Nothing that can't be fixed.

Do you plan doing any more amazing script? 

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