设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3199|回复: 9
打印 上一主题 下一主题

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
52
在线时间
135 小时
注册时间
2011-11-5
帖子
83
跳转到指定楼层
1
发表于 2013-8-15 16:05:09 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

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

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


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


点评

改216行 wy = @help_window.y + @help_window.height + 72  发表于 2013-8-15 17:13

Lv1.梦旅人

梦石
0
星屑
52
在线时间
135 小时
注册时间
2011-11-5
帖子
83
2
 楼主| 发表于 2013-8-18 00:40:48 | 只看该作者
回點評:
在上一個窗口時變成這樣


回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1154
在线时间
209 小时
注册时间
2013-6-19
帖子
138
3
发表于 2013-8-19 01:08:10 | 只看该作者
本帖最后由 a0936459772 于 2013-8-19 01:29 编辑
ji3rul4coco 发表于 2013-8-18 00:40
回點評:
在上一個窗口時變成這樣


如果是改變貨幣顯示的窗口大小的話
在你的第二貨幣腳本中的約28行做修改

逗點左邊為寬,右邊為高
直接用常數代入即可


如果是改變顯示"合成"的那個窗口的話
請在你的物品合成腳本851行做修改

RUBY 代码复制
  1. super(x, y, width, height-24) #改成這樣就能正常顯示




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

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

点评

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

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
52
在线时间
135 小时
注册时间
2011-11-5
帖子
83
4
 楼主| 发表于 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甚麼的...就不是我能寫得出來的了....)
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1154
在线时间
209 小时
注册时间
2013-6-19
帖子
138
5
发表于 2013-8-19 19:51:01 | 只看该作者
本帖最后由 a0936459772 于 2013-8-19 19:52 编辑
ji3rul4coco 发表于 2013-8-19 16:17
非常感謝ㄋㄟ~

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


其實你的要求用事件就可以達成


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

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

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

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

点评

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

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
52
在线时间
135 小时
注册时间
2011-11-5
帖子
83
6
 楼主| 发表于 2013-8-21 16:34:16 | 只看该作者
a0936459772 发表于 2013-8-19 19:51
其實你的要求用事件就可以達成

非~~常感謝!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
52
在线时间
135 小时
注册时间
2011-11-5
帖子
83
7
 楼主| 发表于 2013-8-21 16:50:49 | 只看该作者
a0936459772 发表于 2013-8-19 19:51
其實你的要求用事件就可以達成

非~~常感謝!

点评

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

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1154
在线时间
209 小时
注册时间
2013-6-19
帖子
138
8
发表于 2013-8-22 23:14:27 | 只看该作者
本帖最后由 a0936459772 于 2013-8-22 23:17 编辑
ji3rul4coco 发表于 2013-8-21 16:50
非~~常感謝!


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

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

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1154
在线时间
209 小时
注册时间
2013-6-19
帖子
138
9
发表于 2013-8-23 13:31:05 | 只看该作者
本帖最后由 a0936459772 于 2013-8-23 13:55 编辑
ji3rul4coco 发表于 2013-8-21 16:50
非~~常感謝!


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




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

RUBY 代码复制
  1. # by 杂兵天下的马甲
  2. # 2013.8.23 由a0936459772 修改
  3. # 因為這是根據私人需求而修改的客製化腳本,若出現任何bug或是腳本衝突,本熊一概沒有任何責任。
  4.  
  5. #第二货币设置
  6. $SECOND_CURRENCY_SWITCH = 10  #打開某號開關後,金錢的增減全變為第二貨幣
  7. $SECOND_CURRENCY_NAME = "結晶" #在道具備註裡打上<第二通貨價格:1>,則道具可以用1第二通貨購買
  8. #第二货币方法
  9. class Game_Party < Game_Unit
  10.   attr_reader    :spegold
  11.   alias initialize_normal_sc initialize
  12.   def initialize
  13.     initialize_normal_sc
  14.     @spegold = 0
  15.   end
  16.   alias gain_gold_normal_sc gain_gold
  17.   def gain_gold(amount)
  18.     if $game_switches[$SECOND_CURRENCY_SWITCH]
  19.       @spegold = [[@spegold + amount, 0].max, max_gold].min
  20.     else
  21.       gain_gold_normal_sc(amount)
  22.     end
  23.   end
  24. end
  25.  
  26. #第二货币的显示
  27.  
  28. class Window_Gold < Window_Base
  29.   #覆盖方法!可能引起冲突
  30.   #--------------------------------------------------------------------------
  31.   # ● 初始化                  
  32.   #--------------------------------------------------------------------------
  33.   def initialize
  34.     super(0, 0, window_width, window_height)
  35.     refresh
  36.   end
  37.   #--------------------------------------------------------------------------
  38.   # ● 獲取窗口的高度
  39.   #--------------------------------------------------------------------------
  40.   def window_height
  41.     SceneManager.scene_is?(Scene_Menu) ? fitting_height(2) : fitting_height(1)
  42.   end
  43. #alias refresh_normal_sc refresh
  44.   #--------------------------------------------------------------------------
  45.   # ● 刷新                     
  46.   #--------------------------------------------------------------------------
  47.   def refresh
  48.     contents.clear
  49.     #refresh_normal_sc
  50.     if SceneManager.scene_is?(Scene_Menu)
  51.       draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
  52.       draw_currency_value($game_party.spegold, $SECOND_CURRENCY_NAME, 4, 24, contents.width - 8)
  53.     elsif $game_switches[$SECOND_CURRENCY_SWITCH]
  54.       draw_currency_value($game_party.spegold, $SECOND_CURRENCY_NAME, 4, 0, contents.width - 8)
  55.     else
  56.       draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
  57.     end
  58.   end
  59. end
  60.  
  61. #战斗胜利不获得第二货币
  62.  
  63. module BattleManager
  64.   #覆盖方法!可能引起冲突
  65.   def self.gain_gold
  66.     if $game_troop.gold_total > 0
  67.       text = sprintf(Vocab::ObtainGold, $game_troop.gold_total)
  68.       $game_message.add('\.' + text)
  69.       $game_party.gain_gold_normal_sc($game_troop.gold_total)
  70.     end
  71.     wait_for_message
  72.   end
  73. end
  74.  
  75. #用第二货币买东西
  76. module RPG
  77.   class Item
  78.     def price
  79.       if $game_switches[$SECOND_CURRENCY_SWITCH]
  80.         note.split(/[\r\n]+/).each { |line|
  81.           case line
  82.           when /<第二通貨價格:(\d+)>/i
  83.             return $1.to_i
  84.           end
  85.         }
  86.         return 0
  87.       else
  88.         return @price
  89.       end
  90.     end
  91.   end
  92. end
  93.  
  94. #商店中购买灵魄物品显示灵魄
  95.  
  96. class Window_ShopNumber < Window_Selectable
  97.   alias draw_total_price_normal_sc draw_total_price
  98.   def draw_total_price
  99.     if $game_switches[$SECOND_CURRENCY_SWITCH]
  100.       @currency_unit = $SECOND_CURRENCY_NAME
  101.     end
  102.     draw_total_price_normal_sc
  103.   end
  104. end
  105.  
  106. class Scene_Shop < Scene_MenuBase
  107.   alias money_normal_sc money
  108.   def money
  109.     if $game_switches[$SECOND_CURRENCY_SWITCH]
  110.       return $game_party.spegold
  111.     else
  112.       return money_normal_sc
  113.     end
  114.   end
  115.   alias create_gold_window_normal_sc create_gold_window
  116.   def create_gold_window
  117.     create_gold_window_normal_sc
  118.    #@gold_window.y -= 24
  119.   end
  120. end

点评

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

评分

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

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-25 15:28

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表