Więc tak szukam skryptu na alchemie i nie mogę znaleźć.
Jeśli był temat to przepraszam ,ale nie mogę nic znaleźć.
Proszę o podanie linku(nie do rpgmakervx.net bo nie mogę się zarejestrować(z problemów techniczych))lub danie skryptu w spoilerach.
#-------------------------------------------------------------------------------
# Synthesis Shop v1.1
# by: Cylindrical
# May 25, 2010
#-------------------------------------------------------------------------------
# Aliases:
# None
# Overwrites:
# None
# Compatible with:
# Most KGC scripts (tested with Raukue's KGCYanflyPLUS Base Demo)
# Most Yanfly scripts (tested with Raukue's KGCYanflyPLUS Base Demo)
# Not Compatible with:
# Probably no incompatibilities
#-------------------------------------------------------------------------------
# Version History
# v1.1 - The Requirements window now properly works.
# * It grays out the item that you don't have.
# * Many thanks to RPGI for this.
# - Removed Game_Party#has_item? rewrite
# * Replaced with a better one.
# * Thanks again to RPGI.
# v1.0 - Initial release
# * BUG: The Requirements window does not gray out an item if the
# resulting item needs two of the same type of item and you have
# only one. (Fixed on v1.1)
#-------------------------------------------------------------------------------
# What is it?
# This script copies Final Fantasy IX's Synth Shops where the player is
# allowed to create new items using different materials.
#
# How to use
# Place above Main. Before you open the synthesize shop, you need to define
# the shop items. In the SETUP part, you can create arrays to add in your shop.
# This is the format:
#
# Result Item Requirement 1 Requirement 2
# NAME = [ ["<type>", <id>], ["<type>", <id>], ["<type>", <id>] ]
#
# where: NAME is what you call it. Should be relevant but unique. Must be ALLCAPS
# <type> is either "WEAPON", "ARMOR", or "ITEM"
# <id> is the item ID
#
# Then, using $synth_items, put in the items you want to synth. It can be as
# many as you like.
#
# $synth_items = [NAME1, NAME2, ... , NAMEn]
#
# To open the shop window, use the 'Script' command in an event and put it
# this piece of code:
#
# $scene = Scene_SynthShop.new
#
# Notes
# * Make sure you fill in $synth_items first before opening the shop.
# * You MUST GIVE ME CREDIT if you used this in your game.
# * Free to use for commercial games, as long as you give credit to me.
# * This is my first script so don't expect too much glamore. I still
# consider myself a beginner.
#-------------------------------------------------------------------------------
# Special Thanks
# Raukue for his KGCYanflyPLUS Base Demo
# RPGI for his help with Window_SynthReq and check_required_item
#-------------------------------------------------------------------------------
# Bugs (v1.1)
# * None. I hope it stays that way.
#-------------------------------------------------------------------------------
# FAQs
# Q: Can I make it require three ingredients?
# A: No, as of late. But I might do some updates.
#
# Q: How do I set up cost?
# A: The synthesis cost is equal to the item price of the resulting item.
#
# Q: Will this be compatible with <insert script here>?
# A: Most likely, yes since this script uses its own class/methods/functions.
# With some tests, I find this one compatible with MOST commonly used scripts.
# I tried this script with a script pack compiled by Raukue. It's called
# 'KGCYanflyPLUS Base'. It has many KGC and Yanfly scripts. I tested it there
# and no errors were found. Phew! :)
#
# Q: What do you mean by 'relevant but unique' up there?
# A: It means you have to make a unique name for that item and make it so that
# you can easily tell what it is. You can't use spaces and no repetition of
# names. As much as possible, make it short.
# Example:
# GOOD BAD
# MAGIC_HAMMER MAGIC HAMMER <- No spaces.
# CYL_MAGHAMMER SYNTH_ITEM1 <- No sense at all.
# DEATHSCYTHE A or X or D <- AVOID this.
# BIGBOMB_1 SUPER_ULTRA_HYPER_ETERNAL_MAGIC_BELL <- No comment.
#
# So basically, make it 'unique' and 'relevant'.
#
# Q: I want more items to be synthesized but the Script Dialog in the Event
# Editor can't hold too much letters. What should I do?
# A: You can make two arrays and combine them, like this:
# Example:
# $synth_items = [KATANA, MORNING_STAR] <- Assuming you can't type anymore.
# Use the Script command again and do the same except that you need to add
# a plus sign (+) before the equal sign (=). Like this:
# $synth_items += [MANI_KATTI, TIGER_RACKET, EXCALIBUR_2]
#
# Another way is to place the whole array into another variable, like this.
# This technique is good if you have several shops that offers the same items.
# LINDBLUM_SYNTH_SHOP = [KATANA, MORNING_STAR, MANI_KATTI, TIGER_RACKET,
# EXCALIBUR_2]
# $synth_items = LINDBLUM_SYNTH_SHOP
#
# Q: Can we trust you? You said you're a beginner.
# A: If you're a user that doesn't mind dirty codes, you can. This script works.
# If you're a scripter who doesn't like dirty codes, I don't know. It's really
# messy, if you know what I mean...
#-------------------------------------------------------------------------------
# Welcome Message
SYNTH_WELCOME = "Welcome! What can I do for you?"
# Replace 'Synthesize' with this.
SYNTH_COMMAND = "Synthesize"
# Replace 'Requirements' with this.
SYNTH_REQUIREMENTS = "Requirements"
# Synth-able Items Database - Follow the format. Spaces doesn't really matter.
# The numbers here MUST exist in the database.
# Result Material 1 Material 2
# NAME TYPE ID TYPE ID TYPE ID
BASTARD_SWORD = [ ["WEAPON", 10], ["WEAPON", 2], ["WEAPON", 6] ]
FLAME_SHIELD = [ ["ARMOR", 3], ["ARMOR", 1], ["ITEM", 15] ]
FULL_POTION = [ ["ITEM", 3], ["ITEM", 2], ["ITEM", 2] ]
DRAGON_SWORD = [ ["WEAPON", 29], ["WEAPON", 10], ["ARMOR", 29] ]
LIFE_RING = [ ["ARMOR", 29], ["ARMOR", 10], ["ITEM", 3] ]
DRAGON_MAIL = [ ["ARMOR", 22], ["ARMOR", 3], ["ARMOR", 3] ]
FLAME_SCROLL = [ ["ITEM", 16], ["ITEM", 2], ["ITEM", 15] ]
# Common Shops - If you want to use a shop over and over again, you might
# want to use this. Define the synth-able items above and
# place them here. This is the format:
# NAME = [ITEM1, ITEM2, ..., ITEMn]
# NAME must be ALLCAPS
# ITEMs must match with those above. If you put something that
# does not match with even one of those above, you'll get an error.
# Check the Whitesmith to see how to use this array.
TEST_MAP_SYNTH_SHOP = [BASTARD_SWORD, FLAME_SHIELD, FLAME_SCROLL, FULL_POTION,
LIFE_RING, DRAGON_SWORD, DRAGON_MAIL]
# If you use Common Shops, create a list by doing this:
# $synth_items = TEST_MAP_SYNTH_SHOP
# If not, do this:
# $synth_items = [BASTARD_SWORD, FLAME_SHIELD, ETC]
# ^(Notice the square brackets)
#-------------------------------------------------------------------------------
# SETUP END - Do not touch anything beyond this point unless you know what you
# are doing.
#-------------------------------------------------------------------------------
#===============================================================================
# ** Scene_SynthShop
#-------------------------------------------------------------------------------
# This class performs the synthesis shop processing.
#===============================================================================
class Scene_SynthShop < Scene_Base
#-----------------------------------------------------------------------------
# * Start Processing
#-----------------------------------------------------------------------------
def start
super
@synth_items = []
@item_index = 0
@sold_item = nil
@checking = []
create_menu_background
create_command_window
@help_window = Window_Help.new
@gold_window = Window_Gold.new(384, 56)
@dummy_window = Window_Base.new(0, 112, 544, 304)
@synth_window = Window_Synth.new(0, 112)
@synth_window.active = false
@synth_window.visible = false
@status_window = Window_ShopStatus.new(304, 112)
@status_window.visible = false
@requirements_window = Window_SynthReq.new(0, 264, @item_index)
@requirements_window.visible = false
@synth_window.index = 0
@help_window.set_text(SYNTH_WELCOME)
end
#-----------------------------------------------------------------------------
# * Terminate Process
#-----------------------------------------------------------------------------
def terminate
super
dispose_menu_background
dispose_command_window
@help_window.dispose
@gold_window.dispose
@dummy_window.dispose
@synth_window.dispose
@status_window.dispose
@requirements_window.dispose
end
#-----------------------------------------------------------------------------
# * Frame Update
#-----------------------------------------------------------------------------
def update
super
update_menu_background
@help_window.update
@command_window.update
@gold_window.update
@dummy_window.update
@synth_window.update
@status_window.update
@requirements_window.update(@item_index)
@gold_window.update
if @command_window.active
update_command_selection
elsif @synth_window.active
update_synth_selection
end
update_help
end
#-----------------------------------------------------------------------------
# * Create Command Window
#-----------------------------------------------------------------------------
def create_command_window
s1 = SYNTH_COMMAND
s2 = Vocab::ShopCancel
@command_window = Window_Command.new(384, [s1, s2], 3)
@command_window.y = 56
end
#-----------------------------------------------------------------------------
# * Dispose Command Window
#-----------------------------------------------------------------------------
def dispose_command_window
@command_window.dispose
end
#-----------------------------------------------------------------------------
# * Update Command Selection
#-----------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
case @command_window.index
when 0 # Synth
Sound.play_decision
@command_window.active = false
@dummy_window.visible = false
@synth_window.active = true
@synth_window.visible = true
@synth_window.refresh
@status_window.visible = true
@requirements_window.visible = true
@synth_window.index = 0
when 1
Sound.play_decision
$scene = Scene_Map.new
end
end
end
#-----------------------------------------------------------------------------
# * Update Synthesize Selection
#-----------------------------------------------------------------------------
def update_synth_selection
@status_window.item = @synth_window.item
@item = @synth_window.item
update_help
@requirements_window.update_price(@item.price)
if Input.trigger?(Input::DOWN) or Input::trigger?(Input::UP)
@item_index = @synth_window.index
end
if Input.trigger?(Input::B)
Sound.play_cancel
@item = nil
@command_window.active = true
@dummy_window.visible = true
@synth_window.active = false
@synth_window.visible = false
@status_window.visible = false
@status_window.item = nil
@help_window.set_text(SYNTH_WELCOME)
@requirements_window.visible = false
return
end
if Input.trigger?(Input::C)
e = check_required_item(@synth_window.index)
number = $game_party.item_number(@item)
if @item == nil or @item.price > $game_party.gold or number == 99 or !e
Sound.play_buzzer
else
idx = @synth_window.index
get_result_item(@synth_window.index)
$game_party.lose_item(@checking[0], 1)
$game_party.lose_item(@checking[1], 1)
$game_party.gain_item(@sold_item, 1)
$game_party.lose_gold(@item.price)
Sound.play_shop
@gold_window.refresh
@status_window.refresh
@synth_window.refresh
@synth_window.index = idx
end
end
end
#-----------------------------------------------------------------------------
# * Check Required Item
# item_index : Index of item selected
#-----------------------------------------------------------------------------
def check_required_item(item_index)
@checking.clear
@index = item_index
base = $synth_items[@index]
sub1 = base[1]
sub2 = base[2]
case sub1[0]
when "ITEM"
p = $data_items[sub1[1]]
when "WEAPON"
p = $data_weapons[sub1[1]]
when "ARMOR"
p = $data_armors[sub1[1]]
end
@checking.push(p)
case sub2[0]
when "ITEM"
p = $data_items[sub2[1]]
when "WEAPON"
p = $data_weapons[sub2[1]]
when "ARMOR"
p = $data_armors[sub2[1]]
end
@checking.push(p)
valid = false
if @checking[0] == @checking[1]
valid = true if $game_party.item_number(@checking[0]) >= 2
else
valid = true if $game_party.has_item?(@checking[0]) and $game_party.has_item?(@checking[1]) and @checking[0] != @checking[1]
end
return valid
end
#-----------------------------------------------------------------------------
# * Get Resulting Item
# i : Item index
#-----------------------------------------------------------------------------
def get_result_item(i)
base = $synth_items[i]
sub = base[0]
case sub[0]
when "ITEM"
p = $data_items[sub[1]]
when "WEAPON"
p = $data_weapons[sub[1]]
when "ARMOR"
p = $data_armors[sub[1]]
end
@sold_item = p
end
#-----------------------------------------------------------------------------
# * Update Help Window
#-----------------------------------------------------------------------------
def update_help
@help_window.set_text(@item == nil ? SYNTH_WELCOME : @item.description)
end
end
#===============================================================================
# ** Window_Synth
#-------------------------------------------------------------------------------
# This window shows the synth-able items defined by $synth_items.
#===============================================================================
class Window_Synth < Window_Selectable
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 304, 152)
@checking = []
@synth_items = []
refresh
self.index = 0
end
#-----------------------------------------------------------------------------
# * Get Item
#-----------------------------------------------------------------------------
def item
return @data[self.index]
end
#-----------------------------------------------------------------------------
# * Refresh
#-----------------------------------------------------------------------------
def refresh
@data = []
@synth_items.clear
get_result_item
for x in 0...@synth_items.size
item = @synth_items[x]
if item != nil
@data.push(item)
end
end
@item_max = @data.size
create_contents
for i in 0...@item_max
e = check_required_item(i)
draw_item(i, e)
end
end
#-----------------------------------------------------------------------------
# * Draw Item
# index : Item number
# valid : enabled or disabled?
#-----------------------------------------------------------------------------
def draw_item(index, valid)
item = @data[index]
number = $game_party.item_number(item)
enabled = (item.price <= $game_party.gold and number < 99 and valid)
rect = item_rect(index)
self.contents.clear_rect(rect)
draw_item_name(item, rect.x, rect.y, enabled)
rect.width -= 4
end
#-----------------------------------------------------------------------------
# * Get Result Item
#-----------------------------------------------------------------------------
def get_result_item
for i in 0...$synth_items.size
base = $synth_items[i]
sub = base[0]
case sub[0]
when "ITEM"
p = $data_items[sub[1]]
when "WEAPON"
p = $data_weapons[sub[1]]
when "ARMOR"
p = $data_armors[sub[1]]
end
@synth_items.push(p)
end
end
#-----------------------------------------------------------------------------
# * Check Required Item
# item_index : Item number
#-----------------------------------------------------------------------------
def check_required_item(item_index)
@checking.clear
@index = item_index
base = $synth_items[@index]
sub1 = base[1]
sub2 = base[2]
case sub1[0]
when "ITEM"
p = $data_items[sub1[1]]
when "WEAPON"
p = $data_weapons[sub1[1]]
when "ARMOR"
p = $data_armors[sub1[1]]
end
@checking.push(p)
case sub2[0]
when "ITEM"
p = $data_items[sub2[1]]
when "WEAPON"
p = $data_weapons[sub2[1]]
when "ARMOR"
p = $data_armors[sub2[1]]
end
@checking.push(p)
valid = false
if @checking[0] == @checking[1]
valid = true if $game_party.item_number(@checking[0]) >= 2
return valid
else
valid = true if $game_party.has_item?(@checking[0]) && $game_party.has_item?(@checking[1])
end
return valid
end
end
#===============================================================================
# ** Window_SynthReq
#-------------------------------------------------------------------------------
# This window shows the required items needed for synthesis.
#===============================================================================
class Window_SynthReq < Window_Base
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize (x, y, index)
super(x, y, 304, 152)
@req = []
@lacking = false
refresh
end
#-----------------------------------------------------------------------------
# * Frame Update
# req_item_index : Required item number
#-----------------------------------------------------------------------------
def update(req_item_index)
get_required_item(req_item_index)
refresh
end
#-----------------------------------------------------------------------------
# * Price Update
# item_price : Item price
#-----------------------------------------------------------------------------
def update_price(item_price)
@price = item_price
refresh
end
#-----------------------------------------------------------------------------
# * Refresh
#-----------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 200, WLH, SYNTH_REQUIREMENTS)
self.contents.font.color = normal_color
self.contents.draw_text(120, WLH * 4, 120, WLH, @price.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(120, WLH * 4, 140, WLH, Vocab.gold, 2)
if @req != nil
self.contents.font.color = normal_color
req_x = 0
req_y = WLH
for i in 0...2
if @req[0] == @req[1]
enabled = $game_party.item_number(@req[i]) >= i + 1
else
enabled = $game_party.has_item?(@req[i])
end
draw_item_name(@req[i], req_x, req_y, enabled)
req_y += WLH
end
end
end
#-----------------------------------------------------------------------------
# * Get Required Item
# item_index : Item number
#-----------------------------------------------------------------------------
def get_required_item(item_index)
@req.clear
@index = item_index
base = $synth_items[@index]
sub1 = base[1]
sub2 = base[2]
case sub1[0]
when "ITEM"
p = $data_items[sub1[1]]
when "WEAPON"
p = $data_weapons[sub1[1]]
when "ARMOR"
p = $data_armors[sub1[1]]
end
@req.push(p)
case sub2[0]
when "ITEM"
p = $data_items[sub2[1]]
when "WEAPON"
p = $data_weapons[sub2[1]]
when "ARMOR"
p = $data_armors[sub2[1]]
end
@req.push(p)
@lacking = true
if @req[0] == @req[1]
@lacking = false if $game_party.item_number(@req[0]) >= 2
return
else
@lacking = true if $game_party.has_item?(@req[0]) && $game_party.has_item?(@req[1])
end
end
end
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach Nie możesz załączać plików na tym forum Możesz ściągać załączniki na tym forum