06-17-2008, 01:00 PM
TDS Alchemy
Introduction
This script allows you to create items by using alchemic methods and other items as the base for their creation.
Features
The script allows you to:
* Create new items using other items.
* Learn and forget alchemic Methods.
* Add a price to alchemic methods
Script
Instructions
This script requires basic knowledge on how to input information inside a Hash and array.
To make new Alchemic Methods which are basically recepies that list up the items needed in order to make the new object, you will need to add into the ALCHEMY_METHODS constant.
The array to make a new alchemic method is as follows:
* These 3 arrays must match each other in the order they are placed.
-Kind of items are defined by: Item" "Weapon" "Armor" with ""
Example:
If you would like to add a price to the alchemic method simply add into the ALCHEMY_METHODS_PRICES constant hash the name of the Alchemic Method and it's price.
Example:
To learn any alchemic method you may use this in a script call.
Example
To forget any alchemic method is basically the same as above but with this script call.
To call the script from an event use this script call.
Compatibility
None that I know of
Credits and Thanks
Myself TDS
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
Introduction
This script allows you to create items by using alchemic methods and other items as the base for their creation.
Features
The script allows you to:
* Create new items using other items.
* Learn and forget alchemic Methods.
* Add a price to alchemic methods
Script
Code:
#==============================================================================
# ** TDS Alchemy
# Version: 1.5
#------------------------------------------------------------------------------
# This script allows for the creation of objects trough a menu using other
# objects and alchemic methods as the base for their creation.
#==============================================================================
# WARNING:
#
# Do not release, distribute or change my work without my expressed written
# consent, doing so violates the terms of use of this work.
#
# * Not Knowing English or understanding these terms will not excuse you in any
# way from the consequenses.
#
# * This applies to all of my work whether they have thiss notice or not.
#
# Contact Email: Sephirothtds@hotmail.com
#==============================================================================
#--------------------------------------------------------------------------
# * Constants
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# ALCHEMY_METHODS = [
# ["Method Name", [ID of required items], [Quantity of items needed],
# [Type of items needed], activated flag, type of reward item,
# ID of item rewarded, Quantity of items rewarded],
#
# [...]
#
# ]
#
# Type of Item:
# "Item" = Items
# "Weapon" = Weapons
# "Armor" = Armor
#--------------------------------------------------------------------------
ALCHEMY_METHODS = [
["High potion", [1], [2], ["Item"], true, "Item" , 2, 5],
["Full potion", [1, 2], [2, 2], ["Item", "Item"], false, "Item", 3, 1],
["Excalibur",[11,2,6],[10,1,1 ],["Item","Weapon","Weapon"],false,"Weapon",30,1],
["Dragon Shield",[12,2,5],[10,1,1],["Item","Armor","Armor"],false,"Armor",6,1],
]
#--------------------------------------------------------------------------
# ALCHEMY_METHODS_PRICES = {
# "Method Name" => price,
# "..." => ...,
#
# }
#--------------------------------------------------------------------------
ALCHEMY_METHODS_PRICES = {
"Full potion" => 100
}
#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
# This class performs the save and load screen processing.
#==============================================================================
class Scene_File < Scene_Base
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
alias tds_alchemy_read_save_data read_save_data
def read_save_data(file)
tds_alchemy_read_save_data(file)
# Set alchemy values
$game_system.set_alchemy_values
end
end
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles system-related data. Also manages vehicles and BGM, etc.
# The instance of this class is referenced by .
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :alchemy_method_activated # Methods activated flag
attr_accessor :alchemy_method_requirements # Methods requirement data
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias tds_alchemy_game_system_initialize initialize
def initialize
@alchemy_method_activated = {}
@alchemy_method_requirements = {}
# Set first alchemy values
set_alchemy_values
tds_alchemy_game_system_initialize
end
#--------------------------------------------------------------------------
# * Set Alchemy Values
#--------------------------------------------------------------------------
def set_alchemy_values
for i in 0...ALCHEMY_METHODS.size
next if @alchemy_method_activated.has_key?(ALCHEMY_METHODS[i][0].to_s)
@alchemy_method_activated.update({ALCHEMY_METHODS[i][0].to_s => ALCHEMY_METHODS[i][4]})
end
for i in 0...ALCHEMY_METHODS.size
next if @alchemy_method_requirements.has_key?(ALCHEMY_METHODS[i][0].to_s)
@alchemy_method_requirements.update({ALCHEMY_METHODS[i][0].to_s => ALCHEMY_METHODS[i][1..7] })
end
end
#--------------------------------------------------------------------------
# * Learn Alchemic Method
#--------------------------------------------------------------------------
def learn_alchemy_method(method)
@alchemy_method_activated[method] = true
end
#--------------------------------------------------------------------------
# * Forget Alchemic Method
#--------------------------------------------------------------------------
def forget_alchemy_method(method)
@alchemy_method_activated[method] = false
end
end
#==============================================================================
# ** Scene_Alchemy
#------------------------------------------------------------------------------
# This class performs the alchemy menu screen processing.
#==============================================================================
class Scene_Alchemy < Scene_Base
#--------------------------------------------------------------------------
# * Object Initialization
# from_map : flag verifying where the script was called
# return_index : return_index if returning to the main menu
#--------------------------------------------------------------------------
def initialize(from_map=true, return_index = 0)
@from_map = from_map
@return_index = return_index
@old_index = -1
@disable_index = []
@type = "Requirements"
@creation_phase = nil
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_command_windows
# Create help window
@help_window = Window_Help.new
@help_window.set_text("Choose an alchemic method to create an item", 1)
# Create Recipe Header Window
@recipe_title_window = Window_Base.new(0, 56, 210, 58)
@recipe_title_window.contents = Bitmap.new(210-32,56-32)
@recipe_title_window.contents.font.color = @recipe_title_window.text_color(16)
@recipe_title_window.contents.draw_text(0,0,210-32,56-32, "Alchemy Methods",1)
# Creates Recipe status window
@recipe_status_window = Window_Result_Item_Status.new
@recipe_status_window.refresh(@alchemy_methods[@recipe_command_window.index], @type)
# Creates window status requirements
@window_status_requirements = Window_Item_Status_Requirements.new
@window_status_requirements.refresh(@alchemy_methods[@recipe_command_window.index], @type)
# Creates Item Header Window
@item_name_header = Window_Base.new(210, 146, 334, 56)
@item_name_header.contents = Bitmap.new(334-32,56-32)
@item_name_header.contents.font.color = @item_name_header.text_color(16)
header = "Objects Needed" + " " + "Have" + " " + "Need"
@item_name_header.contents.draw_text(0,0,334-32,56-32, header,2)
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@recipe_command_window.dispose
@recipe_title_window.dispose
@help_window.dispose
@recipe_status_window.dummy_dispose
@recipe_status_window.dispose
@window_status_requirements.dispose
@item_name_header.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
@recipe_command_window.update
@yes_no_command_window.update
if @old_index != @recipe_command_window.index
if @yes_no_command_window.active == false
@recipe_status_window.refresh(@alchemy_methods[@recipe_command_window.index], @type)
end
set_windows_text
@window_status_requirements.refresh(@alchemy_methods[@recipe_command_window.index], @type)
@old_index = @recipe_command_window.index
@old_index %= @alchemy_methods.size
end
if Input.trigger?(Input::CTRL)
@old_index = -1
if @type == "Requirements"
@type = "Status"
elsif @type == "Status"
@type = "Requirements"
end
end
if @creation_phase != nil
case @creation_phase
when 1
update_object_creation
end
end
if @recipe_command_window.active
update_command_selection
end
end
#--------------------------------------------------------------------------
# * Update Object Creation
#--------------------------------------------------------------------------
def update_object_creation
if Input.trigger?(Input::B)
Sound.play_cancel
@creation_phase = nil
@recipe_status_window.width = 334
@recipe_status_window.contents = Bitmap.new(334-32, 90-32)
@recipe_status_window.refresh(@alchemy_methods[@recipe_command_window.index], @type,nil)
@recipe_status_window.active = false
close_yes_no_command_window
@yes_no_command_window.active = false
@recipe_command_window.active = true
# Input update
Input.update
@old_index -= 1
@old_index %= @alchemy_methods.size
return
end
if Input.trigger?(Input::C)
case @yes_no_command_window.index
when 0
Audio.se_play("Audio/SE/Up", 100, 100)
alchemic_creation_process(@alchemy_methods[@recipe_command_window.index])
@creation_phase = nil
@recipe_status_window.width = 334
@recipe_status_window.contents = Bitmap.new(334-32, 90-32)
@recipe_status_window.refresh(@alchemy_methods[@recipe_command_window.index], @type,nil)
@recipe_status_window.active = false
close_yes_no_command_window
@yes_no_command_window.active = false
@recipe_command_window.active = true
for i in 0...@alchemy_methods.size
@disable_index.uniq!
@disable_index.sort!
if can_perform_alchemy(@alchemy_methods[i]) == false
@recipe_command_window.draw_item(i, false)
@disable_index << i
else
@disable_index.delete(i)
end
end
# Input update
Input.update
object_type = $game_system.alchemy_method_requirements[@alchemy_methods[@recipe_command_window.index]]
case object_type[4]
when "Item"
alchemic_object = $data_items[object_type[5]]
when "Weapon"
alchemic_object = $data_weapons[object_type[5]]
when "Armor"
alchemic_object = $data_armors[object_type[5]]
end
@help_window.set_text(alchemic_object.name.to_s + " Created", 1)
@recipe_status_window.refresh(@alchemy_methods[@recipe_command_window.index], @type)
@window_status_requirements.refresh(@alchemy_methods[@recipe_command_window.index], @type)
return
when 1
Sound.play_cancel
@creation_phase = nil
@recipe_status_window.width = 334
@recipe_status_window.contents = Bitmap.new(334-32, 90-32)
@recipe_status_window.refresh(@alchemy_methods[@recipe_command_window.index], @type,nil)
@recipe_status_window.active = false
close_yes_no_command_window
@yes_no_command_window.active = false
@recipe_command_window.active = true
# Input update
Input.update
@old_index -= 1
@old_index %= @alchemy_methods.size
return
end
end
end
end
#--------------------------------------------------------------------------
# * Open YES/NO Command Window
#--------------------------------------------------------------------------
def open_yes_no_command_window
@yes_no_command_window.open
begin
@yes_no_command_window.update
Graphics.update
end until @yes_no_command_window.openness == 255
end
#--------------------------------------------------------------------------
# * Close YES/NO Command Window
#--------------------------------------------------------------------------
def close_yes_no_command_window
@yes_no_command_window.close
begin
@yes_no_command_window.update
Graphics.update
end until @yes_no_command_window.openness == 0
end
#--------------------------------------------------------------------------
# * Set Windows Text
#--------------------------------------------------------------------------
def set_windows_text
@item_name_header.contents.clear
object_type = $game_system.alchemy_method_requirements[@alchemy_methods[@recipe_command_window.index]]
case object_type[4]
when "Item"
alchemic_object = $data_items[object_type[5]]
when "Weapon"
alchemic_object = $data_weapons[object_type[5]]
when "Armor"
alchemic_object = $data_armors[object_type[5]]
end
if @type == "Requirements"
header = "Objects Needed" + " " + "Have" + " " + "Need"
@item_name_header.contents.draw_text(0,0,334-32,56-32, header,2)
if @yes_no_command_window.active == false
@help_window.set_text("Choose an alchemic method to create an item", 1)
end
else
if @yes_no_command_window.active == false
@help_window.set_text(alchemic_object.description.capitalize.to_s, 1)
end
header = "Object information"
@item_name_header.contents.draw_text(0,0,334-32,56-32, header,1)
end
end
#--------------------------------------------------------------------------
# * Create Command Windows
#--------------------------------------------------------------------------
def create_command_windows
# Array to hold the command names
@alchemy_methods = []
for i in 0...ALCHEMY_METHODS.size
next if $game_system.alchemy_method_activated[ALCHEMY_METHODS[i][0].to_s] == false
@alchemy_methods.push(ALCHEMY_METHODS[i][0])
end
# Creates recipes command window
@recipe_command_window = Window_Command.new(210, @alchemy_methods)
@recipe_command_window.y = 114
@recipe_command_window.height = 302# 304
# Creates YES/NO window
@yes_no_command_window = Window_Command.new(72, ["Yes", "No"])
@yes_no_command_window.height += 10
@yes_no_command_window.y = 56
@yes_no_command_window.x = 472
@yes_no_command_window.openness = 0
@yes_no_command_window.active = false
@yes_no_command_window.index = 1
for i in 0...@alchemy_methods.size
if can_perform_alchemy(@alchemy_methods[i]) == false
@recipe_command_window.draw_item(i, false)
@disable_index << i
end
end
end
#--------------------------------------------------------------------------
# * Alchemic Creation Process
# method : Name of alchemic method to be processed
#--------------------------------------------------------------------------
def alchemic_creation_process(method = nil)
alchemy_result = $game_system.alchemy_method_requirements[method]
object_ids = []
for i in 0...alchemy_result[0].size
next if alchemy_result[0][i] == nil
case alchemy_result[2][i]
when "Item"
object_ids.push($data_items[alchemy_result[0][i]])
when "Weapon"
object_ids.push($data_weapons[alchemy_result[0][i]])
when "Armor"
object_ids.push($data_armors[alchemy_result[0][i]])
end
end
for i in 0...object_ids.size
$game_party.lose_item(object_ids[i], alchemy_result[1][i])
end
if ALCHEMY_METHODS_PRICES[method] != nil
$game_party.lose_gold(ALCHEMY_METHODS_PRICES[method])
end
case alchemy_result[4]
when "Item"
$game_party.gain_item($data_items[alchemy_result[5]], alchemy_result[6])
when "Weapon"
$game_party.gain_item($data_weapons[alchemy_result[5]], alchemy_result[6])
when "Armor"
$game_party.gain_item($data_armors[alchemy_result[5]], alchemy_result[6])
end
end
#--------------------------------------------------------------------------
# * Can Perform Alchemy
# method : Name of alchemic method to be verified
#--------------------------------------------------------------------------
def can_perform_alchemy(method = nil)
alchemy_result = $game_system.alchemy_method_requirements[method]
object_ids = []
for i in 0...alchemy_result[0].size
next if alchemy_result[0][i] == nil
case alchemy_result[2][i]
when "Item"
object_ids.push($data_items[alchemy_result[0][i]])
object_quantity = $data_items[alchemy_result[5]]
when "Weapon"
object_ids.push($data_weapons[alchemy_result[0][i]])
object_quantity = $data_weapons[alchemy_result[5]]
when "Armor"
object_ids.push($data_armors[alchemy_result[0][i]])
object_quantity = $data_armors[alchemy_result[5]]
end
end
if $game_party.item_number(object_quantity) >= 99
return false
break
end
if ALCHEMY_METHODS_PRICES[method] != nil
if $game_party.gold < ALCHEMY_METHODS_PRICES[method]
return false
break
end
end
for i in 0...object_ids.size
if $game_party.item_number(object_ids[i]) < alchemy_result[1][i]
return false
break
end
if !$game_party.has_item?(object_ids[i])
return false
break
end
end
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_command_selection
if Input.repeat?(Input::B)
Sound.play_cancel
if @from_map
$scene = Scene_Map.new
else
$scene = Scene_Menu.new(@return_index)
end
end
if Input.trigger?(Input::C)
if @disable_index.include?(@recipe_command_window.index)
Sound.play_buzzer
return
end
Sound.play_decision
@creation_phase = 1
@recipe_status_window.width = 262
@recipe_status_window.contents = Bitmap.new(262-32, 90-32)
@recipe_status_window.refresh(@alchemy_methods[@recipe_command_window.index], @type,true)
@help_window.set_text("Choose whether or not to create the object", 1)
@yes_no_command_window.index = 1
open_yes_no_command_window
@yes_no_command_window.active = true
@recipe_command_window.active = false
return
end
end
#==============================================================================
# ** Window_Result_Item_Status
#------------------------------------------------------------------------------
# This window displays information about the alchemic method.
#==============================================================================
class Window_Result_Item_Status < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(210, 56, 334, 90)
@dummy_square_window = Window_Base.new(self.x + 12, self.y + 12, 36, 36)
@dummy_square_window.back_opacity = 0
refresh
end
#--------------------------------------------------------------------------
# * Dummy Dispose
#--------------------------------------------------------------------------
def dummy_dispose
@dummy_square_window.dispose
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(alchemic_result = nil, type = nil, object_creation = nil)
self.contents.clear
return if $game_system.alchemy_method_requirements[alchemic_result] == nil
@alchemy_result = $game_system.alchemy_method_requirements[alchemic_result]
case @alchemy_result[4]
when "Item"
alchemic_object = $data_items[@alchemy_result[5]]
when "Weapon"
alchemic_object = $data_weapons[@alchemy_result[5]]
when "Armor"
alchemic_object = $data_armors[@alchemy_result[5]]
end
draw_icon(alchemic_object.icon_index, 3, 2, enabled = true)
self.contents.draw_text(40, -3, 190, 32, alchemic_object.name.to_s)
self.contents.draw_text(280, -3, 200, 32, @alchemy_result[6].to_s)
if object_creation != true
self.contents.font.color = system_color
self.contents.draw_text(230, -3, 200, 32, "Qty:")
if type == "Requirements"
self.contents.draw_text(0, 30, 318, 32, "Press the Ctrl key for object details")
else
self.contents.draw_text(0, 30, 318, 32, "Press the Ctrl key for requirements")
end
else
if ALCHEMY_METHODS_PRICES[alchemic_result] != nil
self.contents.draw_text(0, 30, 318, 32, "Creation Price: " +
ALCHEMY_METHODS_PRICES[alchemic_result].to_s + Vocab::gold.to_s)
else
self.contents.draw_text(0, 30, 235, 32, "Create " + alchemic_object.name.to_s + "?")
end
end
self.contents.font.color = normal_color
end
end
#==============================================================================
# ** Window_Item_Status_Requirements
#------------------------------------------------------------------------------
# This window displays the requirements for alchemic methods
#==============================================================================
class Window_Item_Status_Requirements < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(210, 202, 334, 214)
self.opacity = 0
self.z += 200
@dummy_window_full_back = Window_Base.new(210, 202, 334, 214)
@dummy_window_required_names = Window_Base.new(210, 202, 200, 214)
@dummy_window_required_have = Window_Base.new(410, 202, 67, 214)
@dummy_window_required_need = Window_Base.new(477, 202, 67, 214)
@dummy_window_required_names.visible = false
@dummy_window_required_have.visible = false
@dummy_window_required_need.visible = false
refresh
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
self.contents.dispose
@dummy_window_full_back.dispose
@dummy_window_required_names.dispose
@dummy_window_required_have.dispose
@dummy_window_required_need.dispose
end
#--------------------------------------------------------------------------
# * Refresh
# alchemic_result : Alchemic method name
# type : type of display "Status" or others
#--------------------------------------------------------------------------
def refresh(alchemic_result = nil, type = nil)
self.contents.clear
return if $game_system.alchemy_method_requirements[alchemic_result] == nil
# Value for alchemy items
alchemy_result = $game_system.alchemy_method_requirements[alchemic_result]
if type == "Status"
@dummy_window_full_back.visible = true
@dummy_window_required_names.visible = false
@dummy_window_required_have.visible = false
@dummy_window_required_need.visible = false
case alchemy_result[4]
when "Item"
alchemic_object = $data_items[alchemy_result[5]]
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 200, 32, "Posses:")
self.contents.draw_text(0, 28, 200, 32, "Recovery Effects:")
self.contents.draw_text(10, 51, 200, 32, "HP Rate:" )
self.contents.draw_text(10, 71, 200, 32, "HP Recovery:" )
self.contents.draw_text(10, 91, 200, 32, "SP Rate:" )
self.contents.draw_text(10, 111, 200, 32, "SP Recovery:" )
self.contents.draw_text(0, 133, 200, 32, "Damage Effects:")
self.contents.draw_text(0, 156, 200, 32, "Base Dmg:")
self.contents.font.color = normal_color
self.contents.draw_text(135, 0, 200, 32, $game_party.item_number(alchemic_object).to_s)
self.contents.draw_text(135, 51, 200, 32, alchemic_object.hp_recovery_rate.to_s + "%")
self.contents.draw_text(135, 71, 200, 32, alchemic_object.hp_recovery.to_s)
self.contents.draw_text(135, 91, 200, 32, alchemic_object.mp_recovery_rate.to_s + "%")
self.contents.draw_text(135, 111, 200, 32, alchemic_object.mp_recovery.to_s)
self.contents.draw_text(135, 156, 200, 32, alchemic_object.base_damage.to_s)
when "Weapon"
alchemic_object = $data_weapons[alchemy_result[5]]
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 300, 32, "Posses:")
self.contents.draw_text(0, 28, 300, 32, "Parameter Changes:")
self.contents.draw_text(10, 56, 200, 32, "Attack:" )
self.contents.draw_text(10, 76, 200, 32, "Defense:" )
self.contents.draw_text(10, 96, 200, 32, "Spirit:" )
self.contents.draw_text(10, 116, 200, 32, "Agility:" )
self.contents.draw_text(0, 148, 200, 32, "Hit Ratio:")
self.contents.font.color = normal_color
self.contents.draw_text(70, 0, 200, 32, $game_party.item_number(alchemic_object).to_s)
self.contents.draw_text(95, 56, 200, 32, alchemic_object.atk.to_s)
self.contents.draw_text(95, 76, 200, 32, alchemic_object.def.to_s)
self.contents.draw_text(95, 96, 200, 32, alchemic_object.spi.to_s )
self.contents.draw_text(95, 116, 200, 32, alchemic_object.agi.to_s )
self.contents.draw_text(95, 148, 200, 32, alchemic_object.hit.to_s + "%")
when "Armor"
alchemic_object = $data_armors[alchemy_result[5]]
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 300, 32, "Posses:")
self.contents.draw_text(0, 28, 300, 32, "Parameter Changes:")
self.contents.draw_text(10, 56, 200, 32, "Attack:" )
self.contents.draw_text(10, 76, 200, 32, "Defense:" )
self.contents.draw_text(10, 96, 200, 32, "Spirit:" )
self.contents.draw_text(10, 116, 200, 32, "Agility:" )
self.contents.draw_text(0, 148, 200, 32, "Evasion:")
self.contents.font.color = normal_color
self.contents.draw_text(70, 0, 200, 32, $game_party.item_number(alchemic_object).to_s)
self.contents.draw_text(95, 56, 200, 32, alchemic_object.atk.to_s)
self.contents.draw_text(95, 76, 200, 32, alchemic_object.def.to_s)
self.contents.draw_text(95, 96, 200, 32, alchemic_object.spi.to_s )
self.contents.draw_text(95, 116, 200, 32, alchemic_object.agi.to_s )
self.contents.draw_text(95, 148, 200, 32, alchemic_object.eva.to_s + "%")
end
else
# Make dummy windows visible for this display
@dummy_window_full_back.visible = false
@dummy_window_required_names.visible = true
@dummy_window_required_have.visible = true
@dummy_window_required_need.visible = true
# Objects IDs array
object_ids = []
for i in 0...alchemy_result[0].size
next if alchemy_result[0][i] == nil
case alchemy_result[2][i]
when "Item"
object_ids.push($data_items[alchemy_result[0][i]])
when "Weapon"
object_ids.push($data_weapons[alchemy_result[0][i]])
when "Armor"
object_ids.push($data_armors[alchemy_result[0][i]])
end
end
for i in 0...object_ids.size
self.contents.font.color.alpha = 255
numerical_value = i + 1
self.contents.draw_text(0, 0 + i * 26, 200, 32, numerical_value.to_s + ".")
if $game_party.has_item?(object_ids[i])
self.contents.font.color.alpha = 255
draw_icon(object_ids[i].icon_index, 18, 0 + i * 26, enabled = true)
else
self.contents.font.color.alpha = 128
draw_icon(object_ids[i].icon_index, 18, 0 + i * 26, enabled = false)
end
self.contents.draw_text(42, 0 + i * 26, 138, 32, object_ids[i].name.to_s)
if contents.text_size(alchemy_result[1][i]).width <= 11
self.contents.font.color.alpha = 255
self.contents.draw_text(93, 0 + i * 26, 200, 32, alchemy_result[1][i].to_s,2)
else
self.contents.font.color.alpha = 255
self.contents.draw_text(98, 0 + i * 26, 200, 32, alchemy_result[1][i].to_s,2)
end
if $game_party.item_number(object_ids[i]) < alchemy_result[1][i]
self.contents.font.color.alpha = 128
else
self.contents.font.color.alpha = 255
end
if contents.text_size($game_party.item_number(object_ids[i])).width <= 11
self.contents.draw_text(22, 0 + i * 26, 200, 32, $game_party.item_number(object_ids[i]).to_s,2)
else
self.contents.draw_text(27, 0 + i * 26, 200, 32, $game_party.item_number(object_ids[i]).to_s,2)
end
end
end
end
end
Instructions
This script requires basic knowledge on how to input information inside a Hash and array.
To make new Alchemic Methods which are basically recepies that list up the items needed in order to make the new object, you will need to add into the ALCHEMY_METHODS constant.
The array to make a new alchemic method is as follows:
Code:
["Name of the Alchemic Method",
*[IDs of items needed],
*[Quantity of items needed],
*[Kind of items needed],
true/false as to whether or not this alchemic method is known from the start
,Kind of reward item be it a; "Item", "Weapon" or "Armor"
ID of the rewarded item,
Quantity of the rewarded item.],
* These 3 arrays must match each other in the order they are placed.
-Kind of items are defined by: Item" "Weapon" "Armor" with ""
Example:
Code:
ALCHEMY_METHODS = [
["Excalibur",[11,2,6],[10,1,1 ],["Item","Weapon","Weapon"],false,"Weapon",30,1],
]
If you would like to add a price to the alchemic method simply add into the ALCHEMY_METHODS_PRICES constant hash the name of the Alchemic Method and it's price.
Code:
ALCHEMY_METHODS_PRICES = {
"Name of Alchemic Method" => 100
}
Example:
Code:
ALCHEMY_METHODS_PRICES = {
"Full potion" => 100,
"Excalibur" => 9999
}
To learn any alchemic method you may use this in a script call.
Code:
s = "Name of Alchemic Method"
$game_system.learn_alchemy_method(s)
Example
Code:
s = "Full potion"
$game_system.learn_alchemy_method(s)
To forget any alchemic method is basically the same as above but with this script call.
Code:
s = "Name of alchemic Method"
$game_system.forget_alchemy_method(s)
To call the script from an event use this script call.
Code:
$scene = Scene_Alchemy.new
Compatibility
None that I know of
Credits and Thanks
Myself TDS