Save-Point
Category Add-on For Deke's Crafting System - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Archives (https://www.save-point.org/forum-105.html)
+--- Forum: Creation Asylum Archives (https://www.save-point.org/forum-90.html)
+---- Forum: Scripts & Code Snippets (https://www.save-point.org/forum-92.html)
+----- Forum: RPG Maker XP Code (https://www.save-point.org/forum-93.html)
+----- Thread: Category Add-on For Deke's Crafting System (/thread-6775.html)



Category Add-on For Deke's Crafting System - Nick - 07-27-2005

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


Upgrade to Deke's crafting system for multiple categories:
Note, I assumed that you seperated the masterlist and the main script, if not, the lines will not be correct.
In the master list you need to change each recipe:

After each result_type = * line add this (replace ### by category):
Code:
category = ###

And replace every line that looks like this:
Code:
@recipe_list.push(Game_Recipe.new(ingredients,ingredient_types,quantities,result,result_type))

With the following line:
Code:
@recipe_list.push(Game_Recipe.new(ingredients,ingredient_types,quantities,result,result_type,category))

For the main script you need to change this:
Add after line 88 this:
Code:
attr_reader :category

Replace line 92 with this:
Code:
def initialize(ingredients, ingredient_types, quantities, result, result_type, category)

Add after line 97 this:
Code:
@category = category

Replace line 197 with this:
Code:
def initialize(category = 0)

After line 199 put this:
Code:
@category = category

Replace lines 217 to 219 with this:
Code:
for i in 0...$game_party.recipes.size
  if $game_party.recipes[i].category == @category or @category == 0 or @category == "all"
      @data.push($game_party.recipes[i])
    end
  end

Replace lines 395 to 398 with this:
Code:
def initialize(category = 0, craft_index=0, return_scene = "menu")
  @category = category
  @craft_index = craft_index
  @return_scene = return_scene
end

Replace line 403 with this:
Code:
@craft_window = Window_Craft.new(@category)

Replace line 511, 514 and 519 by this line:
Code:
$scene=Scene_Craft.new(@category, @craft_index)

Now if you want to call the crafting scene use this:
Code:
$scene = Scene_Craft.new(category)
It will stay the same for the commands.
NOTE: Using "0" or "all" as category will show all recipes.
NOTE2: You can use strings for categories
NOTE3: Will give an error if there is no recipe with the category learned, no fix yet

Enjoy it