efeberk 84 Posted December 3, 2013 (edited) Scene Combine for RGSS3 by efeberk Introduction This script will allow to combine two items and generate a new item from combined items. Screenshot: Script =begin =============================================================================== Scene_Combine by efeberk Version: RGSS3 =============================================================================== This script will allow to combine two items and generate a new item from combined items. The scene is similiar with item_window. Actually you can use Scene_Combine instead of Scene_Item because there is an option named "Use" that allows you to use items. Why you need Item scene? Example : You have 1 potion and 1 stimulant. Combine them and generate a new Ultra stimulant. -------------------------------------------------------------------------------- How to open Scene_Combine: SceneManager.call(Scene_Combine) Note : This script works on Items, Weapons and Armors =end module EFE COMBINE_BUTTON = "Combine" USE_BUTTON = "Use" SUCCESS = "Items have been combined succesfully" #Item name will be colored when you select an item in the list. SELECTED_COLOR = 14 COMBINATIONS = [ #[[item1, :type], [item2, :type], [result, :type]], #[[item1, :type], [item2, :type], [result, :type]], [[1, :item],[2, :weapon], [3, :armor]], [[8, :item],[9, :item], [3, :armor]] ] end #============================================================================== # ** Window_ItemKategory #------------------------------------------------------------------------------ # This window is for selecting a category of normal items and equipment # on the item screen or shop screen. #============================================================================== class Window_ItemKategory < Window_HorzCommand #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :item_window #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 0) end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width Graphics.width end #-------------------------------------------------------------------------- # * Get Digit Count #-------------------------------------------------------------------------- def col_max return 4 end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super @item_window.category = current_symbol if @item_window end #-------------------------------------------------------------------------- # * Create Command List #-------------------------------------------------------------------------- def make_command_list add_command(Vocab::item, :item) add_command(Vocab::weapon, :weapon) add_command(Vocab::armor, :armor) add_command(Vocab::key_item, :key_item) end #-------------------------------------------------------------------------- # * Set Item Window #-------------------------------------------------------------------------- def item_window=(item_window) @item_window = item_window update end end class Window_ItemListe < Window_Selectable attr_reader :accepted_items attr_reader :combining def initialize(x, y, width, height) super @combining = false @accepted_items = [] @category = :none @data = [] end def combining=(combine) @combining = combine end def category=(category) return if @category == category @category = category refresh self.oy = 0 end def col_max return 2 end def item_max @data ? @data.size : 1 end def item @data && index >= 0 ? @data[index] : nil end def current_item_enabled? enable?(@data[index]) end def include?(item) case @category when :item item.is_a?(RPG::Item) && !item.key_item? when :weapon item.is_a?(RPG::Weapon) when :armor item.is_a?(RPG::Armor) when :key_item item.is_a?(RPG::Item) && item.key_item? else false end end def draw_item_name(item, x, y, enabled = true, width = 172) return unless item draw_icon(item.icon_index, x, y, enabled) draw_text(x + 24, y, width, line_height, item.name) end def enable?(item) return true if @combining $game_party.usable?(item) end def make_item_list @data = $game_party.all_items.select {|item| include?(item) } @data.push(nil) if include?(nil) end def select_last select(@data.index($game_party.last_item.object) || 0) end def draw_item(index) item = @data[index] if item rect = item_rect(index) rect.width -= 4 k = [item.id, :item] if item.is_a?(RPG::Item) k = [item.id, :weapon] if item.is_a?(RPG::Weapon) k = [item.id, :armor] if item.is_a?(RPG::Armor) change_color(normal_color, enable?(item)) change_color(text_color(EFE::SELECTED_COLOR), enable?(item)) if @accepted_items.include?(k) draw_item_name(item, rect.x, rect.y, enable?(item)) draw_item_number(rect, item) end end def draw_item_number(rect, item) draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2) end def update_help @help_window.set_item(item) end def refresh make_item_list create_contents draw_all_items end end class Window_AcceptCombination < Window_HorzCommand def initialize(x, y) super(x, y) self.z = 0 end def window_width return Graphics.width end def col_max return 2 end def make_command_list add_command(EFE::COMBINE_BUTTON, :combine) add_command(EFE::USE_BUTTON, :use) end end class Scene_Combine < Scene_ItemBase def start super create_help_window create_options_window create_category_window create_item_window end def create_options_window @options_window = Window_AcceptCombination.new(0, @help_window.y + @help_window.height) @options_window.set_handler(:combine, method(:combine_ok)) @options_window.set_handler(:use, method(:use_ok)) @options_window.set_handler(:cancel, method(:return_scene)) end def combine_ok @item_window.combining = true @combine = true @category_window.item_window = @item_window @options_window.deactivate.unselect @category_window.activate.select(0) end def use_ok @item_window.combining = false @category_window.item_window = @item_window @options_window.deactivate.unselect @category_window.activate.select(0) end def create_category_window @category_window = Window_ItemKategory.new @category_window.viewport = @viewport @category_window.help_window = @help_window @category_window.y = @help_window.height + @options_window.height @category_window.set_handler(:ok, method(:on_category_ok)) @category_window.set_handler(:cancel, method(:on_category_cancel)) end def create_item_window wy = @category_window.y + @category_window.height wh = Graphics.height - wy @item_window = Window_ItemListe.new(0, wy, Graphics.width, wh) @item_window.viewport = @viewport @item_window.help_window = @help_window @item_window.set_handler(:ok, method(:on_item_ok)) @item_window.set_handler(:cancel, method(:on_item_cancel)) @category_window.deactivate.unselect end def on_category_ok @item_window.activate @item_window.select_last end def on_category_cancel @item_window.deactivate.unselect @item_window.accepted_items.clear @category_window.deactivate.unselect @options_window.activate.select(0) end def on_item_ok k = [@item_window.item.id, :item] if @item_window.item.is_a?(RPG::Item) k = [@item_window.item.id, :weapon] if @item_window.item.is_a?(RPG::Weapon) k = [@item_window.item.id, :armor] if @item_window.item.is_a?(RPG::Armor) if !@item_window.combining @options_window.deactivate $game_party.last_item.object = item determine_item else if @item_window.accepted_items.include?(k) @item_window.accepted_items.delete(k) else @item_window.accepted_items.push(k) end if @item_window.accepted_items.size == 2 check_combinations(@item_window.accepted_items[0], @item_window.accepted_items[1]) @item_window.refresh else @item_window.refresh @item_window.activate end end end def check_combinations(id1, id2) EFE::COMBINATIONS.each {|i| if (id1 == i[0] || id1 == i[1]) && (id2 == i[0] || id2 == i[1]) @combineitem1 = $data_items[i[0][0]] if i[0][1] == :item @combineitem1 = $data_weapons[i[0][0]] if i[0][1] == :weapon @combineitem1 = $data_armors[i[0][0]] if i[0][1] == :armor @combineitem2 = $data_items[i[1][0]] if i[1][1] == :item @combineitem2 = $data_weapons[i[1][0]] if i[1][1] == :weapon @combineitem2 = $data_armors[i[1][0]] if i[1][1] == :armor @resultitem = $data_items[i[2][0]] if i[2][1] == :item @resultitem = $data_weapons[i[2][0]] if i[2][1] == :weapon @resultitem = $data_armors[i[2][0]] if i[2][1] == :armor @item_window.accepted_items.clear @item_window.refresh @item_window.activate $game_party.lose_item(@combineitem1, 1) $game_party.lose_item(@combineitem2, 1) $game_party.gain_item(@resultitem, 1) messagebox(EFE::SUCCESS, 400) return end } @item_window.accepted_items.clear @item_window.refresh @item_window.activate end def on_item_cancel @item_window.unselect @category_window.activate end def play_se_for_item Sound.play_use_item end def use_item super @item_window.redraw_current_item end end =begin =============================================================================== MessageBox by efeberk Version: RGSS3 =============================================================================== This script will allow to open a new messagebox window only with a text. -------------------------------------------------------------------------------- Call MessageBox in Script: messagebox(text, width) width : width of the window =end class Window_MessageBox < Window_Base def initialize(x, y, text, width) super(x, y, width, fitting_height(1)) refresh(text) end def refresh(text) draw_text(0, 0, contents_width, line_height, text, 1) end end class Scene_MessageBox < Scene_Base def start super create_message_window create_background end def prepare(text, width) @text = text @width = width end def update super if Input.repeat?(: || Input.repeat?(:C) SceneManager.return end end def create_message_window @message_window = Window_MessageBox.new(0, 0, @text, @width) @message_window.width = @width @message_window.x = (Graphics.width / 2) - (@message_window.width / 2) @message_window.y = (Graphics.height / 2) - (@message_window.height / 2) end def create_background @background_sprite = Sprite.new @background_sprite.bitmap = SceneManager.background_bitmap @background_sprite.color.set(100, 100, 100, 128) end end def messagebox(text, width) SceneManager.call(Scene_MessageBox) SceneManager.scene.prepare(text, width) end Edited April 29, 2014 by efeberk 1 JiM reacted to this Share this post Link to post Share on other sites
Chaos17 31 Posted December 3, 2013 (edited) I like how simple the script seems to use but I've suggestions : - add a window of the possible result with its description, please ? Ex : http://www.zeldainformer.com/images/news/Zelda_Skyward_Sword_1014_22.bmp That would be nice to have a similar window scene like in the picture above. Edited December 3, 2013 by Chaos17 Share this post Link to post Share on other sites
Tsukihime 1,487 Posted December 3, 2013 If you add such a window, I would suggest making it optional as well, since not everyone wants to make it so that you can see what you can make. 1 KayDgirl91 reacted to this Share this post Link to post Share on other sites
efeberk 84 Posted December 3, 2013 (edited) I developed this script just for a request. I may improve this system in future. So, what I'm looking for is a script (Or event) that allows you to select items and combine them. However, unlike a lot of the scripts I've seen (Including the crafting systems) I don't want a window that shows if the combination will work. Nor do I want a recipe book for a player to follow. Put simply, all I need is something that allows the player to open up the items menu and select an item, then (with no windows being closed) immediately be able to select another item in the same menu. http://www.rpgmakervxace.net/topic/20021-selecting-and-combining-items-request/ Edited December 3, 2013 by efeberk Share this post Link to post Share on other sites
KayDgirl91 99 Posted December 3, 2013 (edited) First off, great job with this script! I saw the request for this script a little while ago, and I was hoping that someone would write a script. And it turns out you did! I'll definitely be using this in my latest project! Second, as far as creating that second window providing descriptions of what the result will be when combined could be pretty handy, but at the same time the user could just as easily event something so that people collect recipes in the game (whether it's an item that has the result description, or in talking with various NPC's) that tell them what they need to make a certain thing. That is probably what I will do, so no hurry or pressure on making an update that would support that second window. But it is a good idea and would be handy Again, great script here! Edit: Is it possible to make it so that more than 2 items can be combined? Edited December 3, 2013 by KevinFrost Share this post Link to post Share on other sites
efeberk 84 Posted December 4, 2013 (edited) First off, great job with this script! I saw the request for this script a little while ago, and I was hoping that someone would write a script. And it turns out you did! I'll definitely be using this in my latest project! Second, as far as creating that second window providing descriptions of what the result will be when combined could be pretty handy, but at the same time the user could just as easily event something so that people collect recipes in the game (whether it's an item that has the result description, or in talking with various NPC's) that tell them what they need to make a certain thing. That is probably what I will do, so no hurry or pressure on making an update that would support that second window. But it is a good idea and would be handy Again, great script here! Edit: Is it possible to make it so that more than 2 items can be combined? Ye you right, But there are a lot of craft scripts I think. They are providing what you need(recipe books, description etc...). Why I ddin't do what you said above. Cause of this : So, what I'm looking for is a script (Or event) that allows you to select items and combine them. However, unlike a lot of the scripts I've seen (Including the crafting systems) I don't want a window that shows if the combination will work. Nor do I want a recipe book for a player to follow. I could generate a featured crafting script but I just made it for AvalonMelody Please don't say about it again >.> Edited December 4, 2013 by efeberk Share this post Link to post Share on other sites
KayDgirl91 99 Posted December 4, 2013 I know that that is why you made this system, it was a request. And you set it up exactly how the request was made. I mean't no disrespect to you or your work. I know that there are quite a few crafting systems out there with recipes, craft descriptions and more. I just really liked the way this system is set up so I thought it would be nice to have it be a crafting system too. But I completely understand if you don't do it. Scripting is a lot of work. I didn't mean to tell you how to make your script. Just suggesting things if you ever plan on updating it to add more functions. Share this post Link to post Share on other sites
Chaos17 31 Posted December 4, 2013 (edited) Personally, what you did is enough for me and just want the esthetic being improved in the futur like in the example I showed you. Edited December 4, 2013 by Chaos17 1 KayDgirl91 reacted to this Share this post Link to post Share on other sites
efeberk 84 Posted December 4, 2013 Updated 1 KayDgirl91 reacted to this Share this post Link to post Share on other sites
KayDgirl91 99 Posted December 4, 2013 I absolutely love the update!!! I mean, the first version was awesome enough. But I am going to replace my Item Scene with this one for sure!! Thank's for this! Keep up the great work! Share this post Link to post Share on other sites
Rei Cho 0 Posted February 26, 2014 Hi there Thanks for making this script. I've just got a few questions, hopefully some one can help me out First off, I'm going to start by saying I have no idea how to code / script. I just want to try my hand at making games haha. However, the idea behind this script is incredible and I would love to use it. I just don't know how >< I put it into a section in the script editor, changed the SceneManager.Call(Scene_Item) to SceneManager.Call(Scene_Combine) from the Scene_Menu script. It runs in game, combine shows up and everything. The problem is that whenever I try to combine a single item from the a necessary combination, the resulting item still pops up. (Basically, by combining 1 item within the combination with itself, the resulting item still shows up regardless if I have item 2 or not. However if item 1 and item 2 is present, then the combining option consumes both material item to yield product item.) I was wondering if i did the combinations wrong. I set the combination like so: COMBINATIONS = [ [[17, :item],[18, :item], [19, :item]], ] end But it only requires just 1 item 17 by itself, if I use the combine option, to make item 19. Is there a way to make it so 17 must need 18 so that 19 may be made? Is it possible so that item 17 cannot be chosen to combine with itself? Also I removed line : messagebox(EFE::SUCCESS, 400) Since it kept giving me an error... not sure if that is necessary. Thanks a bunch to whoever gave their time up willingly to read this and thanks to anyone who replies. Share this post Link to post Share on other sites
Britannia Angel 8 Posted April 28, 2014 I'm getting the same problems in the script as Rei Cho where combining an item with itself yields the result item when it shouldn't. Is it possible to make the first selected item unselectable when choosing the second, to prevent it combining with itself? The line "messagebox(EFE::SUCCESS, 400)" spits out an error too, but for now I just commented that out. It doesn't show the combine success message anymore though. Share this post Link to post Share on other sites
efeberk 84 Posted April 29, 2014 Hi there Thanks for making this script. I've just got a few questions, hopefully some one can help me out First off, I'm going to start by saying I have no idea how to code / script. I just want to try my hand at making games haha. However, the idea behind this script is incredible and I would love to use it. I just don't know how >< I put it into a section in the script editor, changed the SceneManager.Call(Scene_Item) to SceneManager.Call(Scene_Combine) from the Scene_Menu script. It runs in game, combine shows up and everything. The problem is that whenever I try to combine a single item from the a necessary combination, the resulting item still pops up. (Basically, by combining 1 item within the combination with itself, the resulting item still shows up regardless if I have item 2 or not. However if item 1 and item 2 is present, then the combining option consumes both material item to yield product item.) I was wondering if i did the combinations wrong. I set the combination like so: COMBINATIONS = [ [[17, :item],[18, :item], [19, :item]], ] end But it only requires just 1 item 17 by itself, if I use the combine option, to make item 19. Is there a way to make it so 17 must need 18 so that 19 may be made? Is it possible so that item 17 cannot be chosen to combine with itself? Also I removed line : messagebox(EFE::SUCCESS, 400) Since it kept giving me an error... not sure if that is necessary. Thanks a bunch to whoever gave their time up willingly to read this and thanks to anyone who replies. I'm getting the same problems in the script as Rei Cho where combining an item with itself yields the result item when it shouldn't. Is it possible to make the first selected item unselectable when choosing the second, to prevent it combining with itself? The line "messagebox(EFE::SUCCESS, 400)" spits out an error too, but for now I just commented that out. It doesn't show the combine success message anymore though. I'm sorry for late reply but I think I solved problems. Please re-check new script. Share this post Link to post Share on other sites
Britannia Angel 8 Posted April 30, 2014 Script works perfectly now, thanks very much for the fixes! Share this post Link to post Share on other sites
keridenes 0 Posted May 5, 2014 (edited) Hi! Thank you for this script, it is amazing! Is it possible somehow, that if I write 2 reward items, then I get 2 reward items, otherwise only 1? I managed to edit the code to give the 2 reward items defined in the combinations part, and it works, but when there is only 1 reward item, it crashes... is there any way to solve this? The problem more specifically: I have flour and a bucket of water, and I want to get dough and the empty bucket back (2 reward items). On the other hand I have an empty lantern and oil, and I would like to combine it to create a filled lantern (1 reward item). Please help me, how could I solve this? EDIT: I managed to solve it by adding another result to the combinations part (if there is only one result then you have to write [nil] as a second result to make it work) and by adding these lines to the check_combinations part: if i[3][0] != nil @resultitem2 = $data_items[i[3][0]] if i[3][1] == :item @resultitem2 = $data_weapons[i[3][0]] if i[3][1] == :weapon @resultitem2 = $data_armors[i[3][0]] if i[3][1] == :armor $game_party.gain_item(@resultitem2, 1) end Edited June 8, 2014 by keridenes Share this post Link to post Share on other sites
jpjpjpppjp 0 Posted September 3, 2014 I'm trying to use this script but I'm having trouble customizing it. First: I would like to use this script only to combine items and not to use Use them, so I excluded the "USE" Button from the GUI but now the "COMBINE" Button doesn't occupy full place, I see a blank where the "USE" button was, so I would like to make the "COMBINE" Button occupy the full space. Second: I would like to do a similar thing as before but now, to erase the "ARMOR" and "WEAPONS" buttons and don't have blanks between Items and Key items. I also don't really know how to use the: #[[item1, :type], [item2, :type], [result, :type]], #[[item1, :type], [item2, :type], [result, :type]],[[1, :item],[2, :weapon], [3, :armor]], [[8, :item],[9, :item], [3, :armor]] Please, help quick Share this post Link to post Share on other sites
Britannia Angel 8 Posted September 3, 2014 Under Window_AcceptCombination, look for: def col_max return 2 end And change the 2 to 1. For the second part, look for def col_max again, this time under Window_ItemKategory and change that number from 4 to 2. Then look for this: def make_command_list add_command(Vocab::item, :item) add_command(Vocab::weapon, :weapon) add_command(Vocab::armor, :armor) add_command(Vocab::key_item, :key_item) end Delete/put a # in front of the categories you don't want. For the setup, the number refers to the ID number in the database, and :type refers to the item category. So if you have [[1, :item],[2, :weapon], [3, :armor]], that means the player can combine an item with ID of 1, with a weapon of ID 2, and the result is an armor of ID 3. Check your database for the ID numbers. Share this post Link to post Share on other sites
jpjpjpppjp 0 Posted September 4, 2014 I tried: COMBINATIONS = [ [[1, :key_item],[2, :item], [4, :item]], ] end What I am trying to do here is combine a axe to a log making a branch. 1 is 001 Id for axe 2 for 002 wooden log and 004 for a wooden branch, which 001 is key item and 002 and 004 both a normal item. Still It doesn't work. Share this post Link to post Share on other sites
Rairun 1 Posted October 17, 2014 (edited) Thanks for the script! It's exactly what I need for my adventure/RPG hybrid.I got the RPG Maker humble bundle a few months ago, and since then I've been slowing making progress. I'm not very good yet, but I'm hoping I'll be able to make a commercial game one day. If I ever manage, would you allow the use of this script? Edit: I tried: COMBINATIONS = [ [[1, :key_item],[2, :item], [4, :item]], ] end What I am trying to do here is combine a axe to a log making a branch. 1 is 001 Id for axe 2 for 002 wooden log and 004 for a wooden branch, which 001 is key item and 002 and 004 both a normal item. Still It doesn't work. The same was happening to me, and I've just figured out why. The "combine" option isn't working with key items. To fix this, look for the method check_combinations (the same one keridenes altered above), find the lines that end with :item, duplicate them and edit the copies so they read :key_item instead. For example: @combineitem1 = $data_items[i[0][0]] if i[0][1] == :item becomes @combineitem1 = $data_items[i[0][0]] if i[0][1] == :item @combineitem1 = $data_items[i[0][0]] if i[0][1] == :key_item Edited October 17, 2014 by Rairun Share this post Link to post Share on other sites
+ J_C 6 Posted November 21, 2015 Scene Combine for RGSS3 by efeberk Introduction This script will allow to combine two items and generate a new item from combined items. Screenshot: Script =begin =============================================================================== Scene_Combine by efeberk Version: RGSS3 =============================================================================== This script will allow to combine two items and generate a new item from combined items. The scene is similiar with item_window. Actually you can use Scene_Combine instead of Scene_Item because there is an option named "Use" that allows you to use items. Why you need Item scene? Example : You have 1 potion and 1 stimulant. Combine them and generate a new Ultra stimulant. -------------------------------------------------------------------------------- How to open Scene_Combine: SceneManager.call(Scene_Combine) Note : This script works on Items, Weapons and Armors =end module EFE COMBINE_BUTTON = "Combine" USE_BUTTON = "Use" SUCCESS = "Items have been combined succesfully" #Item name will be colored when you select an item in the list. SELECTED_COLOR = 14 COMBINATIONS = [ #[[item1, :type], [item2, :type], [result, :type]], #[[item1, :type], [item2, :type], [result, :type]], [[1, :item],[2, :weapon], [3, :armor]], [[8, :item],[9, :item], [3, :armor]] ] end #============================================================================== # ** Window_ItemKategory #------------------------------------------------------------------------------ # This window is for selecting a category of normal items and equipment # on the item screen or shop screen. #============================================================================== class Window_ItemKategory < Window_HorzCommand #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :item_window #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 0) end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width Graphics.width end #-------------------------------------------------------------------------- # * Get Digit Count #-------------------------------------------------------------------------- def col_max return 4 end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super @item_window.category = current_symbol if @item_window end #-------------------------------------------------------------------------- # * Create Command List #-------------------------------------------------------------------------- def make_command_list add_command(Vocab::item, :item) add_command(Vocab::weapon, :weapon) add_command(Vocab::armor, :armor) add_command(Vocab::key_item, :key_item) end #-------------------------------------------------------------------------- # * Set Item Window #-------------------------------------------------------------------------- def item_window=(item_window) @item_window = item_window update end end class Window_ItemListe < Window_Selectable attr_reader :accepted_items attr_reader :combining def initialize(x, y, width, height) super @combining = false @accepted_items = [] @category = :none @data = [] end def combining=(combine) @combining = combine end def category=(category) return if @category == category @category = category refresh self.oy = 0 end def col_max return 2 end def item_max @data ? @data.size : 1 end def item @data && index >= 0 ? @data[index] : nil end def current_item_enabled? enable?(@data[index]) end def include?(item) case @category when :item item.is_a?(RPG::Item) && !item.key_item? when :weapon item.is_a?(RPG::Weapon) when :armor item.is_a?(RPG::Armor) when :key_item item.is_a?(RPG::Item) && item.key_item? else false end end def draw_item_name(item, x, y, enabled = true, width = 172) return unless item draw_icon(item.icon_index, x, y, enabled) draw_text(x + 24, y, width, line_height, item.name) end def enable?(item) return true if @combining $game_party.usable?(item) end def make_item_list @data = $game_party.all_items.select {|item| include?(item) } @data.push(nil) if include?(nil) end def select_last select(@data.index($game_party.last_item.object) || 0) end def draw_item(index) item = @data[index] if item rect = item_rect(index) rect.width -= 4 k = [item.id, :item] if item.is_a?(RPG::Item) k = [item.id, :weapon] if item.is_a?(RPG::Weapon) k = [item.id, :armor] if item.is_a?(RPG::Armor) change_color(normal_color, enable?(item)) change_color(text_color(EFE::SELECTED_COLOR), enable?(item)) if @accepted_items.include?(k) draw_item_name(item, rect.x, rect.y, enable?(item)) draw_item_number(rect, item) end end def draw_item_number(rect, item) draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2) end def update_help @help_window.set_item(item) end def refresh make_item_list create_contents draw_all_items end end class Window_AcceptCombination < Window_HorzCommand def initialize(x, y) super(x, y) self.z = 0 end def window_width return Graphics.width end def col_max return 2 end def make_command_list add_command(EFE::COMBINE_BUTTON, :combine) add_command(EFE::USE_BUTTON, :use) end end class Scene_Combine < Scene_ItemBase def start super create_help_window create_options_window create_category_window create_item_window end def create_options_window @options_window = Window_AcceptCombination.new(0, @help_window.y + @help_window.height) @options_window.set_handler(:combine, method(:combine_ok)) @options_window.set_handler(:use, method(:use_ok)) @options_window.set_handler(:cancel, method(:return_scene)) end def combine_ok @item_window.combining = true @combine = true @category_window.item_window = @item_window @options_window.deactivate.unselect @category_window.activate.select(0) end def use_ok @item_window.combining = false @category_window.item_window = @item_window @options_window.deactivate.unselect @category_window.activate.select(0) end def create_category_window @category_window = Window_ItemKategory.new @category_window.viewport = @viewport @category_window.help_window = @help_window @category_window.y = @help_window.height + @options_window.height @category_window.set_handler(:ok, method(:on_category_ok)) @category_window.set_handler(:cancel, method(:on_category_cancel)) end def create_item_window wy = @category_window.y + @category_window.height wh = Graphics.height - wy @item_window = Window_ItemListe.new(0, wy, Graphics.width, wh) @item_window.viewport = @viewport @item_window.help_window = @help_window @item_window.set_handler(:ok, method(:on_item_ok)) @item_window.set_handler(:cancel, method(:on_item_cancel)) @category_window.deactivate.unselect end def on_category_ok @item_window.activate @item_window.select_last end def on_category_cancel @item_window.deactivate.unselect @item_window.accepted_items.clear @category_window.deactivate.unselect @options_window.activate.select(0) end def on_item_ok k = [@item_window.item.id, :item] if @item_window.item.is_a?(RPG::Item) k = [@item_window.item.id, :weapon] if @item_window.item.is_a?(RPG::Weapon) k = [@item_window.item.id, :armor] if @item_window.item.is_a?(RPG::Armor) if !@item_window.combining @options_window.deactivate $game_party.last_item.object = item determine_item else if @item_window.accepted_items.include?(k) @item_window.accepted_items.delete(k) else @item_window.accepted_items.push(k) end if @item_window.accepted_items.size == 2 check_combinations(@item_window.accepted_items[0], @item_window.accepted_items[1]) @item_window.refresh else @item_window.refresh @item_window.activate end end end def check_combinations(id1, id2) EFE::COMBINATIONS.each {|i| if (id1 == i[0] || id1 == i[1]) && (id2 == i[0] || id2 == i[1]) @combineitem1 = $data_items[i[0][0]] if i[0][1] == :item @combineitem1 = $data_weapons[i[0][0]] if i[0][1] == :weapon @combineitem1 = $data_armors[i[0][0]] if i[0][1] == :armor @combineitem2 = $data_items[i[1][0]] if i[1][1] == :item @combineitem2 = $data_weapons[i[1][0]] if i[1][1] == :weapon @combineitem2 = $data_armors[i[1][0]] if i[1][1] == :armor @resultitem = $data_items[i[2][0]] if i[2][1] == :item @resultitem = $data_weapons[i[2][0]] if i[2][1] == :weapon @resultitem = $data_armors[i[2][0]] if i[2][1] == :armor @item_window.accepted_items.clear @item_window.refresh @item_window.activate $game_party.lose_item(@combineitem1, 1) $game_party.lose_item(@combineitem2, 1) $game_party.gain_item(@resultitem, 1) messagebox(EFE::SUCCESS, 400) return end } @item_window.accepted_items.clear @item_window.refresh @item_window.activate end def on_item_cancel @item_window.unselect @category_window.activate end def play_se_for_item Sound.play_use_item end def use_item super @item_window.redraw_current_item end end =begin =============================================================================== MessageBox by efeberk Version: RGSS3 =============================================================================== This script will allow to open a new messagebox window only with a text. -------------------------------------------------------------------------------- Call MessageBox in Script: messagebox(text, width) width : width of the window =end class Window_MessageBox < Window_Base def initialize(x, y, text, width) super(x, y, width, fitting_height(1)) refresh(text) end def refresh(text) draw_text(0, 0, contents_width, line_height, text, 1) end end class Scene_MessageBox < Scene_Base def start super create_message_window create_background end def prepare(text, width) @text = text @width = width end def update super if Input.repeat?(: || Input.repeat?(:C) SceneManager.return end end def create_message_window @message_window = Window_MessageBox.new(0, 0, @text, @width) @message_window.width = @width @message_window.x = (Graphics.width / 2) - (@message_window.width / 2) @message_window.y = (Graphics.height / 2) - (@message_window.height / 2) end def create_background @background_sprite = Sprite.new @background_sprite.bitmap = SceneManager.background_bitmap @background_sprite.color.set(100, 100, 100, 128) end end def messagebox(text, width) SceneManager.call(Scene_MessageBox) SceneManager.scene.prepare(text, width) end Hi! Could you (or any other user) help me out a bit with this script? I'm fairly new in using this engine, and although I used some scripts, they were much simpler (just a simple copy past into the materials part of the script page). My questions are: - where do I copy this script? To the usual, material part, or somewhere else? - what is this scenemanager.call thingy, what do I have to do with it? - could you point out where do I have to write the item IDs of the items I want to use in the combining? Share this post Link to post Share on other sites
Rikifive 3,319 Posted November 21, 2015 1) Copy all that wall of text and paste that to your script editor. To access script editor press F11 while being in Map Editor or press that button: And preferably paste the wall of text here; below materials; above main. (on ss there are some scripts installed) 2) Scenemanager.call thingy 'calls' other scene~menu or something like this. For example 'Title Screen' is one scene; "Map" (where you control character) is another; main menu, Items menu, Equip menu, Status window etc. etc. are also different scenes. In menu you have commands like 'Items' 'Equip' etc. ~ these commands have configured scene.calling already, but they can also be accessed via manual Scenemanager.call. In this script it is 'SceneManager.call(Scene_Combine)' - This command calls the Combine Scene (Menu). You need to put that in a thing called 'Script Call'. Create an event on map and add a command -> go to 3rd page and at the end you'll find "Script..." -> click it and enter "SceneManager.call(Scene_Combine)" and that event will call the combine menu for you. 3) At the beginning of this script you'll find: COMBINATIONS = [ #[[item1, :type], [item2, :type], [result, :type]], #[[item1, :type], [item2, :type], [result, :type]], [[1, :item],[2, :weapon], [3, :armor]], [[8, :item],[9, :item], [3, :armor]] ] And there you have explained how to setup combinations I believe item1, item2 and result numbers are referring to items' ID. By default you have: Item with ID 1 + weapon with ID 2 = armor with ID 3 and item ID 8 + item ID 9 = armor ID 3 ID's are taken from database, so if you have a potion on the first slot, then its ID is 1 (The number to the left) If you want to add a recipe like Item with ID 5 + item with ID 12 = Item with ID 8, then simply add an additional line: COMBINATIONS = [ #[[item1, :type], [item2, :type], [result, :type]], #[[item1, :type], [item2, :type], [result, :type]], [[1, :item],[2, :weapon], [3, :armor]], [[8, :item],[9, :item], [3, :armor]], # ADD A COMA HERE [[5, :item],[12, :item], [8, :item]] # /!\ last one has to not have the coma ] Hope that helps and good luck! (= 1 J_C reacted to this Share this post Link to post Share on other sites
+ J_C 6 Posted November 21, 2015 (edited) 1) Copy all that wall of text and paste that to your script editor. To access script editor press F11 while being in Map Editor or press that button: And preferably paste the wall of text here; below materials; above main. (on ss there are some scripts installed) 2) Scenemanager.call thingy 'calls' other scene~menu or something like this. For example 'Title Screen' is one scene; "Map" (where you control character) is another; main menu, Items menu, Equip menu, Status window etc. etc. are also different scenes. In menu you have commands like 'Items' 'Equip' etc. ~ these commands have configured scene.calling already, but they can also be accessed via manual Scenemanager.call. In this script it is 'SceneManager.call(Scene_Combine)' - This command calls the Combine Scene (Menu). You need to put that in a thing called 'Script Call'. Create an event on map and add a command -> go to 3rd page and at the end you'll find "Script..." -> click it and enter "SceneManager.call(Scene_Combine)" and that event will call the combine menu for you. 3) At the beginning of this script you'll find:COMBINATIONS = [ #[[item1, :type], [item2, :type], [result, :type]], #[[item1, :type], [item2, :type], [result, :type]], [[1, :item],[2, :weapon], [3, :armor]], [[8, :item],[9, :item], [3, :armor]] ] And there you have explained how to setup combinations I believe item1, item2 and result numbers are referring to items' ID. By default you have: Item with ID 1 + weapon with ID 2 = armor with ID 3 and item ID 8 + item ID 9 = armor ID 3 ID's are taken from database, so if you have a potion on the first slot, then its ID is 1 (The number to the left) If you want to add a recipe like Item with ID 5 + item with ID 12 = Item with ID 8, then simply add an additional line:COMBINATIONS = [ #[[item1, :type], [item2, :type], [result, :type]], #[[item1, :type], [item2, :type], [result, :type]], [[1, :item],[2, :weapon], [3, :armor]], [[8, :item],[9, :item], [3, :armor]], # ADD A COMA HERE [[5, :item],[12, :item], [8, :item]] # /!\ last one has to not have the coma ] Hope that helps and good luck! (= It worked! Thanks a million times. It was easier and at the same time more difficult than I thought. I would have never thought that I have to make an event with a script, but after that it was all set. But, is is possible to use this without making an event? To make this kind of combine window the default? Because right now I can only combine items at preditermined spots, where I make an event for it. There is something in the scripts which reads like this: Actually you can use Scene_Combine instead of Scene_Item because there is an option named "Use" that allows you to use items. Why you need Item scene? Maybe you can just replace the default item scene with this somehow? Edited November 21, 2015 by J_C Share this post Link to post Share on other sites
Rikifive 3,319 Posted November 21, 2015 Yes it is. I said earlier: In menu you have commands like 'Items' 'Equip' etc. ~ these commands have configured scene.calling already That's what you have to do (and what you said by yourself). You need to configure the 'Items' command to make it call Combine Scene instead of the Item Scene. All you need is to change something in the default scripts, so basically you can just use this: # Changes the scene called upon choosing 'Items' command in menu. class Scene_Menu < Scene_MenuBase def command_item SceneManager.call(Scene_Item) # Change Scene to be called end end (Paste this also preferably below materials; above main) Replace the (Scene_Item), which the one, that is defined in the script. Share this post Link to post Share on other sites
+ J_C 6 Posted November 21, 2015 Yes it is. I said earlier: In menu you have commands like 'Items' 'Equip' etc. ~ these commands have configured scene.calling already That's what you have to do (and what you said by yourself). You need to configure the 'Items' command to make it call Combine Scene instead of the Item Scene. All you need is to change something in the default scripts, so basically you can just use this: # Changes the scene called upon choosing 'Items' command in menu. class Scene_Menu < Scene_MenuBase def command_item SceneManager.call(Scene_Item) # Change Scene to be called end end (Paste this also preferably below materials; above main) Replace the (Scene_Item), which the one, that is defined in the script. Thanks again. I will try to make it work. Share this post Link to post Share on other sites
Rikifive 3,319 Posted November 21, 2015 Glad could help! (= Share this post Link to post Share on other sites