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

hehe no worries.. I should have you test all my scripts lol 😉
hehe no worries.. I should have you test all my scripts lol 😉
😉 always happy to help
One suggestion for the weapon/armor crafting part, could there be something like a


weapon improvement?


Like Craft Sword?


Yes >> Done.


Then if someone wanted another option, Improve Sword?


Better Sword;


Polished Sword;


Almighty Sword;


Legendary Sword;


Perfect Sword;


Each with it's status better than the later. Would this be possible?


Or this already exists in the script and I am babling about it needlessly lol?


Or, if not as an option, depending on the character's level, he could


do better and improved itens!


Cheers girl.
There are different scripts made to do exactly that, like TheoAllen's Smithing script. It is like a weapon upgrade system.
If you ever played Suikoden, you know already what this script does. 😛
You should look up that one, it is really awesome! 
 
There is no need to put everything in one huge script, better to make/use smaller and separate ones with different functions, at least in my opinion.
 
And while I am here (again 😀 ), here are some instructions on how to make this crafting script work with Vlue's Equip Randomizer script...

Ohh, well, no direct instructions here anymore...

Instead of those outdated edits, visit this post to get the latest Randomizer Addon for Venka's Crafting Script:

http://forums.rpgmakerweb.com/index.php?/topic/17560-crafting-script-v31-updated-80214/?p=298963

 
And I also got a suggestion, which may be or may not be too complicated to implement, I don't really know.
Multiple button type inputs, within random time intervals while the time bar goes on.
Example:
Now we can use any button to press for success while the time bar is active.
I would set up a recipe that would need button presses :X, :Y, :UP, :Z to be pressed in random times in random order to get the success rewards. 
This is to keep crafting items fresh, and different each time we do it, also to make it harder for more powerful equipment, for example.
The current method is solid enough, but if someone crafts hundreds or even thousands of stuffs, it could get monotone a little.
 
I realize this suggestion would not be easy to implement (at least I think), but it would be awesome to see it happen! *-*
I see, but Venka's script is already also a smithing script, so why not? =)

I never really played suikuden, but as for what I've seen quickly now of Theo's script,

you upgrade your weapons at will? There is no cost or anything?
There is a gold cost for upgrading. 

You can set it in the "Price Settings" with the "PriceUpgrade" formula.

The default formula makes the upgrade cost dependent on the weapon's shop price, on the weapon's current level (I guess, not sure about this one) and on the "BasePrice" that can be set up in that same section.

You can also make it cost some items with simple eventing with a few conditional branches.

I am not using the script itself on my project now, but can test anything with it in a matter of few minutes, if needed.

If you need further assistance with this script, feel free to PM me. 

I don't want to spam this topic with not-relevant script information. 😛
Oh, of course, let's keep the topic on course. But thanks anyway! I will

test tonight and sure, if I need any help I will be happy to contact you.

Thanks man! ( I was thinking really about itens to upgrade, so

as it's possible, great!)
sorry was sleeping 🙂 but looks like sixth has you taken care of. I'd definately go with his suggestion 😉 He's working up a tutorial on it that I'll add to the main topic because it's a neat system. I'll have to go look up vlue's randomizer script now of course hehe 😉

I'll look into the button pressing thing. I thought about that when I first started playing with this script but couldn't think how to do it.. now I've learned a LOT since then and think it might be doable. I'll add it to the list. I'm still trying to perfect an add on I've been working on for a while.. it's taking longer then I expected because I can't decide on a final design.. but it's an add on that will show stats for all party members for a piece of equipment before you craft it (so you can see if you really want to make it). And it has TONS of customize settings so can really make it your own.
sincerelly Venka I always love your script but...I can't resit hug...to transform your script into a Eyes candy style !

*curse of the sprite programmer xD*
Actually I got sidetracked on my way with that tutorial, lol.

I couldn't bear to see that static size for the result window popup, so I'm making a dynamic one, which will re-size itself according to what is displayed in the window. So, no more huge empty spaces on that popup! 

I am almost finished with it. Gonna post it here when I am done. 

Looking forward to that add-on in progress. *-*

If you need some reference on doing it, Blackmorning made a little shop add-on (called Basic Shop), which displays all the active party members in the shop scene with all the basic stats shown. It also shows stat changes on selected items. 

It seems like you want to do something similar, so looking at that script could help you. Just a suggestion. 
well, the mechanics are all done.. just trying to figure the best way to sort the data on the screen.. and it was an add on designed for a request I got via pm, so letting the person decide which way they like best.. but here's some preview shots.

with that last shot being the most recent.. so as you can see you can set a lot of stuff up.. faces/sprites.. horizontal/veritcal viewing (and you can scroll through the party and see reserve members as well). I set it so you can track params, xparams (hit, crit, eva, etc) and states/elements. Hopefully will get it released soon
Ohh, my! O_O
That looks awesome!
I can't wait to customize it! 😀
 
The snippet below is outdated!

Visit this post to find the latest version of the Randomization addon:

http://forums.rpgmakerweb.com/index.php?/topic/17560-crafting-script-v31-updated-80214/?p=298963

Spoiler
Code:
################################################################################# Dynamic Results Popup Window by Sixth (v.2.0)################################################################################# Instructions:# Copy and paste this into it's own place in the script editor after all of the# Crafting scripts to make it work.# Read the extra instructions below to avoid asking repetitive questions!# -----------------------------------------------------------------------------# Fixed everything I wanted, added a new way of displaying Exp earned.# Now everything scales dynamically, everything that should center itself is# centered.# Also cleaned up the code a bit, removed my useless blabbering too. # -----------------------------------------------------------------------------# Extra Info and Usage Info:## If some arrows are not centered for you, edit the Arrow's offset settings to # fix it. I made that, because different font types behave differently # (different sizes, different properties, etc.), so in order to make it # possible to center them regardless of the font type someone uses, this was # necessary. ## I made the arrow font settings to make sure that if someone wants # to display the arrow without actually changing the other font settings, he/she # could do it. The "Monotype Corsiva" font type can display the arrows, so you # don't even have to search for a suitable font type.# Or maybe you do need to search for it. The last OS which came with the # "Monotype Corsiva" font type was winXP. Later versions of Windows will not# have that font type by default anymore.# "Monotype Corsiva" is not free for commercial uses also! Keep that in mind!# Searching for a suitable font type to display the arrows properly is # entirely your responsibility! Please, do not ask me to find a font type for# it for you! Thanks!## Additionally, you could change the arrow symbols to something that your font# type can display without issues. You can search for them in the snippet,# just search for this: "→". Change the symbol in the quotation marks to # change your displayed symbol. # -----------------------------------------------------------------------------# I think this will be it for now. I am not planning to change anything anymore,# but if someone wants help to change some things, my PM box is open for anyone.# -----------------------------------------------------------------------------# Extra Credits and Thanks:# Venka - For making the awesome Crafting Script - obviously! #         For giving me tips to make this snippet standalone.#         For giving me info about the "Monotype Corsiva" font type#         For always being helpful! # Vlue - For making his Equip Randomizer script, which eventually lead me#        to making this add-on.#        For making other scripts from which I learned a lot about scaling #        windows depending on the contents in them.# Bloodmorphed - For making me add the colored items function to the popup window.#                Without him asking, I wouldn't even bothered with it! # ############################################################################### ################################################################################# The "Big" Setup part################################################################################module Venka  module Crafting    Arrow_x_Item = -16       # The horizontal offset for the arrow displayed                           # after the 'Result_Msg' text  Arrow_x_Exp  =   5       # The horizontal offset for the arrow displayed                           # after the 'Exp_Earned' text  Arrow_x_Rec  =   0       # The horizontal offset for the arrow displayed                            # after the 'Learn_Text' text                            # This will be the font type used to display the arrows  Fonts[:arrows] = [["Monotype Corsiva", "Verdana", "Calibri"], 24, true, 13]      endend################################################################################# End of the "Big" Setup part - editing below may lead to flying dragons!################################################################################ #==============================================================================# ■ Crafting_Results_Window#==============================================================================class Crafting_Results_Window < Window_Base  #----------------------------------------------------------------------------  # ● upgraded method: initialize  #----------------------------------------------------------------------------  def initialize    super(0, 0, Graphics.width * 0.8, fitting_height(4))    self.opacity = Venka::Crafting::Result_Opacity    self.back_opacity = Venka::Crafting::Result_BGOpacity    self.openness = 0  end    def line_height    return 24  end      #----------------------------------------------------------------------------  # ● upgraded method: refresh  #----------------------------------------------------------------------------  def refresh    contents.clear    return if $craft.results == []    result_info    resize_window    draw_header    draw_items_received    draw_exp_received    if @exp > 0    draw_level_up        if @leveled    draw_new_recipes     if @learned    wait_to_close    $craft.clear_results  end  #----------------------------------------------------------------------------  # ○ new method: result_info  #----------------------------------------------------------------------------  def result_info    @craft_id = $craft.results[0]    @results  = $craft.results[1]    @learned  = $craft[@craft_id].learned_recipes    @exp, @message, @item, @amount, @leveled = *@results  end  #----------------------------------------------------------------------------  # ○ new method: resize_window  #----------------------------------------------------------------------------  def resize_window    self.x = (Graphics.width - win_width) * 0.5    self.y = (Graphics.height - win_height) * 0.5    self.width  = win_width    self.height = win_height    create_contents    open  end  #----------------------------------------------------------------------------  # ○ new method: win_width  #----------------------------------------------------------------------------  def win_width    set_font(:other_text)    if @message == Venka::Crafting::Result_Msg      text  = @message + "x #{@amount}" + @item.name      width1 = text_size(text).width + 80 + standard_padding * 2    else      width1 = text_size(@message).width + 40 + standard_padding * 2    end    width2 = text_size(Venka::Crafting::Learn_Text).width + standard_padding * 2    if @learned      width = 0      @learned.each do |recipe_id|        recipe = $recipe[recipe_id]        size   = text_size(recipe.display_name).width        width  = size if size > width      end      width2 += width + 50    end    return [width1, width2].max  end  #----------------------------------------------------------------------------  # ○ new method: win_height  #----------------------------------------------------------------------------  def win_height    h1 = Venka::Crafting::Fonts[:recipe_name][1] + standard_padding * 2    h2 = Venka::Crafting::Fonts[:other_text][1]    height = h1 + h2 * 2 + (h2 * (@learned ? @learned.size : 0))    height += Venka::Crafting::Fonts[:button_text][1] if @leveled    return height  end  #----------------------------------------------------------------------------  # ○ new method: draw_header  #----------------------------------------------------------------------------  def draw_header    set_font(:recipe_name)    height = contents.font.size    draw_text(0, 0, contents.width, height, Venka::Crafting::Results_Text, 1)    @y = height    color = normal_color    contents.fill_rect(0, height - 2, contents_width, 1, color)    color.alpha = 90    contents.fill_rect(0, height - 1, contents_width, 1, color)  end  #----------------------------------------------------------------------------  # ○ new method: draw_items_received  #----------------------------------------------------------------------------  def draw_items_received    set_font(:other_text)    x = 0;       height = contents.font.size    case @message    when Venka::Crafting::Result_Msg      draw_text(x, @y, contents.width, line_height + 2, @message)      x += text_size(@message).width + 5      if $imported[:MAIcon_Hue]        draw_icon_with_hue(@item.icon_index, @item.icon_hue, contents.width - text_size(@item.name).width - 30 - text_size("x #{@amount}").width - 6, @y)      else        draw_icon(@item.icon_index, contents.width - text_size(@item.name).width - 30 - text_size("x #{@amount}").width - 6, @y)      end      x += 25       change_color(@item.color) if $imported["Equip-Randomizer"]      draw_text(x, @y, contents.width - x - text_size("x #{@amount}").width - 6, height + 2, @item.name, 2)      set_font(:other_text)      x += text_size(@item.name).width + 5      draw_text(x, @y, contents.width - x, height + 2, "x #{@amount}", 2)            set_font(:arrows)      draw_text(text_size(@message).width + Venka::Crafting::Arrow_x_Item, @y, 56, line_height, "→", 1)      set_font(:other_text)              when Venka::Crafting::Failed_Msg      draw_text(0, @y, contents.width, line_height + 2, @message, 1)    end    @y += height  end  #----------------------------------------------------------------------------  # ○ new method: draw_exp_received  #----------------------------------------------------------------------------  def draw_exp_received    height = contents.font.size        case @message    when Venka::Crafting::Result_Msg        draw_text(0, @y, contents.width, height + 2, Venka::Crafting::Exp_Earned)    x = text_size(Venka::Crafting::Exp_Earned).width + 5    text = $craft[@craft_id].max_level? ? Venka::Crafting::Max_Exp : @exp.to_s    draw_text(x + 42, @y, contents.width - x, height + 2, text + " Exp")        set_font(:arrows)    draw_text(text_size(Venka::Crafting::Exp_Earned).width + Venka::Crafting::Arrow_x_Exp, @y, text_size("→").width, line_height, "→", 1)    set_font(:other_text)        when Venka::Crafting::Failed_Msg          draw_text(0 - text_size("→").width / 2 - 6, @y, contents.width / 2, height + 2, Venka::Crafting::Exp_Earned, 2)    x = text_size(Venka::Crafting::Exp_Earned).width + 5    text = $craft[@craft_id].max_level? ? Venka::Crafting::Max_Exp : @exp.to_s    draw_text(contents.width / 2 + text_size("→").width / 2 + 8, @y, contents.width / 2, height + 2, text + " Exp", 0)        set_font(:arrows)    draw_text(contents.width / 2 - text_size("→").width / 2 + Venka::Crafting::Arrow_x_Rec, @y, text_size("→").width, line_height, "→", 1)    set_font(:other_text)        end        @y += height  end  #----------------------------------------------------------------------------  # ○ new method: draw_level_up  #----------------------------------------------------------------------------  def draw_level_up    set_font(:button_text)    height = contents.font.size    draw_text(0, @y, contents.width, height, Venka::Crafting::Lv_Gain, 1)    @y += height  end  #----------------------------------------------------------------------------  # ○ new method: draw_new_recipes  #----------------------------------------------------------------------------  def draw_new_recipes    set_font(:other_text)    height = contents.font.size    prefix = Venka::Crafting::Learn_Text    @learned.each do |recipe_id|      recipe = $recipe[recipe_id]      x = 0      draw_text(x, @y, contents.width, height + 2, prefix)      x += text_size(prefix).width + 5      if $imported[:MAIcon_Hue]        draw_icon_with_hue(recipe.crafted_item.icon_index, @item.icon_hue, contents.width - text_size(recipe.display_name).width - 32, @y)      else        draw_icon(recipe.crafted_item.icon_index, contents.width - text_size(recipe.display_name).width - 32, @y)      end      x += 25      draw_text(x, @y, contents.width - x, height + 2, recipe.display_name, 2)            set_font(:arrows)      draw_text(contents.width / 2 - text_size("→").width / 2, @y, text_size("→").width, line_height, "→", 1)      set_font(:other_text)       @y += height    end  end  #----------------------------------------------------------------------------  # ○ new method: wait_to_close  #----------------------------------------------------------------------------  def wait_to_close    loop do      Graphics.update      Input.update      update      break if Input.trigger?(Input::C)    end    self.close  endend
 
This snippet should not break anything, but if it does, report back, and I will fix it or die trying! 😛
 
Please read the instructions in the snippet and ask questions only after that! Thanks!
it'd neat 😉 I'll take a closer look at the code a bit later today, but if you look in the help file under Windows you can read about this method

move(x, y, width, height)It's kind of neat for resizing windows. You'll need to hide the window's arrows though if the window gets smaller since it scales the window, but not the contents. It's a neat little method I've played around with a few times.
I made everything dynamic, the window's size, the window's placement (it is always centered on the screen), the text sizes, the text placements, the icon placements, and... did I forget something? 😀

So the window can not get smaller than the contents in it, and the contents can not get bigger than the window.

The window will always scale according to the contents. Just be careful with displaying hell of a long item names, it might get out of screen, lol.

If using the randomizer, this can be extra helpful, because the affixes get displayed too, and those really vary in sizes, so a static window did not suffice anymore (at least for me). 

I was kinda afraid to start, but looking at some reference scripts actually made it quite easy (thanks a lot Vlue!).
Okay, bug report time!

Bug No.1:

The bug is in the Shop Craft/Decompile Add on.

I will try to explain the weird thing that happens as clear as I can...

It happens even in your demo, only with your scripts inside, so it should not be a compatibility issue.

So, open your craft shop. Do NOT enter into the "Craft" menu!

Instead of that, go and enter in the regular "Sell" or "Buy" menu. 

Now try to press the "Confirm" button on any NOT enabled item. You can see the weirdness happening now.

It opens your crafting shop menu on top of the regular shop menu, will show 2 cursors, they are both movable. 

This anomaly will disappear if you navigate to your craft shop button on the regular shop menu. After you enter your craft shop scene and exit it, the issue will disappear as long as you aren't leaving the shop. If you stay in the shop, and try to press the "Confirm" button on a disabled item again, the issue won't happen again. 

But as soon as you leave the shop scene and enter it again and do the same things from above, it happens again.

So, it happens only after the first "Confirm" press on a disabled item.

It will never happen on an enabled item.

At first I thought it is another compatibility issue, because I am using quite a lot of scripts that modify the shop scene (and thanks to that, I need to edit your addon left and right, everywhere, lol), but after I saw this happen even in your demo, I am pretty sure it comes from your addon. 

Btw, why did you move your craft shop scene into the default shop scene? It was so much easier with it's own scene! 🙁

Bug No.2:

This one is a minor bug, but still kinda annoying.

Things to do to reproduce it:

Set the sorting to alphabet in the recipe settings.

Make some auto learned recipes for lvl2+. The made recipes should start with a letter that comes early in the alphabet (A/B/C/etc). We will call these A/B/C recipes from now on.

To make sure that the auto-learned recipes will go above our current selected recipe, use a recipe which have a success reward item whose name starts with X/Y/Z. We will use that recipe to achieve a level up in the crafting type. From now on, let's name that X/Y/Z recipe.

So, made a few items, leveled up. What happens? 

We learn the new A/B/C recipes made before, the new recipes appear on the list.

But suddenly, from the X/Y/Z item, which actually triggered the level up, we find our cursor on an A/B/C recipe which we just learned automatically.

As I said, this is not a big issue, but still annoying a bit.

Off to test some more...
for the first bug.. I had found that while testing and thought I had fixed it cause I couldn't get it to happen again.. Thanks for tracking down the exact process to trigger it. I'll see if I can get it fixed.

I combined the normal shop and crafting shop per a request, and I had intended for them to be together in the first place and just kind of forgot somewhere along the way of scripting it. I can make it a separate shop for you again, it's not hard at all 😉

As for the last issue, it's not really a bug. The list gets refreshed each time you craft an item (to see if a recipe needs to be disabled for lack of ingredients or if you learned something new). So when it does this, it sorts itself again. I could try putting in a check to see if it's the first time the window is set up to run the sort then and ignore the sort all other times so the new items should appear at the bottom of the list.. the other option I can think of would be more convoluted.. checking existing recipes vs new ones and storing the index and then trying to match it to the new one in the list depending on the sort time.
I can make it a separate shop for you again, it's not hard at all 😉
That would be awesome! *-*

But wouldn't that conflict with the main script and the other addons?

If it would, than don't waste your time with maintaining 2 different versions only for me.

If you can fix this bug, it won't matter much for me anyway, as I already modified this addon quite a lot for some visual changes/fixes for my project.

As for the last issue, it's not really a bug. The list gets refreshed each time you craft an item (to see if a recipe needs to be disabled for lack of ingredients or if you learned something new). So when it does this, it sorts itself again. I could try putting in a check to see if it's the first time the window is set up to run the sort then and ignore the sort all other times so the new items should appear at the bottom of the list.. the other option I can think of would be more convoluted.. checking existing recipes vs new ones and storing the index and then trying to match it to the new one in the list depending on the sort time.
The first option sounds more than enough.

Thanks for the help and quick reply!

Found another bug, I guess.

The help window, while in the craft shop and in the crafting menu does not show anything at all.

It shows the item info in the decompile menu, so I guess it should show something in the crafting menu too, or not?
I found a bug in the Demo Game that only occurs after you talk to all the sparkely Item obtains and the blacksmith guy, then you talk to the guy who has crafting services and select crafting services and then I get an error message, this forum is giving me a hard time to post it
@sixth: separate crafting shop (fixed bug that Dungeonmind found) - https://www.dropbox.com/s/bwvg1arn2kdy5js/no%20shop%20crafters.txt

The normal crafting shop fixes: https://www.dropbox.com/s/5vic3mihvb4i06h/Crafting%20Shop%20Craft%20%26%20Decompile.txt

both have the sorting turned off after the window first starts.. will update the demo project shortly.

Will update the demo when I have more of the minor requests finished. Till then, here's the change to the List window in the main script to make it work turning the sort list off.

Spoiler
change the Recipe_List_Window's ini method to include the @sort_list = true

#---------------------------------------------------------------------------- # ● upgraded method: initialize #---------------------------------------------------------------------------- def initialize(x, y) super(x, y) self.opacity = Venka::Crafting::Window_Opacity self.back_opacity = Venka::Crafting::Window_BGOpacity @craft_type = nil @recipes = $craft.known_recipes @sort_list = true endand then change the make_command_list method to look like so:

Code:
  #----------------------------------------------------------------------------  # ● upgraded method: make_command_list  #----------------------------------------------------------------------------  def make_command_list    if @recipes      @items = []      # Prep to sort the list by required crafting level      @recipes.each do |recipe_id|        next unless $recipe[recipe_id].recipe_type == @craft_type        item = $recipe[recipe_id]        @items << item        # Determine if sorted by level or alphabet and then sort the list        if Venka::Crafting::Sort_Type == :level && @sort_list          @items.sort!{|a, b| a.req_level <=> b.req_level}        elsif Venka::Crafting::Sort_Type == :alphabet  && @sort_list          @items.sort!{|a, b| a.crafted_item.name <=> b.crafted_item.name}        end      end      @sort_list = false      @items.each do |item|        add_command(item.crafted_item, item.recipe_id.to_s.to_sym, enabled?(item))      end    end  end
Hello Venka.
I mean absolutely NO RUSH when I ask this. I would simply like to know for my personal project eta.

Any idea when what we talked about HERE will be implement is at all?

Thanks again for your amazing work.

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