casper667 131 Posted May 9, 2013 (edited) CSCA Crafting By: Casper Gaming (Casper667) Last Update: May 17, 2013 Latest version: 1.0.4 Introduction Allows you to easily set up crafting recipes, while remaining a powerful crafting script. Can show only recipe's of a certain type in the crafting scene. Can note tag armors/weapons to increase crafting stats. Intended for use with CSCA Professions but not required. Lots of customization. Supports CSCA Currency System currencies in crafting recipes. Screenshots Discovering new recipes. Toast messages shown only if using the CSCA Toast Manager. The crafting menu! It can differentiate between, say, cooking and alchemy recipes. If using the CSCA Toast Manager, crafting result window will be displayed! Works well with CSCA Professions. How to Use Place in your materials section. Setup required. Instructions in script. Updates version 1.0.1 - Bug fix: Ingredients should now display properly. version 1.0.2 - Bug Fix: Required Items/Products can now be weapons, armors, and gold too. version 1.0.3 - Bug Fix: Errors dealing with required items should now be fixed. (finally)(hopefully) - CSCA Currency System colors now show in the crafting info window. version 1.0.4 - Bug Fix: Errors dealing with gold and CSCA Currency System should be fixed now. Script Text file is found here(copy and paste everything into your script editor in the materials section): LINK Requires CSCA Core Script to work properly - Get it here! Optional: For the discovery/craft result windows, you'll need CSCA Toast Manager - Get it here! Optional: For a full profession system that works well with the crafting system, use CSCA Professions! - Get it here! Credit Casper Gaming Terms http://caspergaming.com/terms-of-use/ Edited July 1, 2020 by casper667 Update link URLs 4 Share this post Link to post Share on other sites
harvard1932 1 Posted May 9, 2013 This script reminds me the crafting system in Aion. :DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD WANTTTTTTTTTTTTTTTTTTTTTTTTTTTT Share this post Link to post Share on other sites
demonking39 1 Posted May 10, 2013 Hey Casper, awesome script. I only have one issue with it. When you use a weapon or armour as an ingredient it is displayed under the crafting menu as the ITEM with that ID. So if the ingredient is a dagger, for example, it would be weapon[2] and would go into your script like [:weapon, 2, 1]. However, the menu would show it as item[2], in my case that's Hi-Potion. It's using the dagger as the ingredient, so that parts right, but it's displaying it as a Hi-Potion for some reason. I think the issue is in the way the script draws the ingredients here: #-------------------------------------------------------------------------- # Draw ingredients #-------------------------------------------------------------------------- def draw_ingredients(y) s1 = "Ingredients: " x = 0 ny = 0 change_color(system_color) draw_text(x, y, contents.width-x, line_height, s1) change_color(normal_color) x += text_size(s1).width @recipe.ingredients.each do |ingredient| @y_add += line_height item = $data_items[ingredient.id] # I think that this line is telling the crafting menu to get all its ingredient information ONLY from the items list draw_icon(item.icon_index, x, y + ny) x += 24 draw_text(x, y + ny, contents.width-x, line_height, sprintf("%sx %s", ingredient.amount, item.name)) ny += line_height x -= 24 end end I don't have much scripting knowledge, and I'm not even sure if I'm right about this issue, but I would really appreciate any help you can offer to resolve this issue. Share this post Link to post Share on other sites
casper667 131 Posted May 10, 2013 (edited) Argh, I'm an idiot. I'll fix it when I'm done making/eating my pizza. Script updated! version 1.0.1 - Bug fix: Ingredients should now display properly. Edited May 10, 2013 by casper667 Share this post Link to post Share on other sites
demonking39 1 Posted May 11, 2013 Haha thanks Casper! And you're definitely no idiot my friend, even geniuses are allowed to make small oversights from time to time! Share this post Link to post Share on other sites
poundcakery 0 Posted May 12, 2013 this script is just what i'm looking for, thank you for making it! I have one question, i'm having trouble figuring out the discovery script call( i put the script call in quotes below). could someone provide an example of how this script call should be used? thanks! discover_recipe(recipe[, discovered]) Share this post Link to post Share on other sites
casper667 131 Posted May 13, 2013 this script is just what i'm looking for, thank you for making it! I have one question, i'm having trouble figuring out the discovery script call( i put the script call in quotes below). could someone provide an example of how this script call should be used? thanks! discover_recipe(recipe[, discovered]) It would look something like this: discover_recipe(:applepie) The []'s just mean that the parameter discovered is optional. If you want to set a recipe to undiscovered, you'd do discover_recipe(:applepie, false) Share this post Link to post Share on other sites
poundcakery 0 Posted May 13, 2013 oh okay, thank you so much for clarifying! Share this post Link to post Share on other sites
Jennestia 9 Posted May 14, 2013 (edited) Awesome script~ I appear to have an issue ---------------------------Echoes of Eternity ~ Distant Echoes---------------------------Script 'Craft' line 511: NameError occurred.undefined method `refresh' for class `CSCA_Window_Toast'---------------------------OK --------------------------- that points to 511: alias :csca_craft_refresh :refresh It appears to happen right as I load the game - granted it has been a year or two since I've been able to do anything RPG related so I made sure everything is as up to date as possible but I may simply be missing something obvious haha. Edit: Removed script list, it appears to have been one of my custom scripts I wrote recently that regards summoning ^^. Got the issue resolved! Edited May 14, 2013 by Jennestia Share this post Link to post Share on other sites
Amber 1 Posted May 14, 2013 I got some few erros: Adding Gold for Product/Required or any of those ends up with draw_icon Already have Required Item, ends up with another nomethod error I got some few erros: Adding Gold for Product/Required or any of those ends up with draw_icon Already have Required Item, ends up with another nomethod error Share this post Link to post Share on other sites
casper667 131 Posted May 15, 2013 I got some few erros: Adding Gold for Product/Required or any of those ends up with draw_icon Already have Required Item, ends up with another nomethod error I updated the script. Hopefully your problems are fixed in the updated version. version 1.0.2 - Bug Fix: Required Items/Products can now be weapons, armors, and gold too. Share this post Link to post Share on other sites
Amber 1 Posted May 16, 2013 The version 1.0.2 doesn't solved my problem, I getting slammed on error due to A recipe without required item (nil) doesn't work and end up with NoMethodError ( if @recipe.required.type == :gold) Have an recipe with Gold requirement still get you this error (below if @recipe.required.type == gold) Ok! Does it solve when you have the item you need to craft, I think NOT (items.each do |item|) and I'm not talking about Gold, Weapons and Armor here and yes, I do try to add Armor/Weapon as required item. I still end up with error explained above This update is terrible, it won't let anyone craft an item/armor/weapon and even GOLD. I think you need to test this yourself to see it work Share this post Link to post Share on other sites
demonking39 1 Posted May 16, 2013 (edited) The version 1.0.2 doesn't solved my problem, I getting slammed on error due to A recipe without required item (nil) doesn't work and end up with NoMethodError ( if @recipe.required.type == :gold) Have an recipe with Gold requirement still get you this error (below if @recipe.required.type == gold) Ok! Does it solve when you have the item you need to craft, I think NOT (items.each do |item|) and I'm not talking about Gold, Weapons and Armor here and yes, I do try to add Armor/Weapon as required item. I still end up with error explained above This update is terrible, it won't let anyone craft an item/armor/weapon and even GOLD. I think you need to test this yourself to see it work Have you been changing the coding in the actual script or have you been setting up your recipes properly in the recipe section of the script? I tried to recreate your issue in my game and the only way it would give me those errors is when I went to the lines that caused you errors and changed their values. As for the issue involving gold as a required item, you need the CSCA currency system script in order for that to work. It references the script and checks to see if it's imported right before the line that gives you trouble. The only error that I found is that the item data under the "draw required item" section is double referenced. #-------------------------------------------------------------------------- # Draw required item #-------------------------------------------------------------------------- def draw_required_item(y) s1 = "Required Item: " x = 0 item = case @recipe.required.type when :item; $data_items[@recipe.required.id] when :weapon; $data_weapons[@recipe.required.id] when :armor; $data_armors[@recipe.required.id] when :gold; $imported["CSCA-CurrencySystem"] ? $game_party.get_csca_cs_currency(@recipe.required.id)[:currency_unit] : Vocab::currency_unit end item = $data_items[@recipe.required.id] #This line is double referencing the item line above that I hi-lighted as blue change_color(system_color) draw_text(x, y, contents.width-x, line_height, s1) change_color(normal_color) x += text_size(s1).width unless @recipe.required.type == :gold draw_icon(item.icon_index, x, y) x += 24 end if @recipe.required.type == :gold draw_text(x, y + ny, contents.width-x, line_height, sprintf("%s%s", @recipe.product.amount, item)) else draw_text(x, y, contents.width-x, line_height, sprintf("%sx %s", @recipe.product.amount, item.name)) end end When I removed this line I stopped getting the error, so try it and let me know how it works for you. Edit: That's actually your issue. That one line is double referencing the values for each defining line. So even if you put ":weapon" in the required item field, this line is trying to contradict it and that's what causes the error. Edited May 16, 2013 by demonking39 Share this post Link to post Share on other sites
Amber 1 Posted May 16, 2013 I remove the troublesome line, but end up with this error and this line cause the error draw_product(oy) Share this post Link to post Share on other sites
demonking39 1 Posted May 16, 2013 Yeah I just got that error too, I'm trying to rewrite that little part to see what I can do. If I don't get it I'm sure Casper will, just hang tight and be patient, help is on the way lol Share this post Link to post Share on other sites
Amber 1 Posted May 16, 2013 I'll give Casper a demo so he can check whenever he's online Share this post Link to post Share on other sites
demonking39 1 Posted May 16, 2013 (edited) Ok, I have resolved most of the issues, but I'm getting one that I don't know what to do with. #-------------------------------------------------------------------------- # Party has required items? #-------------------------------------------------------------------------- def has_items(items) items.each do |item| # I'm getting an undefined method error for "each" I tried to change that line to @recipe.items.each, but then I got the same error except this time it's for the term "items". case item.type when :gold; next if $game_party.gold >= item.amount when :armor; next if $game_party.item_number($data_armors[item.id]) >= item.amount when :weapon; next if $game_party.item_number($data_weapons[item.id]) >= item.amount when :item; next if $game_party.item_number($data_items[item.id]) >= item.amount end return false end return true end I have decided to go with the older version of the script and exclude the "required" field for the time being. The older version of the script works fine as long as you put "nil" in the required item field. Sorry I couldn't be of more help, but this has exceeded what minimal scripting knowledge I have, and so I think it's best left in the hands of it's creator. Edited May 16, 2013 by demonking39 Share this post Link to post Share on other sites
Amber 1 Posted May 16, 2013 I think casper knows about this. Share this post Link to post Share on other sites
casper667 131 Posted May 16, 2013 (edited) OK guys, I updated the script again. I have a few days off of my real life job now so I had a bit more time to test this update. I also added in that now the currency color will show in the crafting information window if using my currency system. version 1.0.3- Bug Fix: Errors dealing with required items should now be fixed. (finally)(hopefully)- CSCA Currency System colors now show in the crafting info window. Edited May 16, 2013 by casper667 Share this post Link to post Share on other sites
demonking39 1 Posted May 16, 2013 Hey just tested the script and it's working perfectly! Thanks for the awesome work Casper. Just one thing I thought I would ask. Is it possible to use formulas to determine the success rate of a recipe? So you could have something like :success_rate => 20 + v[1] + v[2] (where v[1] could be the profession level and v[2] could be the number of times crafted) So the higher the profession level and the more you make that item, the better you will get at making said item. Share this post Link to post Share on other sites
casper667 131 Posted May 16, 2013 (edited) I thought about including formulas but I thought it would be too difficult for most users and it's a lot of extra coding to do to make it flexible. If you feel comfortable editing the script this is the method that determines the success rate: def calculate_recipe_success_rate(recipe) base = recipe.success_rate $game_party.battle_members.each do |member| member.equips.each do |equip| next if equip.nil? base += equip.csca_craft_successmod end end base = 1 if base > 1 base = 0 if base < 0 return base end Edited May 16, 2013 by casper667 Share this post Link to post Share on other sites
demonking39 1 Posted May 16, 2013 Ok thanks Casper, I will play around with it and see what I can come up with. Share this post Link to post Share on other sites
Amber 1 Posted May 16, 2013 (edited) I got an error When I try to add Gold as a ingredients (expection of product or scrap) I got this error also this error appears when you have toast setting set to true Edited May 16, 2013 by Amber Share this post Link to post Share on other sites
Konora 3 Posted May 17, 2013 Yay, you made a crafting script! And it looks really good! Imma go try it out right now >:3 Share this post Link to post Share on other sites
demonking39 1 Posted May 17, 2013 I got an error When I try to add Gold as a ingredients (expection of product or scrap) I got this error also this error appears when you have toast setting set to true Add the lines that I have highlighted in red and you wont have this issue. #-------------------------------------------------------------------------- # Draw ingredients #-------------------------------------------------------------------------- def draw_ingredients(y) s1 = "Ingredients: " x = 0 ny = 0 change_color(system_color) draw_text(x, y, contents.width-x, line_height, s1) change_color(normal_color) x += text_size(s1).width @recipe.ingredients.each do |ingredient| @y_add += line_height item = case ingredient.type when :item; $data_items[ingredient.id] when :weapon; $data_weapons[ingredient.id] when :armor; $data_armors[ingredient.id] when :gold; $imported["CSCA-CurrencySystem"] ? $game_party.get_csca_cs_currency(ingredient.id)[:currency_unit] : Vocab::currency_unit end unless ingredient.type == :gold draw_icon(item.icon_index, x, y + ny) x += 24 end if ingredient.type == :gold change_color($game_party.get_csca_cs_currency(ingredient.id)[:color]) if $imported["CSCA-CurrencySystem"] draw_text(x, y + ny, contents.width-x, line_height, sprintf("%d%s", ingredient.amount, item)) change_color(normal_color) else draw_text(x, y + ny, contents.width-x, line_height, sprintf("%dx %s", ingredient.amount, item.name)) end ny += line_height x -= 24 end end This tells the script to exempt currency from drawing icons and uses it's assigned term from the database. Share this post Link to post Share on other sites