Alchemy Pot
Version: 1.3
Introduction
Have you ever desired to have in your game the alchemy pot like in Dragon Quest VIII?
What did you say? No??? Oh well close this topic....
For the one who don't know what is it the alchemy pot i can try to explain it;
The alchemy pot is a pot(really?) in which you can put items to combine it in a new one.
Features
You can create Recipe with 2 or more items and set the time required to complete it.
The maximum item that you can put in the pot is configurable.
Demo
Xp Demo
VX Demo
Screenshots

Script
Instructions
Put the script above main.
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
Compatibility
Don't Know, i've aliased everything, so it should be combatible with any script.
Credits and Thanks
Square Enix for making Dragon Quest VIII
Terms and Conditions
Free with credit for amatorial project, if you want use it in a commercial project PM me.
Sorry for the bad english.
Version: 1.3
Introduction
Have you ever desired to have in your game the alchemy pot like in Dragon Quest VIII?
What did you say? No??? Oh well close this topic....
For the one who don't know what is it the alchemy pot i can try to explain it;
The alchemy pot is a pot(really?) in which you can put items to combine it in a new one.
Features
You can create Recipe with 2 or more items and set the time required to complete it.
The maximum item that you can put in the pot is configurable.
Demo
Xp Demo
VX Demo
Screenshots

Script
XP
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_Base
- def draw_graphical_bar(x, y, barravuota, barrapiena, corrente, max)
- barra_vuota = Bitmap.new("Graphics/Pictures/"+barravuota)
- barra_piena = Bitmap.new("Graphics/Pictures/"+barrapiena)
- taglio = corrente.to_f / max.to_f
- cwp = barra_piena.width
- cwv = barra_vuota.width
- chp = barra_piena.height
- chv = barra_vuota.height
- taglio = taglio*cwp
- src_rect = Rect.new(0, 0, taglio, chp)
- self.contents.blt(32+x-cwp/4, 18+y-chp/2, barra_piena, src_rect)
- src_rect = Rect.new(taglio, 0, cwv-taglio, chv)
- self.contents.blt(32+x-cwv/4+taglio, 18+y-chv/2, barra_vuota, src_rect)
- 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_AlchemyPotResult < Window_Base
- def initialize
- super(0, 192, 320, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.width = [self.contents.text_size(Vocab::AlchemyPotObtained).width + 240, 640].min
- self.contents = Bitmap.new(width - 32, height - 32)
- self.x = 272 - self.width / 2
- refresh
- endÂ
- def refresh(item = nil)
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.draw_text(0, 4, self.width - 64, 24, Vocab::AlchemyPotObtained)
- draw_item_name(item, self.contents.text_size(Vocab::AlchemyPotObtained).width + 2, 0)
- 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
Expand to see the code.
VX
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 (07/10/2008): Base Version.
- # 1.1 (06/12/2008): Added the Failure Item option.
- # 1.2 (08/12/2008): 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.rvdata")
- w = load_data("Data/Weapons.rvdata")
- a = load_data("Data/Armors.rvdata")
- #=========================================================================
- #=========================================================================
- # Formula: Set the items formula.
- #-------------------------------------------------------------------------
- # Sintassi:
- # Formula[[iId1, ...]] = [iId2, time]
- # Parametri:
- # 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], 1]
- Formula[[i[1], w[1]]] = [w[2], 2]
- 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.
- #-------------------------------------------------------------------------
- # Sintassi:
- # MaxItem = n
- # Parametri:
- # 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
- #-------------------------------------------------------------------------
- # Sintassi:
- # FailureItem = [iId, ...]
- # Parametri:
- # 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
- #-------------------------------------------------------------------------
- # Sintassi:
- # FailureItem = time
- # Parametri:
- # time: number of requested minute to complete the recipe.
- #=========================================================================
- FailureTime = 1
- #=========================================================================
- # 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_Base
- def draw_graphical_bar(x, y, barravuota, barrapiena, corrente, max)
- barra_vuota = Bitmap.new("Graphics/Pictures/"+barravuota)
- barra_piena = Bitmap.new("Graphics/Pictures/"+barrapiena)
- taglio = corrente.to_f / max.to_f
- cwp = barra_piena.width
- cwv = barra_vuota.width
- chp = barra_piena.height
- chv = barra_vuota.height
- taglio = taglio*cwp
- src_rect = Rect.new(0, 0, taglio, chp)
- self.contents.blt(32+x-cwp/4, 18+y-chp/2, barra_piena, src_rect)
- src_rect = Rect.new(taglio, 0, cwv-taglio, chv)
- self.contents.blt(32+x-cwv/4+taglio, 18+y-chv/2, barra_vuota, src_rect)
- end
- end
- class Window_AlchemyPotItem < Window_Selectable
- def initialize
- super(32, 80, 292, 292)
- @column_max = 10
- self.index = 0
- refresh
- endÂ
- def item
- return @data[self.index]
- end
- def include?(item)
- return false if item == nil
- if $game_temp.in_battle
- return false unless item.is_a?(RPG::Item)
- end
- return true
- end
- def item_rect(index)
- rect = Rect.new(0, 0, 0, 0)
- rect.width = 24
- rect.height = 24
- rect.x = index % @column_max * 26
- rect.y = index / @column_max * 26
- return rect
- endÂ
- def enable?(item)
- return $game_party.item_can_use?(item)
- end
- def refresh
- @data = []
- for item in $game_party.items
- next unless include?(item)
- @data.push(item) if check(item)
- end
- @data.push(nil) if include?(nil)
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- endÂ
- def draw_item(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- item = @data[index]
- if item != nil
- number = $game_party.item_number(item)
- x = index % @column_max * 26
- y = index / @column_max * 26
- draw_icon(item.icon_index, x, y)
- self.contents.font.size = 12
- self.contents.draw_text(10 + x, 6 + y, 24, 24, number.to_s)
- end
- endÂ
- def update_help
- @help_window.set_text(item == nil ? "" : item.name)
- 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, 80, 26 + 32, 26 * AlchemyPot::MaxItem + 32)
- refresh
- endÂ
- def refresh(pot = [])
- self.contents.clear
- @data = pot.clone
- @data.push(nil) if @data == []
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- endÂ
- def draw_item(index)
- item = @data[index]
- if item != nil
- y = index * 26
- draw_icon(item.icon_index, 0, y)
- end
- endÂ
- end
- class Window_AlchemyPotResult < Window_Base
- def initialize
- super(0, 180, 272, WLH + 32)
- self.width = [self.contents.text_size(Vocab::AlchemyPotObtained).width + 192, 544].min
- self.x = 272 - self.width / 2
- create_contents
- refresh
- end
- def refresh(item = nil)
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.draw_text(0, 0, self.width - 40, WLH, Vocab::AlchemyPotObtained)
- draw_item_name(item, self.contents.text_size(Vocab::AlchemyPotObtained).width + 2, 0)
- end
- end
- class Window_PotTimeMeter < Window_Base
- def initialize(a = 0)
- super(180, 360, 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 < Scene_Base
- def start
- super
- create_menu_background
- 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)
- $game_party.gain_item(item, 1)
- @result_window.refresh(item)
- $game_party.alchemy_pot = []
- @ready = true
- else
- @help_window.set_text(Vocab::AlchemyPotFormulaNotFinished)
- end
- else
- @ingredients = []
- end
- end
- def terminate
- super
- dispose_menu_background
- dispose_command_window
- @help_window.dispose
- @item_window.dispose
- @pot_window.dispose
- @meter.dispose
- end
- def update
- super
- update_menu_background
- @help_window.update
- @command_window.update
- @item_window.update
- @pot_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)
- Sound.play_decision
- @result_window.visible = true
- return
- end
- elsif @result_window.visible
- if Input.trigger?(Input::C)
- Sound.play_decision
- @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)
- Sound.play_decision
- $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 dispose_command_window
- @command_window.dispose
- endÂ
- def update_item_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- if @ingredients == []
- $scene = Scene_Map.new
- else
- $game_party.gain_item(@ingredients.pop, 1)
- @item_window.refresh
- @pot_window.refresh(@ingredients)
- end
- elsif Input.trigger?(Input::C)
- if @ingredients.size < AlchemyPot::MaxItem and @item_window.item != nil
- Sound.play_decision
- item = @item_window.item
- @ingredients.push(item)
- $game_party.gain_item(item, -1)
- @item_window.refresh
- @pot_window.refresh(@ingredients)
- else
- Sound.play_buzzer
- end
- elsif Input.trigger?(Input::A)
- Sound.play_decision
- @item_window.active = false
- @command_window.active = true
- end
- endÂ
- def update_command_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- exit
- elsif Input.trigger?(Input::C)
- case @command_window.index
- when 0
- if @ingredients.size > 1
- Sound.play_decision
- start_alchemy
- else
- Sound.play_buzzer
- end
- when 1
- Sound.play_decision
- exit
- end
- elsif Input.trigger?(Input::A)
- Sound.play_decision
- @item_window.active = true
- @command_window.active = false
- end
- endÂ
- def exit
- for item in @ingredients
- $game_party.gain_item(item, 1)
- 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
- $game_party.gain_item(item, 1)
- 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
Expand to see the code.
Instructions
Put the script above main.
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
Compatibility
Don't Know, i've aliased everything, so it should be combatible with any script.
Credits and Thanks
Square Enix for making Dragon Quest VIII
Terms and Conditions
Free with credit for amatorial project, if you want use it in a commercial project PM me.
Sorry for the bad english.