Project1

标题: 关于合成脚本的问题。 [打印本页]

作者: tim浅蓝    时间: 2013-9-13 22:03
标题: 关于合成脚本的问题。
本帖最后由 tim浅蓝 于 2013-9-13 22:03 编辑

做个伸手党好了。。。因为实在不会,。。请各位大大教我如何改此脚本的错误。
RUBY 代码复制
  1. #==============================================================================
  2. # ■ RGSS3 合成 ver 1.01
  3. #------------------------------------------------------------------------------
  4. #  配布元:
  5. #     白の魔 [url]http://izumiwhite.web.fc2.com/[/url]
  6. #
  7. #  利用規約:
  8. #     RPGツクールVXの正規の登録者のみご利用になれます。
  9. #     利用報告・著作権表示とかは必要ありません。
  10. #     改造もご自由にどうぞ。
  11. #     何か問題が発生しても責任は持ちません。
  12. #==============================================================================
  13.  
  14.  
  15. #--------------------------------------------------------------------------
  16. # ★ 初期設定。
  17. #    合成レシピ等の設定
  18. #--------------------------------------------------------------------------
  19. module WD_itemsynthesis_ini
  20.  
  21.   Cost_view =  true #費用(G)の表示(合成の費用が全て0Gの場合はfalseを推奨)
  22.  
  23.   Category_i = true #カテゴリウィンドウに「アイテム」の項目を表示
  24.   Category_w = true #カテゴリウィンドウに「武器」の項目を表示
  25.   Category_a = true #カテゴリウィンドウに「防具」の項目を表示
  26.   Category_k = true #カテゴリウィンドウに「大事なもの」の項目を表示
  27.  
  28.   I_recipe = [] #この行は削除しないこと
  29.   W_recipe = [] #この行は削除しないこと
  30.   A_recipe = [] #この行は削除しないこと
  31.  
  32.   #以下、合成レシピ。
  33.   #例: I_recipe[3]  = [100, ["I",1,1], ["W",2,1], ["A",2,2], ["A",3,1]]
  34.   #と記載した場合、ID3のアイテムの合成必要は、100G。
  35.   #必要な素材は、ID1のアイテム1個、ID2の武器1個、ID2の防具2個、ID3の防具1個
  36.   #となる。
  37.  
  38.   #アイテムの合成レシピ
  39.   I_recipe[2]  = [10,  ["I",1,2]]
  40.   I_recipe[3]  = [100, ["I",1,1], ["I",2,1]]
  41.   I_recipe[17] = [500, ["I",1,10]]
  42.  
  43.   #武器の合成レシピ
  44.   W_recipe[3]  = [50,   ["W",1,1], ["W",2,1]]
  45.   W_recipe[6]  = [600,  ["W",3,1], ["I",17,0]]
  46.  
  47.   #防具の合成レシピ  
  48.   A_recipe[2]  = [40,   ["A",1,2]]
  49.   A_recipe[5]  = [400,  ["A",2,1], ["W",2,2], ["I",17,0]]
  50.  
  51.  
  52.  
  53. end
  54.  
  55.  
  56. #==============================================================================
  57. # ■ WD_itemsynthesis
  58. #------------------------------------------------------------------------------
  59. #  アイテム合成用の共通メソッドです。
  60. #==============================================================================
  61.  
  62. module WD_itemsynthesis
  63.   def i_recipe_switch_on(id)
  64.     $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  65.     $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  66.     $game_system.i_rcp_sw[id] = true
  67.   end
  68.   def i_recipe_switch_off(id)
  69.     $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  70.     $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  71.     $game_system.i_rcp_sw[id] = false
  72.   end
  73.   def i_recipe_switch_on?(id)
  74.     $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  75.     $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  76.     return $game_system.i_rcp_sw[id]
  77.   end
  78.   def i_recipe_all_switch_on
  79.     for i in 1..$data_items.size
  80.       i_recipe_switch_on(i)
  81.     end
  82.   end
  83.   def i_recipe_all_switch_off
  84.     for i in 1..$data_items.size
  85.       i_recipe_switch_off(i)
  86.     end
  87.   end
  88.   def w_recipe_switch_on(id)
  89.     $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  90.     $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  91.     $game_system.w_rcp_sw[id] = true
  92.   end
  93.   def w_recipe_switch_off(id)
  94.     $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  95.     $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  96.     $game_system.w_rcp_sw[id] = false
  97.   end
  98.   def w_recipe_switch_on?(id)
  99.     $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  100.     $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  101.     return $game_system.w_rcp_sw[id]
  102.   end
  103.   def w_recipe_all_switch_on
  104.     for i in 1..$data_weapons.size
  105.       w_recipe_switch_on(i)
  106.     end
  107.   end
  108.   def w_recipe_all_switch_off
  109.     for i in 1..$data_weapons.size
  110.       w_recipe_switch_off(i)
  111.     end
  112.   end
  113.   def a_recipe_switch_on(id)
  114.     $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  115.     $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  116.     $game_system.a_rcp_sw[id] = true
  117.   end
  118.   def a_recipe_switch_off(id)
  119.     $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  120.     $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  121.     $game_system.a_rcp_sw[id] = false
  122.   end
  123.   def a_recipe_switch_on?(id)
  124.     $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  125.     $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  126.     return $game_system.a_rcp_sw[id]
  127.   end
  128.   def a_recipe_all_switch_on
  129.     for i in 1..$data_armors.size
  130.       a_recipe_switch_on(i)
  131.     end
  132.   end
  133.   def a_recipe_all_switch_off
  134.     for i in 1..$data_armors.size
  135.       a_recipe_switch_off(i)
  136.     end
  137.   end
  138.   def recipe_all_switch_on
  139.     i_recipe_all_switch_on
  140.     w_recipe_all_switch_on
  141.     a_recipe_all_switch_on
  142.   end
  143.   def recipe_all_switch_off
  144.     i_recipe_all_switch_off
  145.     w_recipe_all_switch_off
  146.     a_recipe_all_switch_off
  147.   end
  148.  
  149. end
  150.  
  151. class Game_Interpreter
  152.   include WD_itemsynthesis
  153. end
  154.  
  155. class Game_System
  156.   #--------------------------------------------------------------------------
  157.   # ● 公開インスタンス変数
  158.   #--------------------------------------------------------------------------
  159.   attr_accessor :i_rcp_sw
  160.   attr_accessor :w_rcp_sw
  161.   attr_accessor :a_rcp_sw
  162.   #--------------------------------------------------------------------------
  163.   # ● オブジェクト初期化
  164.   #--------------------------------------------------------------------------
  165.   alias wd_orig_initialize004 initialize
  166.   def initialize
  167.     wd_orig_initialize004
  168.     @i_rcp_sw = []
  169.     @w_rcp_sw = []
  170.     @a_rcp_sw = []
  171.   end
  172. end
  173.  
  174.  
  175. #==============================================================================
  176. # ■ Scene_ItemSynthesis
  177. #------------------------------------------------------------------------------
  178. #  合成画面の処理を行うクラスです。
  179. #==============================================================================
  180.  
  181. class Scene_ItemSynthesis < Scene_MenuBase
  182.   #--------------------------------------------------------------------------
  183.   # ● 開始処理
  184.   #--------------------------------------------------------------------------
  185.   def start
  186.     super
  187.  
  188.     create_help_window
  189.     create_dummy_window
  190.     create_number_window
  191.     create_status_window
  192.     create_material_window
  193.     create_list_window
  194.     create_category_window
  195.     create_gold_window
  196.     create_change_window
  197.   end
  198.   #--------------------------------------------------------------------------
  199.   # ● ゴールドウィンドウの作成
  200.   #--------------------------------------------------------------------------
  201.   def create_gold_window
  202.     @gold_window = Window_Gold.new
  203.     @gold_window.viewport = @viewport
  204.     @gold_window.x = Graphics.width - @gold_window.width
  205.     @gold_window.y = @help_window.height
  206.     @gold_window.hide
  207.   end
  208.   #--------------------------------------------------------------------------
  209.   # ● 切り替え表示ウィンドウの作成
  210.   #--------------------------------------------------------------------------
  211.   def create_change_window
  212.     wx = 0
  213.     wy = @gold_window.y
  214.     ww = Graphics.width - @gold_window.width
  215.     wh = @gold_window.height
  216.     @change_window = Window_ItemSynthesisChange.new(wx, wy, ww, wh)
  217.     @change_window.viewport = @viewport
  218.     @change_window.hide
  219.   end
  220.   #--------------------------------------------------------------------------
  221.   # ● ダミーウィンドウの作成
  222.   #--------------------------------------------------------------------------
  223.   def create_dummy_window
  224.     wy = @help_window.y + @help_window.height + 48
  225.     wh = Graphics.height - wy
  226.     @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
  227.     @dummy_window.viewport = @viewport
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # ● 個数入力ウィンドウの作成
  231.   #--------------------------------------------------------------------------
  232.   def create_number_window
  233.     wy = @dummy_window.y
  234.     wh = @dummy_window.height
  235.     @number_window = Window_ItemSynthesisNumber.new(0, wy, wh)
  236.     @number_window.viewport = @viewport
  237.     @number_window.hide
  238.     @number_window.set_handler(:ok,     method(:on_number_ok))
  239.     @number_window.set_handler(:cancel, method(:on_number_cancel))
  240.   end
  241.   #--------------------------------------------------------------------------
  242.   # ● ステータスウィンドウの作成
  243.   #--------------------------------------------------------------------------
  244.   def create_status_window
  245.     wx = @number_window.width
  246.     wy = @dummy_window.y
  247.     ww = Graphics.width - wx
  248.     wh = @dummy_window.height
  249.     @status_window = Window_ShopStatus.new(wx, wy, ww, wh)
  250.     @status_window.viewport = @viewport
  251.     @status_window.hide
  252.   end
  253.   #--------------------------------------------------------------------------
  254.   # ● 素材ウィンドウの作成
  255.   #--------------------------------------------------------------------------
  256.   def create_material_window
  257.     wx = @number_window.width
  258.     wy = @dummy_window.y
  259.     ww = Graphics.width - wx
  260.     wh = @dummy_window.height
  261.     @material_window = Window_ItemSynthesisMaterial.new(wx, wy, ww, wh)
  262.     @material_window.viewport = @viewport
  263.     @material_window.hide
  264.     @number_window.material_window = @material_window
  265.   end
  266.   #--------------------------------------------------------------------------
  267.   # ● 合成アイテムリストウィンドウの作成
  268.   #--------------------------------------------------------------------------
  269.   def create_list_window
  270.     wy = @dummy_window.y
  271.     wh = @dummy_window.height
  272.     @list_window = Window_ItemSynthesisList.new(0, wy, wh)
  273.     @list_window.viewport = @viewport
  274.     @list_window.help_window = @help_window
  275.     @list_window.status_window = @status_window
  276.     @list_window.material_window = @material_window
  277.     @list_window.hide
  278.     @list_window.set_handler(:ok,     method(:on_list_ok))
  279.     @list_window.set_handler(:cancel, method(:on_list_cancel))
  280.     @list_window.set_handler(:change_window, method(:on_change_window))   
  281.   end
  282.   #--------------------------------------------------------------------------
  283.   # ● カテゴリウィンドウの作成
  284.   #--------------------------------------------------------------------------
  285.   def create_category_window
  286.     @category_window = Window_ItemSynthesisCategory.new
  287.     @category_window.viewport = @viewport
  288.     @category_window.help_window = @help_window
  289.     @category_window.y = @help_window.height
  290.     @category_window.activate
  291.     @category_window.item_window = @list_window
  292.     @category_window.set_handler(:ok,     method(:on_category_ok))
  293.     @category_window.set_handler(:cancel, method(:return_scene))
  294.   end
  295.  
  296.   def return_scene
  297.     $game_map.autoplay
  298.     SceneManager.return
  299.   end
  300.  
  301.   #--------------------------------------------------------------------------
  302.   # ● 合成アイテムリストウィンドウのアクティブ化
  303.   #--------------------------------------------------------------------------
  304.   def activate_list_window
  305.     @list_window.money = money
  306.     @list_window.show.activate
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   # ● 合成[決定]
  310.   #--------------------------------------------------------------------------
  311.   def on_list_ok
  312.     @item = @list_window.item
  313.     @list_window.hide
  314.     @number_window.set(@item, max_buy, buying_price, currency_unit)
  315.     @number_window.show.activate
  316.   end
  317.   #--------------------------------------------------------------------------
  318.   # ● 合成[キャンセル]
  319.   #--------------------------------------------------------------------------
  320.   def on_list_cancel
  321.     @category_window.activate
  322.     @category_window.show
  323.     @dummy_window.show
  324.     @list_window.hide
  325.     @status_window.hide
  326.     @status_window.item = nil
  327.     @material_window.hide
  328.     @material_window.set(nil, nil)
  329.     @gold_window.hide
  330.     @change_window.hide
  331.     @help_window.clear
  332.   end
  333.   #--------------------------------------------------------------------------
  334.   # ● 表示切替
  335.   #--------------------------------------------------------------------------
  336.   def on_change_window
  337.     if @status_window.visible
  338.       @status_window.hide
  339.       @material_window.show
  340.     else
  341.       @status_window.show
  342.       @material_window.hide
  343.     end
  344.   end
  345.   #--------------------------------------------------------------------------
  346.   # ● カテゴリ[決定]
  347.   #--------------------------------------------------------------------------
  348.   def on_category_ok
  349.     activate_list_window
  350.     @gold_window.show
  351.     @change_window.show
  352.     @material_window.show
  353.     @category_window.hide
  354.     @list_window.select(0)
  355.   end
  356.   #--------------------------------------------------------------------------
  357.   # ● 個数入力[決定]
  358.   #--------------------------------------------------------------------------
  359.   def on_number_ok
  360.     Sound.play_shop
  361.     do_syntetic(@number_window.number)
  362.     end_number_input
  363.     @gold_window.refresh
  364.   end
  365.   #--------------------------------------------------------------------------
  366.   # ● 個数入力[キャンセル]
  367.   #--------------------------------------------------------------------------
  368.   def on_number_cancel
  369.     Sound.play_cancel
  370.     end_number_input
  371.   end
  372.   #--------------------------------------------------------------------------
  373.   # ● 合成の実行
  374.   #--------------------------------------------------------------------------
  375.   def do_syntetic(number)
  376.     $game_party.lose_gold(number * buying_price)
  377.     $game_party.gain_item(@item, number)
  378.  
  379.       @recipe = @list_window.recipe(@item)
  380.       for i in [email]1...@recipe.size[/email]
  381.         kind = @recipe[i][0]
  382.         id   = @recipe[i][1]
  383.         num  = @recipe[i][2]
  384.         if kind == "I"
  385.           item = $data_items[id]
  386.         elsif kind == "W"
  387.           item = $data_weapons[id]
  388.         elsif kind == "A"
  389.           item = $data_armors[id]
  390.         end
  391.         $game_party.lose_item(item, num*number)
  392.       end
  393.   end
  394.   #--------------------------------------------------------------------------
  395.   # ● 個数入力の終了
  396.   #--------------------------------------------------------------------------
  397.   def end_number_input
  398.     @number_window.hide
  399.     activate_list_window
  400.   end
  401.   #--------------------------------------------------------------------------
  402.   # ● 最大購入可能個数の取得
  403.   #--------------------------------------------------------------------------
  404.   def max_buy
  405.     max = $game_party.max_item_number(@item) - $game_party.item_number(@item)
  406.  
  407.     @recipe = @list_window.recipe(@item)
  408.       for i in [email]1...@recipe.size[/email]
  409.         kind = @recipe[i][0]
  410.         id   = @recipe[i][1]
  411.         num  = @recipe[i][2]
  412.         if kind == "I"
  413.           item = $data_items[id]
  414.         elsif kind == "W"
  415.           item = $data_weapons[id]
  416.         elsif kind == "A"
  417.           item = $data_armors[id]
  418.         end
  419.         if num > 0
  420.           max_buf = $game_party.item_number(item)/num
  421.         else
  422.           max_buf = 999
  423.         end
  424.         max = [max, max_buf].min
  425.       end
  426.  
  427.     buying_price == 0 ? max : [max, money / buying_price].min
  428.  
  429.   end
  430.   #--------------------------------------------------------------------------
  431.   # ● 所持金の取得
  432.   #--------------------------------------------------------------------------
  433.   def money
  434.     @gold_window.value
  435.   end
  436.   #--------------------------------------------------------------------------
  437.   # ● 通貨単位の取得
  438.   #--------------------------------------------------------------------------
  439.   def currency_unit
  440.     @gold_window.currency_unit
  441.   end
  442.   #--------------------------------------------------------------------------
  443.   # ● 合成費用の取得
  444.   #--------------------------------------------------------------------------
  445.   def buying_price
  446.     @list_window.price(@item)
  447.   end
  448. end
  449.  
  450.  
  451. #==============================================================================
  452. # ■ Window_ItemSynthesisList
  453. #------------------------------------------------------------------------------
  454. #  合成画面で、合成可能なアイテムの一覧を表示するウィンドウです。
  455. #==============================================================================
  456.  
  457. class Window_ItemSynthesisList < Window_Selectable
  458.   include WD_itemsynthesis
  459.   #--------------------------------------------------------------------------
  460.   # ● 公開インスタンス変数
  461.   #--------------------------------------------------------------------------
  462.   attr_reader   :status_window            # ステータスウィンドウ
  463.   #--------------------------------------------------------------------------
  464.   # ● オブジェクト初期化
  465.   #--------------------------------------------------------------------------
  466.   def initialize(x, y, height)
  467.     super(x, y, window_width, height)
  468.  
  469.     @shop_goods = []
  470.     @shop_recipes = []
  471.  
  472.     for i in 1..WD_itemsynthesis_ini::I_recipe.size
  473.       recipe = WD_itemsynthesis_ini::I_recipe[i]
  474.       if recipe
  475.         good = [0, i, recipe[0]]
  476.         if i_recipe_switch_on?(i)
  477.           @shop_goods.push(good)
  478.           @shop_recipes.push(recipe)
  479.         end
  480.       end
  481.     end
  482.     for i in 1..WD_itemsynthesis_ini::W_recipe.size
  483.       recipe = WD_itemsynthesis_ini::W_recipe[i]
  484.       if recipe
  485.         good = [1, i, recipe[0]]
  486.         if w_recipe_switch_on?(i)
  487.           @shop_goods.push(good)
  488.           @shop_recipes.push(recipe)
  489.         end
  490.       end
  491.     end
  492.     for i in 1..WD_itemsynthesis_ini::A_recipe.size
  493.       recipe = WD_itemsynthesis_ini::A_recipe[i]
  494.       if recipe
  495.         good = [2, i, recipe[0]]
  496.         if a_recipe_switch_on?(i)
  497.           @shop_goods.push(good)
  498.           @shop_recipes.push(recipe)
  499.         end
  500.       end
  501.     end
  502.  
  503.     [url=home.php?mod=space&uid=26101]@Money[/url] = 0
  504.     refresh
  505.     select(0)
  506.   end
  507.   #--------------------------------------------------------------------------
  508.   # ● ウィンドウ幅の取得
  509.   #--------------------------------------------------------------------------
  510.   def window_width
  511.     return 304
  512.   end
  513.   #--------------------------------------------------------------------------
  514.   # ● 項目数の取得
  515.   #--------------------------------------------------------------------------
  516.   def item_max
  517.     @data ? @data.size : 1
  518.   end
  519.   #--------------------------------------------------------------------------
  520.   # ● アイテムの取得
  521.   #--------------------------------------------------------------------------
  522.   def item
  523.     @data[index]
  524.   end
  525.   #--------------------------------------------------------------------------
  526.   # ● 所持金の設定
  527.   #--------------------------------------------------------------------------
  528.   def money=(money)
  529.     [url=home.php?mod=space&uid=26101]@Money[/url] = money
  530.     refresh
  531.   end
  532.   #--------------------------------------------------------------------------
  533.   # ● 選択項目の有効状態を取得
  534.   #--------------------------------------------------------------------------
  535.   def current_item_enabled?
  536.     enable?(@data[index])
  537.   end
  538.   #--------------------------------------------------------------------------
  539.   # ● 合成費用を取得
  540.   #--------------------------------------------------------------------------
  541.   def price(item)
  542.     @price[item]
  543.   end
  544.   #--------------------------------------------------------------------------
  545.   # ● 合成可否を取得
  546.   #--------------------------------------------------------------------------
  547.   def enable?(item)
  548.     @makable[item]
  549.   end
  550.   #--------------------------------------------------------------------------
  551.   # ● レシピを取得
  552.   #--------------------------------------------------------------------------
  553.   def recipe(item)
  554.     @recipe[item]
  555.   end
  556.   #--------------------------------------------------------------------------
  557.   # ● アイテムを許可状態で表示するかどうか
  558.   #--------------------------------------------------------------------------
  559.   def have_mat?(recipe)
  560.     flag = true
  561.     if [url=home.php?mod=space&uid=26101]@Money[/url] >= recipe[0]
  562.       for i in 1...recipe.size
  563.         kind = recipe[i][0]
  564.         id   = recipe[i][1]
  565.         num  = recipe[i][2]
  566.         if kind == "I"
  567.           item = $data_items[id]
  568.         elsif kind == "W"
  569.           item = $data_weapons[id]
  570.         elsif kind == "A"
  571.           item = $data_armors[id]
  572.         end
  573.         if $game_party.item_number(item) < [num, 1].max
  574.           flag = false
  575.         end
  576.       end
  577.     else
  578.       flag = false
  579.     end
  580.     return flag
  581.   end
  582.   #--------------------------------------------------------------------------
  583.   # ● カテゴリの設定
  584.   #--------------------------------------------------------------------------
  585.   def category=(category)
  586.     return if @category == category
  587.     @category = category
  588.     refresh
  589.   end
  590.   #--------------------------------------------------------------------------
  591.   # ● リフレッシュ
  592.   #--------------------------------------------------------------------------
  593.   def refresh
  594.     make_item_list
  595.     create_contents
  596.     draw_all_items
  597.   end
  598.   #--------------------------------------------------------------------------
  599.   # ● アイテムをリストに含めるかどうか
  600.   #--------------------------------------------------------------------------
  601.   def include?(item)
  602.     case @category
  603.     when :item
  604.       item.is_a?(RPG::Item) && !item.key_item?
  605.     when :weapon
  606.       item.is_a?(RPG::Weapon)
  607.     when :armor
  608.       item.is_a?(RPG::Armor)
  609.     when :key_item
  610.       item.is_a?(RPG::Item) && item.key_item?
  611.     else
  612.       false
  613.     end
  614.   end
  615.   #--------------------------------------------------------------------------
  616.   # ● アイテムリストの作成
  617.   #--------------------------------------------------------------------------
  618.   def make_item_list
  619.     @data = []
  620.     @price = {}
  621.     @makable = {}
  622.     @recipe = {}
  623.     for i in [email]0...@shop_goods.size[/email]
  624.       goods = @shop_goods[i]
  625.       recipe = @shop_recipes[i]
  626.       case goods[0]
  627.       when 0;  item = $data_items[goods[1]]
  628.       when 1;  item = $data_weapons[goods[1]]
  629.       when 2;  item = $data_armors[goods[1]]
  630.       end
  631.       if item
  632.         if include?(item)
  633.           @data.push(item)
  634.           @price[item] = goods[2]
  635.           @makable[item] = have_mat?(recipe)
  636.           @recipe[item] = recipe
  637.         end
  638.       end
  639.     end
  640.   end
  641.   #--------------------------------------------------------------------------
  642.   # ● 項目の描画
  643.   #--------------------------------------------------------------------------
  644.   def draw_item(index)
  645.     item = @data[index]
  646.     rect = item_rect(index)
  647.     draw_item_name(item, rect.x, rect.y, enable?(item))
  648.     rect.width -= 4
  649.     draw_text(rect, price(item), 2)  if WD_itemsynthesis_ini::Cost_view
  650.   end
  651.   #--------------------------------------------------------------------------
  652.   # ● ステータスウィンドウの設定
  653.   #--------------------------------------------------------------------------
  654.   def status_window=(status_window)
  655.     @status_window = status_window
  656.     call_update_help
  657.   end
  658.   #--------------------------------------------------------------------------
  659.   # ● 素材ウィンドウの設定
  660.   #--------------------------------------------------------------------------
  661.   def material_window=(material_window)
  662.     @material_window = material_window
  663.     call_update_help
  664.   end
  665.   #--------------------------------------------------------------------------
  666.   # ● ヘルプテキスト更新
  667.   #--------------------------------------------------------------------------
  668.   def update_help
  669.     @help_window.set_item(item) if @help_window
  670.     @status_window.item = item if @status_window
  671.     @material_window.set(item, recipe(item)) if @material_window
  672.   end
  673.   #--------------------------------------------------------------------------
  674.   # ● ←→ ボタン(表示切替)が押されたときの処理
  675.   #--------------------------------------------------------------------------
  676.   def process_change_window
  677.     Sound.play_cursor
  678.     Input.update
  679.     call_handler(:change_window)
  680.   end
  681.   #--------------------------------------------------------------------------
  682.   # ● 決定やキャンセルなどのハンドリング処理
  683.   #--------------------------------------------------------------------------
  684.   def process_handling
  685.     super
  686.     if active
  687.       return process_change_window if handle?(:change_window) && Input.trigger?(:RIGHT)
  688.       return process_change_window if handle?(:change_window) && Input.trigger?(:LEFT)
  689.     end
  690.   end
  691. end
  692.  
  693.  
  694. #==============================================================================
  695. # ■ Window_ItemSynthesisMaterial
  696. #------------------------------------------------------------------------------
  697. #  合成画面で、合成に必要な素材を表示するウィンドウです。
  698. #==============================================================================
  699.  
  700. class Window_ItemSynthesisMaterial < Window_Base
  701.   #--------------------------------------------------------------------------
  702.   # ● オブジェクト初期化
  703.   #--------------------------------------------------------------------------
  704.   def initialize(x, y, width, height)
  705.     super(x, y, width, height)
  706.     @item = nil
  707.     refresh
  708.   end
  709.   #--------------------------------------------------------------------------
  710.   # ● リフレッシュ
  711.   #--------------------------------------------------------------------------
  712.   def refresh
  713.     contents.clear
  714.     draw_possession(4, 0)
  715.     draw_material_info(0, line_height * 2)
  716.   end
  717.   #--------------------------------------------------------------------------
  718.   # ● アイテムの設定
  719.   #--------------------------------------------------------------------------
  720.   def set(item, recipe)
  721.     @item = item
  722.     @recipe = recipe
  723.     @make_number = 1
  724.     refresh
  725.   end
  726.   #--------------------------------------------------------------------------
  727.   # ● 作成個数の設定
  728.   #--------------------------------------------------------------------------
  729.   def set_num(make_number)
  730.     @make_number = make_number
  731.     refresh
  732.   end
  733.   #--------------------------------------------------------------------------
  734.   # ● 所持数の描画
  735.   #--------------------------------------------------------------------------
  736.   def draw_possession(x, y)
  737.     rect = Rect.new(x, y, contents.width - 4 - x, line_height)
  738.     change_color(system_color)
  739.     draw_text(rect, Vocab::Possession)
  740.     change_color(normal_color)
  741.     draw_text(rect, $game_party.item_number(@item), 2)
  742.   end
  743.   #--------------------------------------------------------------------------
  744.   # ● 素材情報の描画
  745.   #--------------------------------------------------------------------------
  746.   def draw_material_info(x, y)
  747.     rect = Rect.new(x, y, contents.width, line_height)
  748.     change_color(system_color)
  749.     contents.font.size = 18
  750.     draw_text(rect, "必要素材", 0)
  751.     if @recipe
  752.       for i in [email]1...@recipe.size[/email]
  753.         kind = @recipe[i][0]
  754.         id   = @recipe[i][1]
  755.         num  = @recipe[i][2]
  756.         if kind == "I"
  757.           item = $data_items[id]
  758.         elsif kind == "W"
  759.           item = $data_weapons[id]
  760.         elsif kind == "A"
  761.           item = $data_armors[id]
  762.         end
  763.         rect = Rect.new(x, y + line_height*i, contents.width, line_height)
  764.         enabled = true
  765.         enabled = false if [num*@make_number, 1].max  > $game_party.item_number(item)
  766.         draw_item_name(item, rect.x, rect.y, enabled)
  767.         change_color(normal_color, enabled)
  768.         if num > 0
  769.           draw_text(rect, "#{num*@make_number}/#{$game_party.item_number(item)}", 2)
  770.         end
  771.       end
  772.     end
  773.     change_color(normal_color)
  774.     contents.font.size = 24
  775.   end
  776. end
  777.  
  778.  
  779. #==============================================================================
  780. # ■ Window_ItemSynthesisNumber
  781. #------------------------------------------------------------------------------
  782. #  合成画面で、合成するアイテムの個数を入力するウィンドウです。
  783. #==============================================================================
  784.  
  785. class Window_ItemSynthesisNumber < Window_ShopNumber
  786.   #--------------------------------------------------------------------------
  787.   # ● リフレッシュ
  788.   #--------------------------------------------------------------------------
  789.   def refresh
  790.     contents.clear
  791.     draw_item_name(@item, 0, item_y)
  792.     draw_number
  793.     draw_total_price if WD_itemsynthesis_ini::Cost_view
  794.   end
  795.   #--------------------------------------------------------------------------
  796.   # ● オブジェクト初期化
  797.   #--------------------------------------------------------------------------
  798.   def material_window=(material_window)
  799.     @material_window = material_window
  800.     call_update_help
  801.   end
  802.   #--------------------------------------------------------------------------
  803.   # ● 作成個数の変更
  804.   #--------------------------------------------------------------------------
  805.   def change_number(amount)
  806.     @number = [[@number + amount, @max].min, 1].max
  807.     call_update_help #追加
  808.   end
  809.   #--------------------------------------------------------------------------
  810.   # ● ヘルプテキスト更新
  811.   #--------------------------------------------------------------------------
  812.   def call_update_help
  813.     @material_window.set_num(@number) if @material_window
  814.   end
  815. end
  816.  
  817.  
  818. #==============================================================================
  819. # ■ Window_ItemSynthesisCategory
  820. #------------------------------------------------------------------------------
  821. #  合成画面で、通常アイテムや装備品の分類を選択するウィンドウです。
  822. #==============================================================================
  823.  
  824. class Window_ItemSynthesisCategory < Window_ItemCategory
  825.   #--------------------------------------------------------------------------
  826.   # ● 桁数の取得
  827.   #--------------------------------------------------------------------------
  828.   def col_max
  829.     i = 0
  830.     i += 1 if WD_itemsynthesis_ini::Category_i
  831.     i += 1 if WD_itemsynthesis_ini::Category_w
  832.     i += 1 if WD_itemsynthesis_ini::Category_a
  833.     i += 1 if WD_itemsynthesis_ini::Category_k
  834.     return i
  835.   end
  836.   #--------------------------------------------------------------------------
  837.   # ● コマンドリストの作成
  838.   #--------------------------------------------------------------------------
  839.   def make_command_list
  840.     add_command(Vocab::item,     :item)     if WD_itemsynthesis_ini::Category_i
  841.     add_command(Vocab::weapon,   :weapon)   if WD_itemsynthesis_ini::Category_w
  842.     add_command(Vocab::armor,    :armor)    if WD_itemsynthesis_ini::Category_a
  843.     add_command(Vocab::key_item, :key_item) if WD_itemsynthesis_ini::Category_k
  844.   end
  845. end
  846.  
  847.  
  848. #==============================================================================
  849. # ■ Window_ItemSynthesisNumber
  850. #------------------------------------------------------------------------------
  851. #  合成画面で、切替を表示するウィンドウです。
  852. #==============================================================================
  853.  
  854. class Window_ItemSynthesisChange < Window_Base
  855.   #--------------------------------------------------------------------------
  856.   # ● オブジェクト初期化
  857.   #--------------------------------------------------------------------------
  858.   def initialize(x, y, width, height)
  859.     super(x, y, width, height)
  860.     refresh
  861.   end
  862.   #--------------------------------------------------------------------------
  863.   # ● リフレッシュ
  864.   #--------------------------------------------------------------------------
  865.   def refresh
  866.     contents.clear
  867.     text = "← → :表示切替"
  868.     draw_text(0, 0, contents_width, line_height, text, 1)
  869.   end
  870. end



以上是脚本,请各位看看有些什么问题。
然后呢,下面是错误的图片。
最后如果有什么需要我的工程的[qq]745032031[/qq]  加我qq ,745032031.
望有答案。  

QQ截图20130913215903.png (7.37 KB, 下载次数: 17)

QQ截图20130913215903.png

作者: 喵呜喵5    时间: 2013-9-13 22:13
把出错那行被论坛自动添加的[url=][/url]这两个中括号及其内容删掉




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1