rpgrpg maker vx吧 ace如何让主角瞬间从一个场景移动到另一个场景,自动执行。

找到一个物品合成脚本但不会用【rpgmakervxace吧】_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0可签7级以上的吧50个
本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:13,296贴子:
找到一个物品合成脚本但不会用
求大神指导
#--------------------------------------------------------------------------
# ● ダミーウィンドウの作成
#--------------------------------------------------------------------------
def create_dummy_window
wy = @help_window.y + @help_window.height + 48
wh = Graphics.height - wy
@dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
@dummy_window.viewport = @viewport
#--------------------------------------------------------------------------
# ● 個数入力ウィンドウの作成
#--------------------------------------------------------------------------
def create_number_window
wy = @dummy_window.y
wh = @dummy_window.height
@number_window = Window_ItemSynthesisNumber.new(0, wy, wh)
@number_window.viewport = @viewport
@number_window.hide
@number_window.set_handler(:ok,
method(:on_number_ok))
@number_window.set_handler(:cancel, method(:on_number_cancel))
#--------------------------------------------------------------------------
# ● ステータスウィンドウの作成
#--------------------------------------------------------------------------
def create_status_window
wx = @number_window.width
wy = @dummy_window.y
ww = Graphics.width - wx
wh = @dummy_window.height
@status_window = Window_ShopStatus.new(wx, wy, ww, wh)
@status_window.viewport = @viewport
@status_window.hide
#--------------------------------------------------------------------------
# ● 素材ウィンドウの作成
#--------------------------------------------------------------------------
def create_material_window
wx = @number_window.width
wy = @dummy_window.y
ww = Graphics.width - wx
wh = @dummy_window.height
@material_window = Window_ItemSynthesisMaterial.new(wx, wy, ww, wh)
@material_window.viewport = @viewport
@material_window.hide
@number_window.material_window = @material_window
#--------------------------------------------------------------------------
# ● 合成アイテムリストウィンドウの作成
#--------------------------------------------------------------------------
def create_list_window
wy = @dummy_window.y
wh = @dummy_window.height
@list_window = Window_ItemSynthesisList.new(0, wy, wh)
@list_window.viewport = @viewport
@list_window.help_window = @help_window
@list_window.status_window = @status_window
@list_window.material_window = @material_window
@list_window.hide
@list_window.set_handler(:ok,
method(:on_list_ok))
@list_window.set_handler(:cancel, method(:on_list_cancel))
@list_window.set_handler(:change_window, method(:on_change_window))
#--------------------------------------------------------------------------
# ● カテゴリウィンドウの作成
#--------------------------------------------------------------------------
def create_category_window
@category_window = Window_ItemSynthesisCategory.new
@category_window.viewport = @viewport
@category_window.help_window = @help_window
@category_window.y = @help_window.height
@category_window.activate
@category_window.item_window = @list_window
@category_window.set_handler(:ok,
method(:on_category_ok))
@category_window.set_handler(:cancel, method(:return_scene))
#--------------------------------------------------------------------------
# ● 合成アイテムリストウィンドウのアクティブ化
#--------------------------------------------------------------------------
def activate_list_window
@list_window.money = money
@list_window.show.activate
#--------------------------------------------------------------------------
# ● 合成[決定]
#--------------------------------------------------------------------------
def on_list_ok
= @list_window.item
@list_window.hide
@number_window.set(@item, max_buy, buying_price, currency_unit)
@number_window.show.activate
#--------------------------------------------------------------------------
# ● 合成[キャンセル]
#--------------------------------------------------------------------------
def on_list_cancel
@category_window.activate
@category_window.show
@dummy_window.show
@list_window.hide
@status_window.hide
@status_window.item = nil
@material_window.hide
@material_window.set(nil, nil)
@gold_window.hide
@change_window.hide
@help_window.clear
#--------------------------------------------------------------------------
# ● 表示切替
#--------------------------------------------------------------------------
def on_change_window
if @status_window.visible
@status_window.hide
@material_window.show
@status_window.show
@material_window.hide
#--------------------------------------------------------------------------
# ● カテゴリ[決定]
#--------------------------------------------------------------------------
def on_category_ok
activate_list_window
@gold_window.show
@change_window.show
@material_window.show
@category_window.hide
@list_window.select(0)
#--------------------------------------------------------------------------
# ● 個数入力[決定]
#--------------------------------------------------------------------------
def on_number_ok
Sound.play_shop
do_syntetic(@number_window.number)
end_number_input
@gold_window.refresh
#--------------------------------------------------------------------------
# ● 個数入力[キャンセル]
#--------------------------------------------------------------------------
def on_number_cancel
Sound.play_cancel
end_number_input
#--------------------------------------------------------------------------
# ● 合成の実行
#--------------------------------------------------------------------------
def do_syntetic(number)
$game_party.lose_gold(number * buying_price)
$game_party.gain_item(@item, number)
= @list_window.recipe(@item)
for i in 1...@recipe.size
kind = @recipe[i][0]
= @recipe[i][1]
= @recipe[i][2]
if kind == &I&
item = $data_items[id]
elsif kind == &W&
item = $data_weapons[id]
elsif kind == &A&
item = $data_armors[id]
$game_party.lose_item(item, num*number)
#--------------------------------------------------------------------------
# ● 個数入力の終了
#--------------------------------------------------------------------------
def end_number_input
@number_window.hide
activate_list_window
#--------------------------------------------------------------------------
# ● 最大購入可能個数の取得
#--------------------------------------------------------------------------
def max_buy
max = $game_party.max_item_number(@item) - $game_party.item_number(@item)
@recipe = @list_window.recipe(@item)
for i in 1...@recipe.size
kind = @recipe[i][0]
= @recipe[i][1]
= @recipe[i][2]
if kind == &I&
item = $data_items[id]
elsif kind == &W&
item = $data_weapons[id]
elsif kind == &A&
item = $data_armors[id]
if num & 0
max_buf = $game_party.item_number(item)/num
max_buf = 999
max = [max, max_buf].min
buying_price == 0 ? max : [max, money / buying_price].min
#--------------------------------------------------------------------------
# ● 所持金の取得
#--------------------------------------------------------------------------
@gold_window.value
#--------------------------------------------------------------------------
# ● 通貨単位の取得
#--------------------------------------------------------------------------
def currency_unit
@gold_window.currency_unit
#--------------------------------------------------------------------------
# ● 合成費用の取得
#--------------------------------------------------------------------------
def buying_price
@list_window.price(@item)
endend#==============================================================================# ■ Window_ItemSynthesisList#------------------------------------------------------------------------------#  合成画面で、合成可能なアイテムの一覧を表示するウィンドウです。#==============================================================================class Window_ItemSynthesisList & Window_Selectable
include WD_itemsynthesis
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader
:status_window
# ステータスウィンドウ
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, y, height)
super(x, y, window_width, height)
@shop_goods = []
@shop_recipes = []
for i in 1..WD_itemsynthesis_ini::I_recipe.size
recipe = WD_itemsynthesis_ini::I_recipe[i]
good = [0, i, recipe[0]]
if i_recipe_switch_on?(i)
@shop_goods.push(good)
@shop_recipes.push(recipe)
for i in 1..WD_itemsynthesis_ini::W_recipe.size
recipe = WD_itemsynthesis_ini::W_recipe[i]
good = [1, i, recipe[0]]
if w_recipe_switch_on?(i)
@shop_goods.push(good)
@shop_recipes.push(recipe)
for i in 1..WD_itemsynthesis_ini::A_recipe.size
recipe = WD_itemsynthesis_ini::A_recipe[i]
good = [2, i, recipe[0]]
if a_recipe_switch_on?(i)
@shop_goods.push(good)
@shop_recipes.push(recipe)
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
return 304
#--------------------------------------------------------------------------
# ● 項目数の取得
#--------------------------------------------------------------------------
def item_max
? @data.size : 1
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
@data[index]
#--------------------------------------------------------------------------
# ● 所持金の設定
#--------------------------------------------------------------------------
def money=(money)
@money = money
#--------------------------------------------------------------------------
# ● 選択項目の有効状態を取得
#--------------------------------------------------------------------------
def current_item_enabled?
enable?(@data[index])
#--------------------------------------------------------------------------
# ● 合成費用を取得
#--------------------------------------------------------------------------
def price(item)
@price[item]
#--------------------------------------------------------------------------
# ● 合成可否を取得
#--------------------------------------------------------------------------
def enable?(item)
@makable[item]
#--------------------------------------------------------------------------
# ● レシピを取得
#--------------------------------------------------------------------------
def recipe(item)
@recipe[item]
#--------------------------------------------------------------------------
# ● アイテムを許可状態で表示するかどうか
#--------------------------------------------------------------------------
def have_mat?(recipe)
flag = true
if @money &= recipe[0]
for i in 1...recipe.size
kind = recipe[i][0]
= recipe[i][1]
= recipe[i][2]
if kind == &I&
item = $data_items[id]
elsif kind == &W&
item = $data_weapons[id]
elsif kind == &A&
item = $data_armors[id]
if $game_party.item_number(item) & [num, 1].max
flag = false
flag = false
return flag
#--------------------------------------------------------------------------
# ● カテゴリの設定
#--------------------------------------------------------------------------
def category=(category)
== category
@category = category
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
make_item_list
create_contents
draw_all_items
#--------------------------------------------------------------------------
# ● アイテムをリストに含めるかどうか
#--------------------------------------------------------------------------
def include?(item)
case @category
when :item
item.is_a?(RPG::Item) && !item.key_item?
when :weapon
item.is_a?(RPG::Weapon)
when :armor
item.is_a?(RPG::Armor)
when :key_item
item.is_a?(RPG::Item) && item.key_item?
#--------------------------------------------------------------------------
# ● アイテムリストの作成
#--------------------------------------------------------------------------
def make_item_list
for i in 0...@shop_goods.size
goods = @shop_goods[i]
recipe = @shop_recipes[i]
case goods[0]
item = $data_items[goods[1]]
item = $data_weapons[goods[1]]
item = $data_armors[goods[1]]
if include?(item)
@data.push(item)
@price[item] = goods[2]
@makable[item] = have_mat?(recipe)
@recipe[item] = recipe
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
rect = item_rect(index)
draw_item_name(item, rect.x, rect.y, enable?(item))
rect.width -= 4
draw_text(rect, price(item), 2)
if WD_itemsynthesis_ini::Cost_view
#--------------------------------------------------------------------------
# ● ステータスウィンドウの設定
#--------------------------------------------------------------------------
def status_window=(status_window)
@status_window = status_window
call_update_help
#--------------------------------------------------------------------------
# ● 素材ウィンドウの設定
#--------------------------------------------------------------------------
def material_window=(material_window)
@material_window = material_window
call_update_help
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item) if @help_window
@status_window.item = item if @status_window
@material_window.set(item, recipe(item)) if @material_window
#--------------------------------------------------------------------------
# ● ←→ ボタン(表示切替)が押されたときの処理
#--------------------------------------------------------------------------
def process_change_window
Sound.play_cursor
Input.update
call_handler(:change_window)
#--------------------------------------------------------------------------
# ● 決定やキャンセルなどのハンドリング処理
#--------------------------------------------------------------------------
def process_handling
return process_change_window if handle?(:change_window) && Input.trigger?(:X)
return process_change_window if handle?(:change_window) && Input.trigger?(:Y)
endend#==============================================================================# ■ Window_ItemSynthesisMaterial#------------------------------------------------------------------------------#  合成画面で、合成に必要な素材を表示するウィンドウです。#==============================================================================class Window_ItemSynthesisMaterial & Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_possession(4, 0)
draw_material_info(0, line_height * 2)
#--------------------------------------------------------------------------
# ● アイテムの設定
#--------------------------------------------------------------------------
def set(item, recipe)
@item = item
@recipe = recipe
@make_number = 1
#--------------------------------------------------------------------------
# ● 作成個数の設定
#--------------------------------------------------------------------------
def set_num(make_number)
@make_number = make_number
#--------------------------------------------------------------------------
# ● 所持数の描画
#--------------------------------------------------------------------------
def draw_possession(x, y)
rect = Rect.new(x, y, contents.width - 4 - x, line_height)
change_color(system_color)
draw_text(rect, Vocab::Possession)
change_color(normal_color)
draw_text(rect, $game_party.item_number(@item), 2)
#--------------------------------------------------------------------------
# ● 素材情報の描画
#--------------------------------------------------------------------------
def draw_material_info(x, y)
rect = Rect.new(x, y, contents.width, line_height)
change_color(system_color)
contents.font.size = 18
draw_text(rect, &必要素材&, 0)
if @recipe
for i in 1...@recipe.size
kind = @recipe[i][0]
= @recipe[i][1]
= @recipe[i][2]
if kind == &I&
item = $data_items[id]
elsif kind == &W&
item = $data_weapons[id]
elsif kind == &A&
item = $data_armors[id]
rect = Rect.new(x, y + line_height*i, contents.width, line_height)
enabled = true
enabled = false if [num*@make_number, 1].max
& $game_party.item_number(item)
draw_item_name(item, rect.x, rect.y, enabled)
change_color(normal_color, enabled)
if num & 0
draw_text(rect, &{$game_party.item_number(item)}&, 2)
change_color(normal_color)
contents.font.size = 24
endend#==============================================================================# ■ Window_ItemSynthesisNumber#------------------------------------------------------------------------------#  合成画面で、合成するアイテムの個数を入力するウィンドウです。#==============================================================================class Window_ItemSynthesisNumber & Window_ShopNumber
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_item_name(@item, 0, item_y)
draw_number
draw_total_price if WD_itemsynthesis_ini::Cost_view
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def material_window=(material_window)
@material_window = material_window
call_update_help
#--------------------------------------------------------------------------
# ● 作成個数の変更
#--------------------------------------------------------------------------
def change_number(amount)
@number = [[@number + amount, @max].min, 1].max
call_update_help #追加
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def call_update_help
@material_window.set_num(@number) if @material_window
=============================================================================# ■ Window_ItemSynthesisCategory#------------------------------------------------------------------------------#  合成画面で、通常アイテムや装備品の分類を選択するウィンドウです。#==============================================================================class Window_ItemSynthesisCategory & Window_ItemCategory
#--------------------------------------------------------------------------
# ● 桁数の取得
#--------------------------------------------------------------------------
def col_max
i += 1 if WD_itemsynthesis_ini::Category_i
i += 1 if WD_itemsynthesis_ini::Category_w
i += 1 if WD_itemsynthesis_ini::Category_a
i += 1 if WD_itemsynthesis_ini::Category_k
#--------------------------------------------------------------------------
# ● コマンドリストの作成
#--------------------------------------------------------------------------
def make_command_list
add_command(Vocab::item,
if WD_itemsynthesis_ini::Category_i
add_command(Vocab::weapon,
if WD_itemsynthesis_ini::Category_w
add_command(Vocab::armor,
if WD_itemsynthesis_ini::Category_a
add_command(Vocab::key_item, :key_item) if WD_itemsynthesis_ini::Category_k
endend#==============================================================================# ■ Window_ItemSynthesisNumber#------------------------------------------------------------------------------#  合成画面で、切替を表示するウィンドウです。#==============================================================================class Window_ItemSynthesisChange & Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
text = &X Y:表示切り替え&
draw_text(0, 0, contents_width, line_height, text, 1)
好长……我一般用事件做……
贴吧热议榜
使用签名档&&
保存至快速回贴

我要回帖

更多关于 rpg maker vx吧 的文章

 

随机推荐