You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today!
I'm trying to use an alchemy script that I found that has what I need. However, it errors at line 254/255 with a Syntax Error. I don't get what's the problem... Can someone take a look? Script is in the spoiler.
#============================================================================== # ** Alchemy Pot #------------------------------------------------------------------------------ # Autor: The Sleeping Leonhart # Version: 1.3 # Release Date: 09/12/2008 #------------------------------------------------------------------------------ # Descrption: # This script make the alchemy pot like the Dragon Quest VIII one. #------------------------------------------------------------------------------ # Version: # 1.0 (06/12/2008): Base Version. # 1.1 (06/12/2008): Added the Failure Item option. # 1.2 (08/12/2008): Fixed a Bug in the item window. # Now you can see the result of recipe immediatly. # 1.3 (09/12/2008): Added a time meter. # Added a filter for the unusable item. #------------------------------------------------------------------------------ # Istruction: # Call the Alchemy Pot with: # $scene = Scene_AlchemyPot.new # Press C to put the item inside the pot. # Press B to remove the last item inserted. # Press A to switch between item and confirm windows. # To customize the script watch the Configuratio and Vocabulary section. #==============================================================================
#============================================================================== # Configuration #============================================================================= module AlchemyPot #=====DON'T TOUCH========================================================= i = load_data("Data/Items.rxdata") w = load_data("Data/Weapons.rxdata") a = load_data("Data/Armors.rxdata") #=========================================================================
#========================================================================= # Formula: Set the items formula. #------------------------------------------------------------------------- # Sintax: # Formula[[iId1, ...]] = [iId2, time] # Parameter: # iId1: id of the ingredients, use i[id] for item, w[id] for weapon, # a[id] for armor. id is the number of the item in the database. # iId2: id of the result item, use i[id] for item, w[id] for weapon, # a[id] for armor. id is the number of the item in the database. # time: number of requested minute to complete the recipe. #========================================================================= Formula = {} Formula[[i[1], i[1]]] = [i[2], 0.02] Formula[[i[1], w[1]]] = [w[2], 0] Formula[[a[1], w[2]]] = [a[2], 4] Formula[[i[1], i[1], i[1]]] = [i[3], 1] Formula[[i[1], i[1], i[1], i[1], i[1]]] = [i[8], 1] #========================================================================= # UnusableItem: Define the item that cannot be putted into the pot #------------------------------------------------------------------------- # Sintax: # UnusableItem = [iId, ...] # Parameter: # iId: id of the ingredients, use i[id] for item, w[id] for weapon, # a[id] for armor. id is the number of the item in the database. #========================================================================= UnusableItem = [i[3], w[5], a[4]] #========================================================================= # MaxItem: Number of maximum item that you can put in the pot. #------------------------------------------------------------------------- # Sintax: # MaxItem = n # Parameter: # n: Number of maximum item that you can put in the pot. #========================================================================= MaxItem = 5 #========================================================================= # FailureItem: Set the item givem if you do a wrong recipe #------------------------------------------------------------------------- # Sintax: # FailureItem = [iId, ...] # Parameter: # iId: id of the result item, use i[id] for item, w[id] for weapon, # a[id] for armor. id is the number of the item in the database, # leave blank if you don't want the failure item. #========================================================================= FailureItem = [i[1], w[4], a[5]] #========================================================================= # FailureTime: Set the time for making the wrong recipe #------------------------------------------------------------------------- # Sintax: # FailureItem = time # Parameter: # time: number of requested minute to complete the recipe. #========================================================================= FailureTime = 1 #========================================================================= # MapBG: Set if the map is visible on the background #------------------------------------------------------------------------- # Sintassi: # MapBG = b # Parametri: # b: true to show the map on the background, false the background is black #========================================================================= MapBG = true #========================================================================= # TimeMeter: Set the time meter image #------------------------------------------------------------------------- # Sintassi: # TimeMeter = [emptymeter, fullmeter] or nil # Parametri: # emptymeter = picture that represent the time meter empty # fullmeter = picture that represent the time meter full # nil = if you put nil the time meter is not used #========================================================================= TimeMeter = ["MeterEmpty", "MeterFull"] end
#============================================================================== # Vocabulary #============================================================================= module Vocab #Confirm Button AlchemyPotGo = "Make" #Exit Button AlchemyPotExit = "Exit" #Correct Formula AlchemyPotRightFormula = "I think that this one can work!" #Incorrect Formula AlchemyPotWrongFormula = "I don't think that this one work!" #Recipe Ready AlchemyPotFormulaFinished = "The recipe is ready!" #Recipe not ready AlchemyPotFormulaNotFinished = "The recipe is not ready yet!" #Item obtained AlchemyPotObtained = "You have obtained:" end
class Game_Party attr_accessor :alchemy_pot alias tslalchemypot_gameparty_initialize initialize def initialize tslalchemypot_gameparty_initialize @alchemy_pot = [] end end
class Window_AlchemyPotItem < Window_Selectable def initialize super(32, 96, 312, 312) @column_max = 10 self.index = 0 refresh end def item return @data[self.index] end def enable?(item) return $game_party.item_can_use?(item) end def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] for item in $data_items if $game_party.item_number(item.id) > 0 and item != nil @data.push(item) if check(item) end end for item in $data_weapons if $game_party.weapon_number(item.id) > 0 and item != nil @data.push(item) if check(item) end end for item in $data_armors if $game_party.armor_number(item.id) > 0 and item != nil @data.push(item) if check(item) end end @item_max = @data.size @row_max = @data.size / 10 if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 28) for i in 0...@item_max draw_item(i) end end end def draw_item(index) item = @data[index] case item when RPG::Item number = $game_party.item_number(item.id) when RPG::Weapon number = $game_party.weapon_number(item.id) when RPG::Armor number = $game_party.armor_number(item.id) end x = index % @column_max * 28 y = index / @column_max * 28 rect = Rect.new(x, y, 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(item.icon_name) self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24)) self.contents.font.size = 12 self.contents.draw_text(12 + x, 8 + y, 24, 24, number.to_s) end def update_help @help_window.set_text(item == nil ? "" : item.name) end def page_row_max return (self.height - 32) / 28 end def top_row return self.oy / 28 end def top_row=(row) super self.oy = row * 28 end def update_cursor_rect super x = @index % @column_max * 28 y = @index / @column_max * 28 - self.oy self.cursor_rect.set(x, y, 24, 24) end def check(item) for i in AlchemyPot::UnusableItem if i.id == item.id and i.class == item.class return false end end return true end end
class Window_AlchemyPotPot < Window_Base def initialize super(454, 96, 28 + 32, 28 * AlchemyPot::MaxItem + 32) self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh(pot = []) self.contents.clear @data = pot.clone @data.push(nil) if @data == [] @item_max = @data.size for i in 0...@item_max draw_item(i) end end def draw_item(index) item = @data[index] if item != nil y = index * 28 bitmap = RPG::Cache.icon(item.icon_name) self.contents.blt(0, y, bitmap, Rect.new(0, 0, 24, 24)) end end end
class Window_PotTimeMeter < Window_Base def initialize(a = 0) super(420, 400, 192, 64) self.contents = Bitmap.new(width - 32, height - 32) self.opacity = 0 refresh(a) end def refresh(a) if AlchemyPot::TimeMeter != nil self.contents.clear a = 0 if a == nil b = $game_party.alchemy_pot[2] b = (Graphics.frame_count - a) * 100 if b == nil draw_graphical_bar(0, 0, AlchemyPot::TimeMeter[0], AlchemyPot::TimeMeter[1], Graphics.frame_count-a, b) end end end
class Scene_AlchemyPot def main @map = Spriteset_Map.new if AlchemyPot::MapBG create_command_window @help_window = Window_Help.new @item_window = Window_AlchemyPotItem.new @item_window.help_window = @help_window @pot_window = Window_AlchemyPotPot.new @result_window = Window_AlchemyPotResult.new @result_window.visible = false @meter = Window_PotTimeMeter.new($game_party.alchemy_pot[1]) @ready = false if $game_party.alchemy_pot != [] if $game_party.alchemy_pot[0][0] == "Wrong" @ingredients = $game_party.alchemy_pot[0][1].clone item = AlchemyPot::FailureItem[rand(AlchemyPot::FailureItem.size)] else @ingredients = $game_party.alchemy_pot[0].clone item = AlchemyPot::Formula[$game_party.alchemy_pot[0]][0] end @pot_window.refresh(@ingredients) @item_window.active = false if Graphics.frame_count - $game_party.alchemy_pot[1] >= $game_party.alchemy_pot[2] @help_window.set_text(Vocab::AlchemyPotFormulaFinished) case item when RPG::Item $game_party.gain_item(item.id, 1) when RPG::Weapon $game_party.gain_weapon(item.id, 1) when RPG::Armor $game_party.gain_armor(item.id, 1) end @result_window.refresh(item) $game_party.alchemy_pot = [] @ready = true else @help_window.set_text(Vocab::AlchemyPotFormulaNotFinished) end else @ingredients = [] end Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze @map.dispose if AlchemyPot::MapBG @command_window.dispose @help_window.dispose @item_window.dispose @pot_window.dispose @result_window.dispose @meter.dispose end def update @help_window.update @command_window.update @item_window.update @pot_window.update @result_window.update @meter.update if @command_window.active update_command_selection elsif @item_window.active update_item_selection elsif @ready and @result_window.visible == false if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) @result_window.visible = true @result_window.z = 105 return end elsif @result_window.visible if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) @ingredients = [] @ready = false @result_window.visible = false @item_window.active = true @item_window.refresh @pot_window.refresh return end else if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $scene = Scene_Map.new end end if $game_party.alchemy_pot[1] != nil @meter.refresh($game_party.alchemy_pot[1]) if Graphics.frame_count - $game_party.alchemy_pot[1] >= $game_party.alchemy_pot[2] $scene = Scene_AlchemyPot.new end end end def create_command_window s1 = Vocab::AlchemyPotGo s2 = Vocab::AlchemyPotExit @command_window = Window_Command.new(96, [s1, s2]) @command_window.active = false @command_window.x = 430 @command_window.y = 304 end def update_item_selection if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) if @ingredients == [] $scene = Scene_Map.new else pop = @ingredients.pop case pop when RPG::Item $game_party.gain_item(pop.id, 1) when RPG::Weapon $game_party.gain_weapon(pop.id, 1) when RPG::Armor $game_party.gain_armor(pop.id, 1) end @item_window.refresh @pot_window.refresh(@ingredients) end elsif Input.trigger?(Input::C) if @ingredients.size < AlchemyPot::MaxItem and @item_window.item != nil $game_system.se_play($data_system.decision_se) item = @item_window.item @ingredients.push(item) case item when RPG::Item $game_party.gain_item(item.id, -1) when RPG::Weapon $game_party.gain_weapon(item.id, -1) when RPG::Armor $game_party.gain_armor(item.id, -1) end @item_window.refresh @pot_window.refresh(@ingredients) else $game_system.se_play($data_system.buzzer_se) end elsif Input.trigger?(Input::A) $game_system.se_play($data_system.decision_se) @item_window.active = false @command_window.active = true end end def update_command_selection if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) exit elsif Input.trigger?(Input::C) case @command_window.index when 0 if @ingredients.size > 1 $game_system.se_play($data_system.decision_se) start_alchemy else $game_system.se_play($data_system.buzzer_se) end when 1 $game_system.se_play($data_system.decision_se) exit end elsif Input.trigger?(Input::A) $game_system.se_play($data_system.decision_se) @item_window.active = true @command_window.active = false end end def exit for item in @ingredients case item when RPG::Item $game_party.gain_item(item.id, 1) when RPG::Weapon $game_party.gain_weapon(item.id, 1) when RPG::Armor $game_party.gain_armor(item.id, 1) end end $scene = Scene_Map.new end def start_alchemy for i in AlchemyPot::Formula.keys formula = item_sort(i) ingredients = item_sort(@ingredients) if formula == ingredients @help_window.set_text(Vocab::AlchemyPotRightFormula) $game_party.alchemy_pot[0] = i.clone $game_party.alchemy_pot[1] = Graphics.frame_count $game_party.alchemy_pot[2] = AlchemyPot::Formula[i][1] * Graphics.frame_rate * 60 @command_window.active = false return end end @help_window.set_text(Vocab::AlchemyPotWrongFormula) if AlchemyPot::FailureItem.size > 0 $game_party.alchemy_pot[0] = ["Wrong", ingredients.clone] $game_party.alchemy_pot[1] = Graphics.frame_count $game_party.alchemy_pot[2] = AlchemyPot::FailureTime * Graphics.frame_rate * 60 @command_window.active = false return else for item in @ingredients case item when RPG::Item $game_party.gain_item(item.id, 1) when RPG::Weapon $game_party.gain_weapon(item.id, 1) when RPG::Armor $game_party.gain_armor(item.id, 1) end end @ingredients = [] @item_window.refresh @pot_window.refresh(@ingredients) end end def item_sort(formula) i = []; w = []; a = [] for item in 0...formula.size case formula[item] when RPG::Item i.push(formula[item].id) i.sort! when RPG::Weapon w.push(formula[item].id) w.sort! when RPG::Armor a.push(formula[item].id) a.sort! end end formula = [] for item in i formula.push($data_items[item]) end for item in w formula.push($data_weapons[item]) end for item in a formula.push($data_armors[item]) end return formula end end
#============================================================================== # ** Alchemy Pot #------------------------------------------------------------------------------ # Autor: The Sleeping Leonhart # Version: 1.3 # Release Date: 09/12/2008 #------------------------------------------------------------------------------ # Descrption: # This script make the alchemy pot like the Dragon Quest VIII one. #------------------------------------------------------------------------------ # Version: # 1.0 (06/12/2008): Base Version. # 1.1 (06/12/2008): Added the Failure Item option. # 1.2 (08/12/2008): Fixed a Bug in the item window. # Now you can see the result of recipe immediatly. # 1.3 (09/12/2008): Added a time meter. # Added a filter for the unusable item. #------------------------------------------------------------------------------ # Istruction: # Call the Alchemy Pot with: # $scene = Scene_AlchemyPot.new # Press C to put the item inside the pot. # Press B to remove the last item inserted. # Press A to switch between item and confirm windows. # To customize the script watch the Configuratio and Vocabulary section. #==============================================================================
#============================================================================== # Configuration #============================================================================= module AlchemyPot #=====DON'T TOUCH========================================================= i = load_data("Data/Items.rxdata") w = load_data("Data/Weapons.rxdata") a = load_data("Data/Armors.rxdata") #=========================================================================
#========================================================================= # Formula: Set the items formula. #------------------------------------------------------------------------- # Sintax: # Formula[[iId1, ...]] = [iId2, time] # Parameter: # iId1: id of the ingredients, use i[id] for item, w[id] for weapon, # a[id] for armor. id is the number of the item in the database. # iId2: id of the result item, use i[id] for item, w[id] for weapon, # a[id] for armor. id is the number of the item in the database. # time: number of requested minute to complete the recipe. #========================================================================= Formula = {} Formula[[i[1], i[1]]] = [i[2], 0.02] Formula[[i[1], w[1]]] = [w[2], 0] Formula[[a[1], w[2]]] = [a[2], 4] Formula[[i[1], i[1], i[1]]] = [i[3], 1] Formula[[i[1], i[1], i[1], i[1], i[1]]] = [i[8], 1] #========================================================================= # UnusableItem: Define the item that cannot be putted into the pot #------------------------------------------------------------------------- # Sintax: # UnusableItem = [iId, ...] # Parameter: # iId: id of the ingredients, use i[id] for item, w[id] for weapon, # a[id] for armor. id is the number of the item in the database. #========================================================================= UnusableItem = [i[3], w[5], a[4]] #========================================================================= # MaxItem: Number of maximum item that you can put in the pot. #------------------------------------------------------------------------- # Sintax: # MaxItem = n # Parameter: # n: Number of maximum item that you can put in the pot. #========================================================================= MaxItem = 5 #========================================================================= # FailureItem: Set the item givem if you do a wrong recipe #------------------------------------------------------------------------- # Sintax: # FailureItem = [iId, ...] # Parameter: # iId: id of the result item, use i[id] for item, w[id] for weapon, # a[id] for armor. id is the number of the item in the database, # leave blank if you don't want the failure item. #========================================================================= FailureItem = [i[1], w[4], a[5]] #========================================================================= # FailureTime: Set the time for making the wrong recipe #------------------------------------------------------------------------- # Sintax: # FailureItem = time # Parameter: # time: number of requested minute to complete the recipe. #========================================================================= FailureTime = 1 #========================================================================= # MapBG: Set if the map is visible on the background #------------------------------------------------------------------------- # Sintassi: # MapBG = b # Parametri: # b: true to show the map on the background, false the background is black #========================================================================= MapBG = true #========================================================================= # TimeMeter: Set the time meter image #------------------------------------------------------------------------- # Sintassi: # TimeMeter = [emptymeter, fullmeter] or nil # Parametri: # emptymeter = picture that represent the time meter empty # fullmeter = picture that represent the time meter full # nil = if you put nil the time meter is not used #========================================================================= TimeMeter = ["MeterEmpty", "MeterFull"] end
#============================================================================== # Vocabulary #============================================================================= module Vocab #Confirm Button AlchemyPotGo = "Make" #Exit Button AlchemyPotExit = "Exit" #Correct Formula AlchemyPotRightFormula = "I think that this one can work!" #Incorrect Formula AlchemyPotWrongFormula = "I don't think that this one work!" #Recipe Ready AlchemyPotFormulaFinished = "The recipe is ready!" #Recipe not ready AlchemyPotFormulaNotFinished = "The recipe is not ready yet!" #Item obtained AlchemyPotObtained = "You have obtained:" end
class Game_Party attr_accessor :alchemy_pot alias tslalchemypot_gameparty_initialize initialize def initialize tslalchemypot_gameparty_initialize @alchemy_pot = [] end end
class Window_AlchemyPotItem < Window_Selectable def initialize super(32, 96, 312, 312) @column_max = 10 self.index = 0 refresh end def item return @data[self.index] end def enable?(item) return $game_party.item_can_use?(item) end def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] for item in $data_items if $game_party.item_number(item.id) > 0 and item != nil @data.push(item) if check(item) end end for item in $data_weapons if $game_party.weapon_number(item.id) > 0 and item != nil @data.push(item) if check(item) end end for item in $data_armors if $game_party.armor_number(item.id) > 0 and item != nil @data.push(item) if check(item) end end @item_max = @data.size @row_max = @data.size / 10 if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 28) for i in 0...@item_max draw_item(i) end end end def draw_item(index) item = @data[index] case item when RPG::Item number = $game_party.item_number(item.id) when RPG::Weapon number = $game_party.weapon_number(item.id) when RPG::Armor number = $game_party.armor_number(item.id) end x = index % @column_max * 28 y = index / @column_max * 28 rect = Rect.new(x, y, 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(item.icon_name) self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24)) self.contents.font.size = 12 self.contents.draw_text(12 + x, 8 + y, 24, 24, number.to_s) end def update_help @help_window.set_text(item == nil ? "" : item.name) end def page_row_max return (self.height - 32) / 28 end def top_row return self.oy / 28 end def top_row=(row) super self.oy = row * 28 end def update_cursor_rect super x = @index % @column_max * 28 y = @index / @column_max * 28 - self.oy self.cursor_rect.set(x, y, 24, 24) end def check(item) for i in AlchemyPot::UnusableItem if i.id == item.id and i.class == item.class return false end end return true end end
class Window_AlchemyPotPot < Window_Base def initialize super(454, 96, 28 + 32, 28 * AlchemyPot::MaxItem + 32) self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh(pot = []) self.contents.clear @data = pot.clone @data.push(nil) if @data == [] @item_max = @data.size for i in 0...@item_max draw_item(i) end end def draw_item(index) item = @data[index] if item != nil y = index * 28 bitmap = RPG::Cache.icon(item.icon_name) self.contents.blt(0, y, bitmap, Rect.new(0, 0, 24, 24)) end end end
class Window_PotTimeMeter < Window_Base def initialize(a = 0) super(420, 400, 192, 64) self.contents = Bitmap.new(width - 32, height - 32) self.opacity = 0 refresh(a) end def refresh(a) if AlchemyPot::TimeMeter != nil self.contents.clear a = 0 if a == nil b = $game_party.alchemy_pot[2] b = (Graphics.frame_count - a) * 100 if b == nil draw_graphical_bar(0, 0, AlchemyPot::TimeMeter[0], AlchemyPot::TimeMeter[1], Graphics.frame_count-a, b) end end end
class Scene_AlchemyPot def main @map = Spriteset_Map.new if AlchemyPot::MapBG create_command_window @help_window = Window_Help.new @item_window = Window_AlchemyPotItem.new @item_window.help_window = @help_window @pot_window = Window_AlchemyPotPot.new @result_window = Window_AlchemyPotResult.new @result_window.visible = false @meter = Window_PotTimeMeter.new($game_party.alchemy_pot[1]) @ready = false if $game_party.alchemy_pot != [] if $game_party.alchemy_pot[0][0] == "Wrong" @ingredients = $game_party.alchemy_pot[0][1].clone item = AlchemyPot::FailureItem[rand(AlchemyPot::FailureItem.size)] else @ingredients = $game_party.alchemy_pot[0].clone item = AlchemyPot::Formula[$game_party.alchemy_pot[0]][0] end @pot_window.refresh(@ingredients) @item_window.active = false if Graphics.frame_count - $game_party.alchemy_pot[1] >= $game_party.alchemy_pot[2] @help_window.set_text(Vocab::AlchemyPotFormulaFinished) case item when RPG::Item $game_party.gain_item(item.id, 1) when RPG::Weapon $game_party.gain_weapon(item.id, 1) when RPG::Armor $game_party.gain_armor(item.id, 1) end @result_window.refresh(item) $game_party.alchemy_pot = [] @ready = true else @help_window.set_text(Vocab::AlchemyPotFormulaNotFinished) end else @ingredients = [] end Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze @map.dispose if AlchemyPot::MapBG @command_window.dispose @help_window.dispose @item_window.dispose @pot_window.dispose @result_window.dispose @meter.dispose end def update @help_window.update @command_window.update @item_window.update @pot_window.update @result_window.update @meter.update if @command_window.active update_command_selection elsif @item_window.active update_item_selection elsif @ready and @result_window.visible == false if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) @result_window.visible = true @result_window.z = 105 return end elsif @result_window.visible if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) @ingredients = [] @ready = false @result_window.visible = false @item_window.active = true @item_window.refresh @pot_window.refresh return end else if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $scene = Scene_Map.new end end if $game_party.alchemy_pot[1] != nil @meter.refresh($game_party.alchemy_pot[1]) if Graphics.frame_count - $game_party.alchemy_pot[1] >= $game_party.alchemy_pot[2] $scene = Scene_AlchemyPot.new end end end def create_command_window s1 = Vocab::AlchemyPotGo s2 = Vocab::AlchemyPotExit @command_window = Window_Command.new(96, [s1, s2]) @command_window.active = false @command_window.x = 430 @command_window.y = 304 end def update_item_selection if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) if @ingredients == [] $scene = Scene_Map.new else pop = @ingredients.pop case pop when RPG::Item $game_party.gain_item(pop.id, 1) when RPG::Weapon $game_party.gain_weapon(pop.id, 1) when RPG::Armor $game_party.gain_armor(pop.id, 1) end @item_window.refresh @pot_window.refresh(@ingredients) end elsif Input.trigger?(Input::C) if @ingredients.size < AlchemyPot::MaxItem and @item_window.item != nil $game_system.se_play($data_system.decision_se) item = @item_window.item @ingredients.push(item) case item when RPG::Item $game_party.gain_item(item.id, -1) when RPG::Weapon $game_party.gain_weapon(item.id, -1) when RPG::Armor $game_party.gain_armor(item.id, -1) end @item_window.refresh @pot_window.refresh(@ingredients) else $game_system.se_play($data_system.buzzer_se) end elsif Input.trigger?(Input::A) $game_system.se_play($data_system.decision_se) @item_window.active = false @command_window.active = true end end def update_command_selection if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) exit elsif Input.trigger?(Input::C) case @command_window.index when 0 if @ingredients.size > 1 $game_system.se_play($data_system.decision_se) start_alchemy else $game_system.se_play($data_system.buzzer_se) end when 1 $game_system.se_play($data_system.decision_se) exit end elsif Input.trigger?(Input::A) $game_system.se_play($data_system.decision_se) @item_window.active = true @command_window.active = false end end def exit for item in @ingredients case item when RPG::Item $game_party.gain_item(item.id, 1) when RPG::Weapon $game_party.gain_weapon(item.id, 1) when RPG::Armor $game_party.gain_armor(item.id, 1) end end $scene = Scene_Map.new end def start_alchemy for i in AlchemyPot::Formula.keys formula = item_sort(i) ingredients = item_sort(@ingredients) if formula == ingredients @help_window.set_text(Vocab::AlchemyPotRightFormula) $game_party.alchemy_pot[0] = i.clone $game_party.alchemy_pot[1] = Graphics.frame_count $game_party.alchemy_pot[2] = AlchemyPot::Formula[i][1] * Graphics.frame_rate * 60 @command_window.active = false return end end @help_window.set_text(Vocab::AlchemyPotWrongFormula) if AlchemyPot::FailureItem.size > 0 $game_party.alchemy_pot[0] = ["Wrong", ingredients.clone] $game_party.alchemy_pot[1] = Graphics.frame_count $game_party.alchemy_pot[2] = AlchemyPot::FailureTime * Graphics.frame_rate * 60 @command_window.active = false return else for item in @ingredients case item when RPG::Item $game_party.gain_item(item.id, 1) when RPG::Weapon $game_party.gain_weapon(item.id, 1) when RPG::Armor $game_party.gain_armor(item.id, 1) end end @ingredients = [] @item_window.refresh @pot_window.refresh(@ingredients) end end def item_sort(formula) i = []; w = []; a = [] for item in 0...formula.size case formula[item] when RPG::Item i.push(formula[item].id) i.sort! when RPG::Weapon w.push(formula[item].id) w.sort! when RPG::Armor a.push(formula[item].id) a.sort! end end formula = [] for item in i formula.push($data_items[item]) end for item in w formula.push($data_weapons[item]) end for item in a formula.push($data_armors[item]) end return formula end end
Users browsing this forum: No registered users and 0 guests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum