查看: 4166|回复: 4

[已经解决] 如何将合成商店化?

[复制链接]

闇吼者の災悪眷族

梦石
0
星屑
1366
在线时间
2881 小时
注册时间
2014-7-29
回帖
6408
发表于 2014-7-31 15:47:28 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
呃,我之前发过一个类似的帖子,但是还是碰到了一些问题。

之前得到的解答还不大能完美的解决。

希望能有一个脚本做到,在玩家调查一个物件时打开一个列表,列表会列出所有合成配方,然后玩家选择配方后会扣除持有物,得到合成物品。

在论坛里有搜索到有类似脚本的帖子,不过我打开那些帖子游览器就整个卡住了……

点评

去掉链接后面的 highlight=xxxxx 再打开  发表于 2014-7-31 15:48

闇吼者の災悪眷族

梦石
0
星屑
1366
在线时间
2881 小时
注册时间
2014-7-29
回帖
6408
 楼主| 发表于 2014-8-6 23:12:58 | 显示全部楼层
啊啊,对了。

我通过使用两个不同的合成系统已经解决问题了。
这里是思路的原帖https://rpg.blue/forum.php?mod=v ... B%E5%95%86%E5%BA%97

在这里我把思路写出来希望能给以后碰到相似问题的人提供帮助。

思路是使用事件脚本呼出合成界面,然后添加所有的合成公式,在合成完成(即退出合成界面)后再删除全部的合成公式。
同理,在设置事件的时候只添加部分合成公式就可以限制玩家当前阶段所能合成的物品的种类。

事件设置列举是这样的
QQ图片20140806225636.jpg

这个合成脚本我使用的是 白の魔 的
脚本也顺便附上
原址大概是翻墙才能看。
在必要的地方我做了一点翻译。

  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. module WD_itemsynthesis_ini
  18.   
  19.   Cost_view =  true #費用(G)の表示(合成の費用が全て0Gの場合はfalseを推奨)
  20.   
  21.   Category_i = true #カテゴリウィンドウに「アイテム」の項目を表示
  22.   Category_w = true #カテゴリウィンドウに「武器」の項目を表示
  23.   Category_a = true #カテゴリウィンドウに「防具」の項目を表示
  24.   Category_k = true #カテゴリウィンドウに「大事なもの」の項目を表示
  25.   
  26.   I_recipe = [] #この行は削除しないこと
  27.   W_recipe = [] #この行は削除しないこと
  28.   A_recipe = [] #この行は削除しないこと
  29.   
  30.   #以下、合成レシピ。
  31.   #例: I_recipe[3]  = [100, ["I",1,1], ["W",2,1], ["A",2,2], ["A",3,1]]
  32.   #と記載した場合、ID3のアイテムの合成必要は、100G。(ID为3的道具合成需要花费100G)
  33.   #必要な素材は、ID1のアイテム1個、ID2の武器1個、ID2の防具2個、ID3の防具1個(合成所需的素材为ID为1的物品1个、ID为1的武器1个、ID为2的防具2个、ID为3的防具1个)
  34.   #となる。
  35.   
  36. #这里下面几个是默认的几个公式,可以删除或者修改
  37.   #アイテムの合成レシピ
  38.   I_recipe[1]  = [10,  ["I",2,2]]
  39.   I_recipe[3]  = [100, ["I",1,1], ["I",2,1]]
  40.   I_recipe[17] = [500, ["I",1,10]]

  41.   #武器の合成レシピ
  42.   W_recipe[3]  = [50,   ["W",1,1], ["W",2,1]]
  43.   W_recipe[6]  = [600,  ["W",3,1], ["I",17,0]]
  44.   
  45.   #防具の合成レシピ  
  46.   A_recipe[2]  = [40,   ["A",1,2]]
  47.   A_recipe[5]  = [400,  ["A",2,1], ["W",2,2], ["I",17,0]]
  48.   

  49.   
  50. end


  51. #==============================================================================
  52. # ■ WD_itemsynthesis
  53. #------------------------------------------------------------------------------
  54. #  アイテム合成用の共通メソッドです。
  55. #==============================================================================

  56. module WD_itemsynthesis
  57.   def i_recipe_switch_on(id)
  58.     $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  59.     $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  60.     $game_system.i_rcp_sw[id] = true
  61.   end
  62.   def i_recipe_switch_off(id)
  63.     $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  64.     $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  65.     $game_system.i_rcp_sw[id] = false
  66.   end
  67.   def i_recipe_switch_on?(id)
  68.     $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  69.     $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  70.     return $game_system.i_rcp_sw[id]
  71.   end
  72.   def i_recipe_all_switch_on
  73.     for i in 1..$data_items.size
  74.       i_recipe_switch_on(i)
  75.     end
  76.   end
  77.   def i_recipe_all_switch_off
  78.     for i in 1..$data_items.size
  79.       i_recipe_switch_off(i)
  80.     end
  81.   end
  82.   def w_recipe_switch_on(id)
  83.     $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  84.     $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  85.     $game_system.w_rcp_sw[id] = true
  86.   end
  87.   def w_recipe_switch_off(id)
  88.     $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  89.     $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  90.     $game_system.w_rcp_sw[id] = false
  91.   end
  92.   def w_recipe_switch_on?(id)
  93.     $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  94.     $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  95.     return $game_system.w_rcp_sw[id]
  96.   end
  97.   def w_recipe_all_switch_on
  98.     for i in 1..$data_weapons.size
  99.       w_recipe_switch_on(i)
  100.     end
  101.   end
  102.   def w_recipe_all_switch_off
  103.     for i in 1..$data_weapons.size
  104.       w_recipe_switch_off(i)
  105.     end
  106.   end
  107.   def a_recipe_switch_on(id)
  108.     $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  109.     $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  110.     $game_system.a_rcp_sw[id] = true
  111.   end
  112.   def a_recipe_switch_off(id)
  113.     $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  114.     $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  115.     $game_system.a_rcp_sw[id] = false
  116.   end
  117.   def a_recipe_switch_on?(id)
  118.     $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  119.     $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  120.     return $game_system.a_rcp_sw[id]
  121.   end
  122.   def a_recipe_all_switch_on
  123.     for i in 1..$data_armors.size
  124.       a_recipe_switch_on(i)
  125.     end
  126.   end
  127.   def a_recipe_all_switch_off
  128.     for i in 1..$data_armors.size
  129.       a_recipe_switch_off(i)
  130.     end
  131.   end
  132.   def recipe_all_switch_on
  133.     i_recipe_all_switch_on
  134.     w_recipe_all_switch_on
  135.     a_recipe_all_switch_on
  136.   end
  137.   def recipe_all_switch_off
  138.     i_recipe_all_switch_off
  139.     w_recipe_all_switch_off
  140.     a_recipe_all_switch_off
  141.   end

  142. end

  143. class Game_Interpreter
  144.   include WD_itemsynthesis
  145. end

  146. class Game_System
  147.   #--------------------------------------------------------------------------
  148.   # ● 公開インスタンス変数
  149.   #--------------------------------------------------------------------------
  150.   attr_accessor :i_rcp_sw
  151.   attr_accessor :w_rcp_sw
  152.   attr_accessor :a_rcp_sw
  153.   #--------------------------------------------------------------------------
  154.   # ● オブジェクト初期化
  155.   #--------------------------------------------------------------------------
  156.   alias wd_orig_initialize004 initialize
  157.   def initialize
  158.     wd_orig_initialize004
  159.     @i_rcp_sw = []
  160.     @w_rcp_sw = []
  161.     @a_rcp_sw = []
  162.   end
  163. end


  164. #==============================================================================
  165. # ■ Scene_ItemSynthesis
  166. #------------------------------------------------------------------------------
  167. #  合成画面の処理を行うクラスです。
  168. #==============================================================================

  169. class Scene_ItemSynthesis < Scene_MenuBase
  170.   #--------------------------------------------------------------------------
  171.   # ● 開始処理
  172.   #--------------------------------------------------------------------------
  173.   def start
  174.     super
  175.    
  176.     create_help_window
  177.     create_dummy_window
  178.     create_number_window
  179.     create_status_window
  180.     create_material_window
  181.     create_list_window
  182.     create_category_window
  183.     create_gold_window
  184.     create_change_window
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # ● ゴールドウィンドウの作成
  188.   #--------------------------------------------------------------------------
  189.   def create_gold_window
  190.     @gold_window = Window_Gold.new
  191.     @gold_window.viewport = @viewport
  192.     @gold_window.x = Graphics.width - @gold_window.width
  193.     @gold_window.y = @help_window.height
  194.     @gold_window.hide
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # ● 切り替え表示ウィンドウの作成
  198.   #--------------------------------------------------------------------------
  199.   def create_change_window
  200.     wx = 0
  201.     wy = @gold_window.y
  202.     ww = Graphics.width - @gold_window.width
  203.     wh = @gold_window.height
  204.     @change_window = Window_ItemSynthesisChange.new(wx, wy, ww, wh)
  205.     @change_window.viewport = @viewport
  206.     @change_window.hide
  207.   end
  208.   #--------------------------------------------------------------------------
  209.   # ● ダミーウィンドウの作成
  210.   #--------------------------------------------------------------------------
  211.   def create_dummy_window
  212.     wy = @help_window.y + @help_window.height + 48
  213.     wh = Graphics.height - wy
  214.     @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
  215.     @dummy_window.viewport = @viewport
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● 個数入力ウィンドウの作成
  219.   #--------------------------------------------------------------------------
  220.   def create_number_window
  221.     wy = @dummy_window.y
  222.     wh = @dummy_window.height
  223.     @number_window = Window_ItemSynthesisNumber.new(0, wy, wh)
  224.     @number_window.viewport = @viewport
  225.     @number_window.hide
  226.     @number_window.set_handler(:ok,     method(:on_number_ok))
  227.     @number_window.set_handler(:cancel, method(:on_number_cancel))
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # ● ステータスウィンドウの作成
  231.   #--------------------------------------------------------------------------
  232.   def create_status_window
  233.     wx = @number_window.width
  234.     wy = @dummy_window.y
  235.     ww = Graphics.width - wx
  236.     wh = @dummy_window.height
  237.     @status_window = Window_ShopStatus.new(wx, wy, ww, wh)
  238.     @status_window.viewport = @viewport
  239.     @status_window.hide
  240.   end
  241.   #--------------------------------------------------------------------------
  242.   # ● 素材ウィンドウの作成
  243.   #--------------------------------------------------------------------------
  244.   def create_material_window
  245.     wx = @number_window.width
  246.     wy = @dummy_window.y
  247.     ww = Graphics.width - wx
  248.     wh = @dummy_window.height
  249.     @material_window = Window_ItemSynthesisMaterial.new(wx, wy, ww, wh)
  250.     @material_window.viewport = @viewport
  251.     @material_window.hide
  252.     @number_window.material_window = @material_window
  253.   end
  254.   #--------------------------------------------------------------------------
  255.   # ● 合成アイテムリストウィンドウの作成
  256.   #--------------------------------------------------------------------------
  257.   def create_list_window
  258.     wy = @dummy_window.y
  259.     wh = @dummy_window.height
  260.     @list_window = Window_ItemSynthesisList.new(0, wy, wh)
  261.     @list_window.viewport = @viewport
  262.     @list_window.help_window = @help_window
  263.     @list_window.status_window = @status_window
  264.     @list_window.material_window = @material_window
  265.     @list_window.hide
  266.     @list_window.set_handler(:ok,     method(:on_list_ok))
  267.     @list_window.set_handler(:cancel, method(:on_list_cancel))
  268.     @list_window.set_handler(:change_window, method(:on_change_window))   
  269.   end
  270.   #--------------------------------------------------------------------------
  271.   # ● カテゴリウィンドウの作成
  272.   #--------------------------------------------------------------------------
  273.   def create_category_window
  274.     @category_window = Window_ItemSynthesisCategory.new
  275.     @category_window.viewport = @viewport
  276.     @category_window.help_window = @help_window
  277.     @category_window.y = @help_window.height
  278.     @category_window.activate
  279.     @category_window.item_window = @list_window
  280.     @category_window.set_handler(:ok,     method(:on_category_ok))
  281.     @category_window.set_handler(:cancel, method(:return_scene))
  282.   end
  283.   
  284.   def return_scene
  285.     $game_map.autoplay
  286.     SceneManager.return
  287.   end
  288.   
  289.   #--------------------------------------------------------------------------
  290.   # ● 合成アイテムリストウィンドウのアクティブ化
  291.   #--------------------------------------------------------------------------
  292.   def activate_list_window
  293.     @list_window.money = money
  294.     @list_window.show.activate
  295.   end
  296.   #--------------------------------------------------------------------------
  297.   # ● 合成[決定]
  298.   #--------------------------------------------------------------------------
  299.   def on_list_ok
  300.     @item = @list_window.item
  301.     @list_window.hide
  302.     @number_window.set(@item, max_buy, buying_price, currency_unit)
  303.     @number_window.show.activate
  304.   end
  305.   #--------------------------------------------------------------------------
  306.   # ● 合成[キャンセル]
  307.   #--------------------------------------------------------------------------
  308.   def on_list_cancel
  309.     @category_window.activate
  310.     @category_window.show
  311.     @dummy_window.show
  312.     @list_window.hide
  313.     @status_window.hide
  314.     @status_window.item = nil
  315.     @material_window.hide
  316.     @material_window.set(nil, nil)
  317.     @gold_window.hide
  318.     @change_window.hide
  319.     @help_window.clear
  320.   end
  321.   #--------------------------------------------------------------------------
  322.   # ● 表示切替
  323.   #--------------------------------------------------------------------------
  324.   def on_change_window
  325.     if @status_window.visible
  326.       @status_window.hide
  327.       @material_window.show
  328.     else
  329.       @status_window.show
  330.       @material_window.hide
  331.     end
  332.   end
  333.   #--------------------------------------------------------------------------
  334.   # ● カテゴリ[決定]
  335.   #--------------------------------------------------------------------------
  336.   def on_category_ok
  337.     activate_list_window
  338.     @gold_window.show
  339.     @change_window.show
  340.     @material_window.show
  341.     @category_window.hide
  342.     @list_window.select(0)
  343.   end
  344.   #--------------------------------------------------------------------------
  345.   # ● 個数入力[決定]
  346.   #--------------------------------------------------------------------------
  347.   def on_number_ok
  348.     Sound.play_shop
  349.     do_syntetic(@number_window.number)
  350.     end_number_input
  351.     @gold_window.refresh
  352.   end
  353.   #--------------------------------------------------------------------------
  354.   # ● 個数入力[キャンセル]
  355.   #--------------------------------------------------------------------------
  356.   def on_number_cancel
  357.     Sound.play_cancel
  358.     end_number_input
  359.   end
  360.   #--------------------------------------------------------------------------
  361.   # ● 合成の実行
  362.   #--------------------------------------------------------------------------
  363.   def do_syntetic(number)
  364.     $game_party.lose_gold(number * buying_price)
  365.     $game_party.gain_item(@item, number)
  366.    
  367.       [url=home.php?mod=space&uid=2564094]@recipe[/url] = @list_window.recipe(@item)
  368.       for i in [email]1...@recipe.size[/email]
  369.         kind = @recipe[i][0]
  370.         id   = @recipe[i][1]
  371.         num  = @recipe[i][2]
  372.         if kind == "I"
  373.           item = $data_items[id]
  374.         elsif kind == "W"
  375.           item = $data_weapons[id]
  376.         elsif kind == "A"
  377.           item = $data_armors[id]
  378.         end
  379.         $game_party.lose_item(item, num*number)
  380.       end
  381.   end
  382.   #--------------------------------------------------------------------------
  383.   # ● 個数入力の終了
  384.   #--------------------------------------------------------------------------
  385.   def end_number_input
  386.     @number_window.hide
  387.     activate_list_window
  388.   end
  389.   #--------------------------------------------------------------------------
  390.   # ● 最大購入可能個数の取得
  391.   #--------------------------------------------------------------------------
  392.   def max_buy
  393.     max = $game_party.max_item_number(@item) - $game_party.item_number(@item)
  394.    
  395.     @recipe = @list_window.recipe(@item)
  396.       for i in [email]1...@recipe.size[/email]
  397.         kind = @recipe[i][0]
  398.         id   = @recipe[i][1]
  399.         num  = @recipe[i][2]
  400.         if kind == "I"
  401.           item = $data_items[id]
  402.         elsif kind == "W"
  403.           item = $data_weapons[id]
  404.         elsif kind == "A"
  405.           item = $data_armors[id]
  406.         end
  407.         if num > 0
  408.           max_buf = $game_party.item_number(item)/num
  409.         else
  410.           max_buf = 999
  411.         end
  412.         max = [max, max_buf].min
  413.       end
  414.       
  415.     buying_price == 0 ? max : [max, money / buying_price].min

  416.   end
  417.   #--------------------------------------------------------------------------
  418.   # ● 所持金の取得
  419.   #--------------------------------------------------------------------------
  420.   def money
  421.     @gold_window.value
  422.   end
  423.   #--------------------------------------------------------------------------
  424.   # ● 通貨単位の取得
  425.   #--------------------------------------------------------------------------
  426.   def currency_unit
  427.     @gold_window.currency_unit
  428.   end
  429.   #--------------------------------------------------------------------------
  430.   # ● 合成費用の取得
  431.   #--------------------------------------------------------------------------
  432.   def buying_price
  433.     @list_window.price(@item)
  434.   end
  435. end


  436. #==============================================================================
  437. # ■ Window_ItemSynthesisList
  438. #------------------------------------------------------------------------------
  439. #  合成画面で、合成可能なアイテムの一覧を表示するウィンドウです。
  440. #==============================================================================

  441. class Window_ItemSynthesisList < Window_Selectable
  442.   include WD_itemsynthesis
  443.   #--------------------------------------------------------------------------
  444.   # ● 公開インスタンス変数
  445.   #--------------------------------------------------------------------------
  446.   attr_reader   :status_window            # ステータスウィンドウ
  447.   #--------------------------------------------------------------------------
  448.   # ● オブジェクト初期化
  449.   #--------------------------------------------------------------------------
  450.   def initialize(x, y, height)
  451.     super(x, y, window_width, height)
  452.    
  453.     @shop_goods = []
  454.     @shop_recipes = []
  455.    
  456.     for i in 1..WD_itemsynthesis_ini::I_recipe.size
  457.       recipe = WD_itemsynthesis_ini::I_recipe[i]
  458.       if recipe
  459.         good = [0, i, recipe[0]]
  460.         if i_recipe_switch_on?(i)
  461.           @shop_goods.push(good)
  462.           @shop_recipes.push(recipe)
  463.         end
  464.       end
  465.     end
  466.     for i in 1..WD_itemsynthesis_ini::W_recipe.size
  467.       recipe = WD_itemsynthesis_ini::W_recipe[i]
  468.       if recipe
  469.         good = [1, i, recipe[0]]
  470.         if w_recipe_switch_on?(i)
  471.           @shop_goods.push(good)
  472.           @shop_recipes.push(recipe)
  473.         end
  474.       end
  475.     end
  476.     for i in 1..WD_itemsynthesis_ini::A_recipe.size
  477.       recipe = WD_itemsynthesis_ini::A_recipe[i]
  478.       if recipe
  479.         good = [2, i, recipe[0]]
  480.         if a_recipe_switch_on?(i)
  481.           @shop_goods.push(good)
  482.           @shop_recipes.push(recipe)
  483.         end
  484.       end
  485.     end
  486.    
  487.     [url=home.php?mod=space&uid=26101]@Money[/url] = 0
  488.     refresh
  489.     select(0)
  490.   end
  491.   #--------------------------------------------------------------------------
  492.   # ● ウィンドウ幅の取得
  493.   #--------------------------------------------------------------------------
  494.   def window_width
  495.     return 304
  496.   end
  497.   #--------------------------------------------------------------------------
  498.   # ● 項目数の取得
  499.   #--------------------------------------------------------------------------
  500.   def item_max
  501.     @data ? @data.size : 1
  502.   end
  503.   #--------------------------------------------------------------------------
  504.   # ● アイテムの取得
  505.   #--------------------------------------------------------------------------
  506.   def item
  507.     @data[index]
  508.   end
  509.   #--------------------------------------------------------------------------
  510.   # ● 所持金の設定
  511.   #--------------------------------------------------------------------------
  512.   def money=(money)
  513.     @money = money
  514.     refresh
  515.   end
  516.   #--------------------------------------------------------------------------
  517.   # ● 選択項目の有効状態を取得
  518.   #--------------------------------------------------------------------------
  519.   def current_item_enabled?
  520.     enable?(@data[index])
  521.   end
  522.   #--------------------------------------------------------------------------
  523.   # ● 合成費用を取得
  524.   #--------------------------------------------------------------------------
  525.   def price(item)
  526.     @price[item]
  527.   end
  528.   #--------------------------------------------------------------------------
  529.   # ● 合成可否を取得
  530.   #--------------------------------------------------------------------------
  531.   def enable?(item)
  532.     @makable[item]
  533.   end
  534.   #--------------------------------------------------------------------------
  535.   # ● レシピを取得
  536.   #--------------------------------------------------------------------------
  537.   def recipe(item)
  538.     @recipe[item]
  539.   end
  540.   #--------------------------------------------------------------------------
  541.   # ● アイテムを許可状態で表示するかどうか
  542.   #--------------------------------------------------------------------------
  543.   def have_mat?(recipe)
  544.     flag = true
  545.     if @money >= recipe[0]
  546.       for i in 1...recipe.size
  547.         kind = recipe[i][0]
  548.         id   = recipe[i][1]
  549.         num  = recipe[i][2]
  550.         if kind == "I"
  551.           item = $data_items[id]
  552.         elsif kind == "W"
  553.           item = $data_weapons[id]
  554.         elsif kind == "A"
  555.           item = $data_armors[id]
  556.         end
  557.         if $game_party.item_number(item) < [num, 1].max
  558.           flag = false
  559.         end
  560.       end
  561.     else
  562.       flag = false
  563.     end
  564.     return flag
  565.   end
  566.   #--------------------------------------------------------------------------
  567.   # ● カテゴリの設定
  568.   #--------------------------------------------------------------------------
  569.   def category=(category)
  570.     return if @category == category
  571.     @category = category
  572.     refresh
  573.   end
  574.   #--------------------------------------------------------------------------
  575.   # ● リフレッシュ
  576.   #--------------------------------------------------------------------------
  577.   def refresh
  578.     make_item_list
  579.     create_contents
  580.     draw_all_items
  581.   end
  582.   #--------------------------------------------------------------------------
  583.   # ● アイテムをリストに含めるかどうか
  584.   #--------------------------------------------------------------------------
  585.   def include?(item)
  586.     case @category
  587.     when :item
  588.       item.is_a?(RPG::Item) && !item.key_item?
  589.     when :weapon
  590.       item.is_a?(RPG::Weapon)
  591.     when :armor
  592.       item.is_a?(RPG::Armor)
  593.     when :key_item
  594.       item.is_a?(RPG::Item) && item.key_item?
  595.     else
  596.       false
  597.     end
  598.   end
  599.   #--------------------------------------------------------------------------
  600.   # ● アイテムリストの作成
  601.   #--------------------------------------------------------------------------
  602.   def make_item_list
  603.     @data = []
  604.     @price = {}
  605.     @makable = {}
  606.     @recipe = {}
  607.     for i in [email]0...@shop_goods.size[/email]
  608.       goods = @shop_goods[i]
  609.       recipe = @shop_recipes[i]
  610.       case goods[0]
  611.       when 0;  item = $data_items[goods[1]]
  612.       when 1;  item = $data_weapons[goods[1]]
  613.       when 2;  item = $data_armors[goods[1]]
  614.       end
  615.       if item
  616.         if include?(item)
  617.           @data.push(item)
  618.           @price[item] = goods[2]
  619.           @makable[item] = have_mat?(recipe)
  620.           @recipe[item] = recipe
  621.         end
  622.       end
  623.     end
  624.   end
  625.   #--------------------------------------------------------------------------
  626.   # ● 項目の描画
  627.   #--------------------------------------------------------------------------
  628.   def draw_item(index)
  629.     item = @data[index]
  630.     rect = item_rect(index)
  631.     draw_item_name(item, rect.x, rect.y, enable?(item))
  632.     rect.width -= 4
  633.     draw_text(rect, price(item), 2)  if WD_itemsynthesis_ini::Cost_view
  634.   end
  635.   #--------------------------------------------------------------------------
  636.   # ● ステータスウィンドウの設定
  637.   #--------------------------------------------------------------------------
  638.   def status_window=(status_window)
  639.     @status_window = status_window
  640.     call_update_help
  641.   end
  642.   #--------------------------------------------------------------------------
  643.   # ● 素材ウィンドウの設定
  644.   #--------------------------------------------------------------------------
  645.   def material_window=(material_window)
  646.     @material_window = material_window
  647.     call_update_help
  648.   end
  649.   #--------------------------------------------------------------------------
  650.   # ● ヘルプテキスト更新
  651.   #--------------------------------------------------------------------------
  652.   def update_help
  653.     @help_window.set_item(item) if @help_window
  654.     @status_window.item = item if @status_window
  655.     @material_window.set(item, recipe(item)) if @material_window
  656.   end
  657.   #--------------------------------------------------------------------------
  658.   # ● ←→ ボタン(表示切替)が押されたときの処理
  659.   #--------------------------------------------------------------------------
  660.   def process_change_window
  661.     Sound.play_cursor
  662.     Input.update
  663.     call_handler(:change_window)
  664.   end
  665.   #--------------------------------------------------------------------------
  666.   # ● 決定やキャンセルなどのハンドリング処理
  667.   #--------------------------------------------------------------------------
  668.   def process_handling
  669.     super
  670.     if active
  671.       return process_change_window if handle?(:change_window) && Input.trigger?(:RIGHT)
  672.       return process_change_window if handle?(:change_window) && Input.trigger?(:LEFT)
  673.     end
  674.   end
  675. end


  676. #==============================================================================
  677. # ■ Window_ItemSynthesisMaterial
  678. #------------------------------------------------------------------------------
  679. #  合成画面で、合成に必要な素材を表示するウィンドウです。
  680. #==============================================================================

  681. class Window_ItemSynthesisMaterial < Window_Base
  682.   #--------------------------------------------------------------------------
  683.   # ● オブジェクト初期化
  684.   #--------------------------------------------------------------------------
  685.   def initialize(x, y, width, height)
  686.     super(x, y, width, height)
  687.     @item = nil
  688.     refresh
  689.   end
  690.   #--------------------------------------------------------------------------
  691.   # ● リフレッシュ
  692.   #--------------------------------------------------------------------------
  693.   def refresh
  694.     contents.clear
  695.     draw_possession(4, 0)
  696.     draw_material_info(0, line_height * 2)
  697.   end
  698.   #--------------------------------------------------------------------------
  699.   # ● アイテムの設定
  700.   #--------------------------------------------------------------------------
  701.   def set(item, recipe)
  702.     @item = item
  703.     @recipe = recipe
  704.     @make_number = 1
  705.     refresh
  706.   end
  707.   #--------------------------------------------------------------------------
  708.   # ● 作成個数の設定
  709.   #--------------------------------------------------------------------------
  710.   def set_num(make_number)
  711.     @make_number = make_number
  712.     refresh
  713.   end
  714.   #--------------------------------------------------------------------------
  715.   # ● 所持数の描画
  716.   #--------------------------------------------------------------------------
  717.   def draw_possession(x, y)
  718.     rect = Rect.new(x, y, contents.width - 4 - x, line_height)
  719.     change_color(system_color)
  720.     draw_text(rect, Vocab::Possession)
  721.     change_color(normal_color)
  722.     draw_text(rect, $game_party.item_number(@item), 2)
  723.   end
  724.   #--------------------------------------------------------------------------
  725.   # ● 素材情報の描画
  726.   #--------------------------------------------------------------------------
  727.   def draw_material_info(x, y)
  728.     rect = Rect.new(x, y, contents.width, line_height)
  729.     change_color(system_color)
  730.     contents.font.size = 18
  731.     draw_text(rect, "必要素材", 0)
  732.     if @recipe
  733.       for i in [email]1...@recipe.size[/email]
  734.         kind = @recipe[i][0]
  735.         id   = @recipe[i][1]
  736.         num  = @recipe[i][2]
  737.         if kind == "I"
  738.           item = $data_items[id]
  739.         elsif kind == "W"
  740.           item = $data_weapons[id]
  741.         elsif kind == "A"
  742.           item = $data_armors[id]
  743.         end
  744.         rect = Rect.new(x, y + line_height*i, contents.width, line_height)
  745.         enabled = true
  746.         enabled = false if [num*@make_number, 1].max  > $game_party.item_number(item)
  747.         draw_item_name(item, rect.x, rect.y, enabled)
  748.         change_color(normal_color, enabled)
  749.         if num > 0
  750.           draw_text(rect, "#{num*@make_number}/#{$game_party.item_number(item)}", 2)
  751.         end
  752.       end
  753.     end
  754.     change_color(normal_color)
  755.     contents.font.size = 24
  756.   end
  757. end


  758. #==============================================================================
  759. # ■ Window_ItemSynthesisNumber
  760. #------------------------------------------------------------------------------
  761. #  合成画面で、合成するアイテムの個数を入力するウィンドウです。
  762. #==============================================================================

  763. class Window_ItemSynthesisNumber < Window_ShopNumber
  764.   #--------------------------------------------------------------------------
  765.   # ● リフレッシュ
  766.   #--------------------------------------------------------------------------
  767.   def refresh
  768.     contents.clear
  769.     draw_item_name(@item, 0, item_y)
  770.     draw_number
  771.     draw_total_price if WD_itemsynthesis_ini::Cost_view
  772.   end
  773.   #--------------------------------------------------------------------------
  774.   # ● オブジェクト初期化
  775.   #--------------------------------------------------------------------------
  776.   def material_window=(material_window)
  777.     @material_window = material_window
  778.     call_update_help
  779.   end
  780.   #--------------------------------------------------------------------------
  781.   # ● 作成個数の変更
  782.   #--------------------------------------------------------------------------
  783.   def change_number(amount)
  784.     @number = [[@number + amount, @max].min, 1].max
  785.     call_update_help #追加
  786.   end
  787.   #--------------------------------------------------------------------------
  788.   # ● ヘルプテキスト更新
  789.   #--------------------------------------------------------------------------
  790.   def call_update_help
  791.     @material_window.set_num(@number) if @material_window
  792.   end
  793. end


  794. #==============================================================================
  795. # ■ Window_ItemSynthesisCategory
  796. #------------------------------------------------------------------------------
  797. #  合成画面で、通常アイテムや装備品の分類を選択するウィンドウです。
  798. #==============================================================================

  799. class Window_ItemSynthesisCategory < Window_ItemCategory
  800.   #--------------------------------------------------------------------------
  801.   # ● 桁数の取得
  802.   #--------------------------------------------------------------------------
  803.   def col_max
  804.     i = 0
  805.     i += 1 if WD_itemsynthesis_ini::Category_i
  806.     i += 1 if WD_itemsynthesis_ini::Category_w
  807.     i += 1 if WD_itemsynthesis_ini::Category_a
  808.     i += 1 if WD_itemsynthesis_ini::Category_k
  809.     return i
  810.   end
  811.   #--------------------------------------------------------------------------
  812.   # ● コマンドリストの作成
  813.   #--------------------------------------------------------------------------
  814.   def make_command_list
  815.     add_command(Vocab::item,     :item)     if WD_itemsynthesis_ini::Category_i
  816.     add_command(Vocab::weapon,   :weapon)   if WD_itemsynthesis_ini::Category_w
  817.     add_command(Vocab::armor,    :armor)    if WD_itemsynthesis_ini::Category_a
  818.     add_command(Vocab::key_item, :key_item) if WD_itemsynthesis_ini::Category_k
  819.   end
  820. end


  821. #==============================================================================
  822. # ■ Window_ItemSynthesisNumber
  823. #------------------------------------------------------------------------------
  824. #  合成画面で、切替を表示するウィンドウです。
  825. #==============================================================================

  826. class Window_ItemSynthesisChange < Window_Base
  827.   #--------------------------------------------------------------------------
  828.   # ● オブジェクト初期化
  829.   #--------------------------------------------------------------------------
  830.   def initialize(x, y, width, height)
  831.     super(x, y, width, height)
  832.     refresh
  833.   end
  834.   #--------------------------------------------------------------------------
  835.   # ● リフレッシュ
  836.   #--------------------------------------------------------------------------
  837.   def refresh
  838.     contents.clear
  839.     text = "← → :显示转换"
  840.     draw_text(0, 0, contents_width, line_height, text, 1)
  841.   end
  842. end
复制代码
回复

使用道具 举报

梦石
0
星屑
760
在线时间
1 小时
注册时间
2015-12-23
回帖
2
发表于 2015-12-24 00:45:46 | 显示全部楼层
多谢楼主分享!
回复

使用道具 举报

梦石
0
星屑
760
在线时间
1 小时
注册时间
2015-12-23
回帖
2
发表于 2015-12-24 00:46:46 | 显示全部楼层
确实想做一个合成系统呢

评分

参与人数 1星屑 -30 收起 理由
taroxd -30 挖坟&amp;amp;无意义连贴

查看全部评分

回复

使用道具 举报

梦石
0
星屑
782
在线时间
3431 小时
注册时间
2011-6-10
回帖
6325
发表于 2015-12-24 07:33:13 | 显示全部楼层
合成本来就是调用商店 用开关控制 开关打开是合成 关闭是商店
长名公主玩家群:372588926 攻略娱乐应有尽有
了解更多新RM游戏,游戏制作请加入RPGmaker支援群:113622890
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部