查看: 4085|回复: 9

[已经解决] 合成腳本商店化

[复制链接]
梦石
0
星屑
52
在线时间
135 小时
注册时间
2011-11-5
回帖
49
发表于 2013-8-15 16:05:09 | 显示全部楼层 |阅读模式

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

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

×
1.合成腳本商店化
因為不同的事件(NPC)可合成的物品不同
所以想把合成腳本改成像「商店處理」一樣,可以選擇合成物品

2.因為我有用第二貨幣的腳本,所以在合成物品時,會擋到視窗,想更改視窗的大小,請問要怎麼更改
1.png

腳本如下
  1. # ★ 初期設定。
  2. #    設置合成配方
  3. #--------------------------------------------------------------------------
  4. module WD_itemsynthesis_ini
  5.   
  6.   Cost_view =  true #費用(G)の表示(合成の費用が全て0Gの場合はfalseを推■)
  7.   
  8.   Category_i = true #查看項目“項目”類別中的窗口
  9.   Category_w = true #查看項目類別窗口中的“武器”
  10.   Category_a = true #查看項目類別窗口中的“鎧甲”
  11.   Category_k = true #查看項目類別窗口中的“重要的東西”
  12.   
  13.   I_recipe = [] #この行は削除しないこと
  14.   W_recipe = [] #この行は削除しないこと
  15.   A_recipe = [] #この行は削除しないこと
  16.   
  17.   #以下、合成レシピ。
  18.   #例: I_recipe[3]  = [100, ["I",1,1], ["W",2,1], ["A",2,2], ["A",3,1]]
  19.   #と記載した場合、ID3のアイテムの合成必要は、100G。
  20.   #必要な素材は、ID1のアイテム1個、ID2の武器1個、ID2の防具2個、ID3の防具1個
  21.   #となる。
  22.   
  23.   #物品合成
  24.   I_recipe[58]  = [50,  ["I",53,5], ["I",55,5]]
  25.   I_recipe[60]  = [50,  ["I",52,5], ["I",54,7]]
  26.   I_recipe[61]  = [50,  ["I",52,3], ["I",54,3]]
  27.   I_recipe[62]  = [50,  ["I",53,10], ["I",55,7]]
  28.   I_recipe[64]  = [50,  ["I",52,13], ["I",53,10]]
  29.   I_recipe[65]  = [50,  ["I",53,19], ["I",56,16]]
  30.   I_recipe[67]  = [50,  ["I",52,14], ["I",54,18]]
  31.   I_recipe[70]  = [50,  ["I",58,20], ["I",59,18]]
  32.   I_recipe[71]  = [50,  ["I",58,21], ["I",59,16]]
  33.   I_recipe[72]  = [50,  ["I",60,14], ["I",61,22]]
  34.   I_recipe[73]  = [50,  ["I",61,17], ["I",62,19]]
  35.   I_recipe[78]  = [50,  ["I",66,24], ["I",67,26]]
  36.   I_recipe[79]  = [50,  ["I",64,27], ["I",65,25]]
  37.   #I_recipe[3]  = [100, ["I",1,1], ["I",2,1]]
  38.   #I_recipe[17] = [500, ["I",1,10]]

  39.   #武器合成
  40.   #W_recipe[6]  = [600,  ["W",3,1], ["I",17,0]]
  41.   
  42.   #防具合成
  43.   #A_recipe[5]  = [400,  ["A",2,1], ["W",2,2], ["I",17,0]]
  44.   
  45. end


  46. #==============================================================================
  47. # ■ WD_itemsynthesis
  48. #------------------------------------------------------------------------------
  49. #  アイテム合成用の共通メソッドです。
  50. #==============================================================================

  51. module WD_itemsynthesis
  52.   def i_recipe_switch_on(id)
  53.     $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  54.     $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  55.     $game_system.i_rcp_sw[id] = true
  56.   end
  57.   def i_recipe_switch_off(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] = false
  61.   end
  62.   def i_recipe_switch_on?(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.     return $game_system.i_rcp_sw[id]
  66.   end
  67.   def i_recipe_all_switch_on
  68.     for i in 1..$data_items.size
  69.       i_recipe_switch_on(i)
  70.     end
  71.   end
  72.   def i_recipe_all_switch_off
  73.     for i in 1..$data_items.size
  74.       i_recipe_switch_off(i)
  75.     end
  76.   end
  77.   def w_recipe_switch_on(id)
  78.     $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  79.     $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  80.     $game_system.w_rcp_sw[id] = true
  81.   end
  82.   def w_recipe_switch_off(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] = false
  86.   end
  87.   def w_recipe_switch_on?(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.     return $game_system.w_rcp_sw[id]
  91.   end
  92.   def w_recipe_all_switch_on
  93.     for i in 1..$data_weapons.size
  94.       w_recipe_switch_on(i)
  95.     end
  96.   end
  97.   def w_recipe_all_switch_off
  98.     for i in 1..$data_weapons.size
  99.       w_recipe_switch_off(i)
  100.     end
  101.   end
  102.   def a_recipe_switch_on(id)
  103.     $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  104.     $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  105.     $game_system.a_rcp_sw[id] = true
  106.   end
  107.   def a_recipe_switch_off(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] = false
  111.   end
  112.   def a_recipe_switch_on?(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.     return $game_system.a_rcp_sw[id]
  116.   end
  117.   def a_recipe_all_switch_on
  118.     for i in 1..$data_armors.size
  119.       a_recipe_switch_on(i)
  120.     end
  121.   end
  122.   def a_recipe_all_switch_off
  123.     for i in 1..$data_armors.size
  124.       a_recipe_switch_off(i)
  125.     end
  126.   end
  127.   def recipe_all_switch_on
  128.     i_recipe_all_switch_on
  129.     w_recipe_all_switch_on
  130.     a_recipe_all_switch_on
  131.   end
  132.   def recipe_all_switch_off
  133.     i_recipe_all_switch_off
  134.     w_recipe_all_switch_off
  135.     a_recipe_all_switch_off
  136.   end

  137. end

  138. class Game_Interpreter
  139.   include WD_itemsynthesis
  140. end

  141. class Game_System
  142.   #--------------------------------------------------------------------------
  143.   # ● 公開インスタンス■數
  144.   #--------------------------------------------------------------------------
  145.   attr_accessor :i_rcp_sw
  146.   attr_accessor :w_rcp_sw
  147.   attr_accessor :a_rcp_sw
  148.   #--------------------------------------------------------------------------
  149.   # ● オブジェクト初期化
  150.   #--------------------------------------------------------------------------
  151.   alias wd_orig_initialize004 initialize
  152.   def initialize
  153.     wd_orig_initialize004
  154.     @i_rcp_sw = []
  155.     @w_rcp_sw = []
  156.     @a_rcp_sw = []
  157.   end
  158. end


  159. #==============================================================================
  160. # ■ Scene_ItemSynthesis
  161. #------------------------------------------------------------------------------
  162. #  合成畫面■管理
  163. #==============================================================================

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

  404.   end
  405.   #--------------------------------------------------------------------------
  406.   # ● 所持金の取得
  407.   #--------------------------------------------------------------------------
  408.   def money
  409.     @gold_window.value
  410.   end
  411.   #--------------------------------------------------------------------------
  412.   # ● 通貨單位の取得
  413.   #--------------------------------------------------------------------------
  414.   def currency_unit
  415.     @gold_window.currency_unit
  416.   end
  417.   #--------------------------------------------------------------------------
  418.   # ● 合成費用の取得
  419.   #--------------------------------------------------------------------------
  420.   def buying_price
  421.     @list_window.price(@item)
  422.   end
  423. end


  424. #==============================================================================
  425. # ■ Window_ItemSynthesisList
  426. #------------------------------------------------------------------------------
  427. #  合成畫面で、合成可能なアイテムの一■を表示するウィンドウです。
  428. #==============================================================================

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


  664. #==============================================================================
  665. # ■ Window_ItemSynthesisMaterial
  666. #------------------------------------------------------------------------------
  667. #  合成畫面で、合成に必要な素材を表示するウィンドウです。
  668. #==============================================================================

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


  746. #==============================================================================
  747. # ■ Window_ItemSynthesisNumber
  748. #------------------------------------------------------------------------------
  749. #  合成畫面で、合成するアイテムの個數を入力するウィンドウです。
  750. #==============================================================================

  751. class Window_ItemSynthesisNumber < Window_ShopNumber
  752.   #--------------------------------------------------------------------------
  753.   # ● リフレッシュ
  754.   #--------------------------------------------------------------------------
  755.   def refresh
  756.     contents.clear
  757.     draw_item_name(@item, 0, item_y)
  758.     draw_number
  759.     draw_total_price if WD_itemsynthesis_ini::Cost_view
  760.   end
  761.   #--------------------------------------------------------------------------
  762.   # ● オブジェクト初期化
  763.   #--------------------------------------------------------------------------
  764.   def material_window=(material_window)
  765.     @material_window = material_window
  766.     call_update_help
  767.   end
  768.   #--------------------------------------------------------------------------
  769.   # ● 作成個數の■更
  770.   #--------------------------------------------------------------------------
  771.   def change_number(amount)
  772.     @number = [[@number + amount, @max].min, 1].max
  773.     call_update_help #追加
  774.   end
  775.   #--------------------------------------------------------------------------
  776.   # ● ヘルプテキスト更新
  777.   #--------------------------------------------------------------------------
  778.   def call_update_help
  779.     @material_window.set_num(@number) if @material_window
  780.   end
  781. end


  782. #==============================================================================
  783. # ■ Window_ItemSynthesisCategory
  784. #------------------------------------------------------------------------------
  785. #  合成畫面で、通常アイテムや裝備品の分類を選■するウィンドウです。
  786. #==============================================================================

  787. class Window_ItemSynthesisCategory < Window_ItemCategory
  788.   #--------------------------------------------------------------------------
  789.   # ● 桁數の取得
  790.   #--------------------------------------------------------------------------
  791.   def col_max
  792.     i = 0
  793.     i += 1 if WD_itemsynthesis_ini::Category_i
  794.     i += 1 if WD_itemsynthesis_ini::Category_w
  795.     i += 1 if WD_itemsynthesis_ini::Category_a
  796.     i += 1 if WD_itemsynthesis_ini::Category_k
  797.     return i
  798.   end
  799.   #--------------------------------------------------------------------------
  800.   # ● コマンドリストの作成
  801.   #--------------------------------------------------------------------------
  802.   def make_command_list
  803.     add_command(Vocab::item,     :item)     if WD_itemsynthesis_ini::Category_i
  804.     add_command(Vocab::weapon,   :weapon)   if WD_itemsynthesis_ini::Category_w
  805.     add_command(Vocab::armor,    :armor)    if WD_itemsynthesis_ini::Category_a
  806.     add_command(Vocab::key_item, :key_item) if WD_itemsynthesis_ini::Category_k
  807.   end
  808. end


  809. #==============================================================================
  810. # ■ Window_ItemSynthesisNumber
  811. #------------------------------------------------------------------------------
  812. #  合成畫面で、切替を表示するウィンドウです。
  813. #==============================================================================

  814. class Window_ItemSynthesisChange < Window_Base
  815.   #--------------------------------------------------------------------------
  816.   # ● オブジェクト初期化
  817.   #--------------------------------------------------------------------------
  818.   def initialize(x, y, width, height)
  819.     super(x, y, width, height)
  820.     refresh
  821.   end
  822.   #--------------------------------------------------------------------------
  823.   # ● リフレッシュ
  824.   #--------------------------------------------------------------------------
  825.   def refresh
  826.     contents.clear
  827.     text = "合成"
  828.     draw_text(0, 0, contents_width, line_height, text, 1)
  829.   end
  830. end
复制代码


点评

改216行 wy = @help_window.y + @help_window.height + 72  发表于 2013-8-15 17:13
梦石
0
星屑
52
在线时间
135 小时
注册时间
2011-11-5
回帖
49
 楼主| 发表于 2013-8-18 00:40:48 | 显示全部楼层
回點評:
在上一個窗口時變成這樣

1.jpg
回复

使用道具 举报

梦石
0
星屑
1564
在线时间
209 小时
注册时间
2013-6-19
回帖
123
发表于 2013-8-19 01:08:10 | 显示全部楼层
本帖最后由 a0936459772 于 2013-8-19 01:29 编辑
ji3rul4coco 发表于 2013-8-18 00:40
回點評:
在上一個窗口時變成這樣


如果是改變貨幣顯示的窗口大小的話
在你的第二貨幣腳本中的約28行做修改
28.jpg
逗點左邊為寬,右邊為高
直接用常數代入即可


如果是改變顯示"合成"的那個窗口的話
請在你的物品合成腳本851行做修改
物品合成.jpg
  1. super(x, y, width, height-24) #改成這樣就能正常顯示
复制代码




我本身也有用第二貨幣腳本
根據我的需求,我把它改成普通商店時金錢窗口只顯示金錢
第二貨幣商店時只顯示第二貨幣
而且金錢窗口也能正常顯示

如果樓主要實現這個功能的話
就回覆或點評一下吧

点评

求大大改的腳本(第二貨幣那個)~~拜託了(上次看太快沒看到)((雙手合十  发表于 2013-8-22 17:58
回复

使用道具 举报

梦石
0
星屑
52
在线时间
135 小时
注册时间
2011-11-5
回帖
49
 楼主| 发表于 2013-8-19 16:17:00 | 显示全部楼层
本帖最后由 ji3rul4coco 于 2013-8-19 16:18 编辑
a0936459772 发表于 2013-8-19 01:08
如果是改變貨幣顯示的窗口大小的話
在你的第二貨幣腳本中的約28行做修改


非常感謝ㄋㄟ~

對了,關於第1個問題,我在想是不是可以用開關控制腳本,在呼出合成腳本前設定開關
用開關來達成不同事件有不同合成物的功能

例如說:

if(XXXXXXXXXXXXX)開關[0001]=on
I_recipe[2]  = [30,  ["I",29,5]]
I_recipe[3]  = [30,  ["I",30,5]]
I_recipe[4]  = [30,  ["I",31,5]]
I_recipe[5]  = [30,  ["I",32,5]]
I_recipe[6]  = [30,  ["I",33,5]]

if(XXXXXXXXXXXXX)開關[0002]=on
I_recipe[10]  = [30,  ["I",37,5]]
I_recipe[11]  = [30,  ["I",38,5]]
I_recipe[12]  = [30,  ["I",39,5]]
I_recipe[13]  = [30,  ["I",40,5]]
I_recipe[14]  = [30,  ["I",41,5]]


之類的(至於if甚麼的...就不是我能寫得出來的了....)
回复

使用道具 举报

梦石
0
星屑
1564
在线时间
209 小时
注册时间
2013-6-19
回帖
123
发表于 2013-8-19 19:51:01 | 显示全部楼层
本帖最后由 a0936459772 于 2013-8-19 19:52 编辑
ji3rul4coco 发表于 2013-8-19 16:17
非常感謝ㄋㄟ~

對了,關於第1個問題,我在想是不是可以用開關控制腳本,在呼出合成腳 ...


其實你的要求用事件就可以達成
範例.jpg

你的合成腳本應該是這個沒錯
http://izumiwhite.web.fc2.com/rgss3/rgss3_004.html

它裡面有寫
  1. recipe_all_switch_off #全てのレシピを削除
复制代码

用來刪除所有已記錄的配方

那麼就在事件裡加入該商店的配方,叫出合成畫面,然後再把所有配方刪除即可(參考圖片)。

点评

補問個問題:因為已經有別的鍛造腳本了,所以想請大大幫忙,能否把合成武器與防具的部分修掉,只專門合成物品?  发表于 2013-8-22 17:15
回复

使用道具 举报

梦石
0
星屑
52
在线时间
135 小时
注册时间
2011-11-5
回帖
49
 楼主| 发表于 2013-8-21 16:34:16 | 显示全部楼层
a0936459772 发表于 2013-8-19 19:51
其實你的要求用事件就可以達成

非~~常感謝!
回复

使用道具 举报

梦石
0
星屑
52
在线时间
135 小时
注册时间
2011-11-5
回帖
49
 楼主| 发表于 2013-8-21 16:50:49 | 显示全部楼层
a0936459772 发表于 2013-8-19 19:51
其實你的要求用事件就可以達成

非~~常感謝!

点评

不用了,直接拿吧。  发表于 2013-8-23 13:31
把你的第二貨幣腳本貼上來,我幫你改  发表于 2013-8-23 04:13
回复

使用道具 举报

梦石
0
星屑
1564
在线时间
209 小时
注册时间
2013-6-19
回帖
123
发表于 2013-8-22 23:14:27 | 显示全部楼层
本帖最后由 a0936459772 于 2013-8-22 23:17 编辑
ji3rul4coco 发表于 2013-8-21 16:50
非~~常感謝!


在你的物品合成腳本中
找到
  1.   Category_w = true #カテゴリウィンドウに「武器」の項目を表示
  2.   Category_a = true #カテゴリウィンドウに「防具」の項目を表示
复制代码

改成
  1.   Category_w = false #カテゴリウィンドウに「武器」の項目を表示
  2.   Category_a = false #カテゴリウィンドウに「防具」の項目を表示
复制代码
回复

使用道具 举报

梦石
0
星屑
1564
在线时间
209 小时
注册时间
2013-6-19
回帖
123
发表于 2013-8-23 13:31:05 | 显示全部楼层
本帖最后由 a0936459772 于 2013-8-23 13:55 编辑
ji3rul4coco 发表于 2013-8-21 16:50
非~~常感謝!


注意:
此腳本只會在遊戲菜單中同時顯示兩個貨幣
其餘狀況則根據通貨的開關決定顯示的貨幣
關閉時顯示第一貨幣
打開時顯示第二貨幣
效果圖
菜單中.jpg
第一通貨商店.jpg
第二通貨商店.jpg

直接覆蓋你原本的第二貨幣腳本即可
記得把用語和開關ID改回來

  1. # by 杂兵天下的马甲
  2. # 2013.8.23 由a0936459772 修改
  3. # 因為這是根據私人需求而修改的客製化腳本,若出現任何bug或是腳本衝突,本熊一概沒有任何責任。

  4. #第二货币设置
  5. $SECOND_CURRENCY_SWITCH = 10  #打開某號開關後,金錢的增減全變為第二貨幣
  6. $SECOND_CURRENCY_NAME = "結晶" #在道具備註裡打上<第二通貨價格:1>,則道具可以用1第二通貨購買
  7. #第二货币方法
  8. class Game_Party < Game_Unit
  9.   attr_reader    :spegold
  10.   alias initialize_normal_sc initialize
  11.   def initialize
  12.     initialize_normal_sc
  13.     @spegold = 0
  14.   end
  15.   alias gain_gold_normal_sc gain_gold
  16.   def gain_gold(amount)
  17.     if $game_switches[$SECOND_CURRENCY_SWITCH]
  18.       @spegold = [[@spegold + amount, 0].max, max_gold].min
  19.     else
  20.       gain_gold_normal_sc(amount)
  21.     end
  22.   end
  23. end

  24. #第二货币的显示

  25. class Window_Gold < Window_Base
  26.   #覆盖方法!可能引起冲突
  27.   #--------------------------------------------------------------------------
  28.   # ● 初始化                  
  29.   #--------------------------------------------------------------------------
  30.   def initialize
  31.     super(0, 0, window_width, window_height)
  32.     refresh
  33.   end
  34.   #--------------------------------------------------------------------------
  35.   # ● 獲取窗口的高度
  36.   #--------------------------------------------------------------------------
  37.   def window_height
  38.     SceneManager.scene_is?(Scene_Menu) ? fitting_height(2) : fitting_height(1)
  39.   end
  40. #alias refresh_normal_sc refresh
  41.   #--------------------------------------------------------------------------
  42.   # ● 刷新                     
  43.   #--------------------------------------------------------------------------
  44.   def refresh
  45.     contents.clear
  46.     #refresh_normal_sc
  47.     if SceneManager.scene_is?(Scene_Menu)
  48.       draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
  49.       draw_currency_value($game_party.spegold, $SECOND_CURRENCY_NAME, 4, 24, contents.width - 8)
  50.     elsif $game_switches[$SECOND_CURRENCY_SWITCH]
  51.       draw_currency_value($game_party.spegold, $SECOND_CURRENCY_NAME, 4, 0, contents.width - 8)
  52.     else
  53.       draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
  54.     end
  55.   end
  56. end

  57. #战斗胜利不获得第二货币

  58. module BattleManager
  59.   #覆盖方法!可能引起冲突
  60.   def self.gain_gold
  61.     if $game_troop.gold_total > 0
  62.       text = sprintf(Vocab::ObtainGold, $game_troop.gold_total)
  63.       $game_message.add('\.' + text)
  64.       $game_party.gain_gold_normal_sc($game_troop.gold_total)
  65.     end
  66.     wait_for_message
  67.   end
  68. end

  69. #用第二货币买东西
  70. module RPG
  71.   class Item
  72.     def price
  73.       if $game_switches[$SECOND_CURRENCY_SWITCH]
  74.         note.split(/[\r\n]+/).each { |line|
  75.           case line
  76.           when /<第二通貨價格:(\d+)>/i
  77.             return $1.to_i
  78.           end
  79.         }
  80.         return 0
  81.       else
  82.         return @price
  83.       end
  84.     end
  85.   end
  86. end

  87. #商店中购买灵魄物品显示灵魄

  88. class Window_ShopNumber < Window_Selectable
  89.   alias draw_total_price_normal_sc draw_total_price
  90.   def draw_total_price
  91.     if $game_switches[$SECOND_CURRENCY_SWITCH]
  92.       @currency_unit = $SECOND_CURRENCY_NAME
  93.     end
  94.     draw_total_price_normal_sc
  95.   end
  96. end

  97. class Scene_Shop < Scene_MenuBase
  98.   alias money_normal_sc money
  99.   def money
  100.     if $game_switches[$SECOND_CURRENCY_SWITCH]
  101.       return $game_party.spegold
  102.     else
  103.       return money_normal_sc
  104.     end
  105.   end
  106.   alias create_gold_window_normal_sc create_gold_window
  107.   def create_gold_window
  108.     create_gold_window_normal_sc
  109.    #@gold_window.y -= 24
  110.   end
  111. end

复制代码

点评

太謝謝了~  发表于 2013-8-26 21:28

评分

参与人数 1梦石 +2 收起 理由
Sion + 2 认可答案

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部