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

Project1

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

[已经解决] 求教这个脚本添加合成配方的方法

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
40 小时
注册时间
2012-7-28
帖子
118
跳转到指定楼层
1
发表于 2012-10-5 18:35:28 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 xfx510061635 于 2012-10-5 18:49 编辑
  1. #==============================================================================
  2. # 仭 RGSS3 傾僀僥儉崌惉 ver 1.03
  3. #------------------------------------------------------------------------------
  4. # 丂攝晍尦:
  5. #     敀偺杺 http://izumiwhite.web.fc2.com/
  6. #
  7. # 丂棙梡婯栺:
  8. #     RPG僣僋乕儖VX Ace偺惓婯偺搊榐幰偺傒偛棙梡偵側傟傑偡丅
  9. #     棙梡曬崘丒挊嶌尃昞帵偲偐偼昁梫偁傝傑偣傫丅
  10. #     夵憿傕偛帺桼偵偳偆偧丅
  11. #     壗偐栤戣偑敪惗偟偰傕愑擟偼帩偪傑偣傫丅
  12. #==============================================================================


  13. #--------------------------------------------------------------------------
  14. # 仛 弶婜愝掕丅
  15. #    崌惉儗僔僺摍偺愝掕
  16. #--------------------------------------------------------------------------
  17. module WD_itemsynthesis_ini
  18.   
  19.   Cost_view =  true #旓梡(俧)偺昞帵(崌惉偺旓梡偑慡偰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偺傾僀僥儉偺崌惉昁梫偼丄100俧丅
  33.   #昁梫側慺嵽偼丄ID1偺傾僀僥儉1屄丄ID2偺晲婍1屄丄ID2偺杊嬶2屄丄ID3偺杊嬶1屄
  34.   #偲側傞丅
  35.   
  36.   #傾僀僥儉偺崌惉儗僔僺
  37.   I_recipe[2]  = [10,  ["I",1,2]]
  38.   I_recipe[3]  = [100, ["I",1,1], ["I",2,1]]
  39.   I_recipe[17] = [500, ["I",1,10]]

  40.   #晲婍偺崌惉儗僔僺
  41.   W_recipe[3]  = [50,   ["W",1,1], ["W",2,1]]
  42.   W_recipe[6]  = [600,  ["W",3,1], ["I",17,0]]
  43.   
  44.   #杊嬶偺崌惉儗僔僺  
  45.   A_recipe[2]  = [40,   ["A",1,2]]
  46.   A_recipe[5]  = [400,  ["A",2,1], ["W",2,2], ["I",17,0]]
  47.   
  48. end


  49. #==============================================================================
  50. # 仭 WD_itemsynthesis
  51. #------------------------------------------------------------------------------
  52. # 丂傾僀僥儉崌惉梡偺嫟捠儊僜僢僪偱偡丅
  53. #==============================================================================

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

  140. end

  141. class Game_Interpreter
  142.   include WD_itemsynthesis
  143. end

  144. class Game_System
  145.   #--------------------------------------------------------------------------
  146.   # 仠 岞奐僀儞僗僞儞僗曄悢
  147.   #--------------------------------------------------------------------------
  148.   attr_accessor :i_rcp_sw
  149.   attr_accessor :w_rcp_sw
  150.   attr_accessor :a_rcp_sw
  151.   #--------------------------------------------------------------------------
  152.   # 仠 僆僽僕僃僋僩弶婜壔
  153.   #--------------------------------------------------------------------------
  154.   alias wd_orig_initialize004 initialize
  155.   def initialize
  156.     wd_orig_initialize004
  157.     @i_rcp_sw = []
  158.     @w_rcp_sw = []
  159.     @a_rcp_sw = []
  160.   end
  161. end


  162. #==============================================================================
  163. # 仭 Scene_ItemSynthesis
  164. #------------------------------------------------------------------------------
  165. # 丂崌惉夋柺偺張棟傪峴偆僋儔僗偱偡丅
  166. #==============================================================================

  167. class Scene_ItemSynthesis < Scene_MenuBase
  168.   #--------------------------------------------------------------------------
  169.   # 仠 奐巒張棟
  170.   #--------------------------------------------------------------------------
  171.   def start
  172.     super
  173.     create_help_window
  174.     create_dummy_window
  175.     create_number_window
  176.     create_status_window
  177.     create_material_window
  178.     create_list_window
  179.     create_category_window
  180.     create_gold_window
  181.     create_change_window
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # 仠 僑乕儖僪僂傿儞僪僂偺嶌惉
  185.   #--------------------------------------------------------------------------
  186.   def create_gold_window
  187.     @gold_window = Window_Gold.new
  188.     @gold_window.viewport = @viewport
  189.     @gold_window.x = Graphics.width - @gold_window.width
  190.     @gold_window.y = @help_window.height
  191.     @gold_window.hide
  192.   end
  193.   #--------------------------------------------------------------------------
  194.   # 仠 愗傝懼偊昞帵僂傿儞僪僂偺嶌惉
  195.   #--------------------------------------------------------------------------
  196.   def create_change_window
  197.     wx = 0
  198.     wy = @gold_window.y
  199.     ww = Graphics.width - @gold_window.width
  200.     wh = @gold_window.height
  201.     @change_window = Window_ItemSynthesisChange.new(wx, wy, ww, wh)
  202.     @change_window.viewport = @viewport
  203.     @change_window.hide
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # 仠 僟儈乕僂傿儞僪僂偺嶌惉
  207.   #--------------------------------------------------------------------------
  208.   def create_dummy_window
  209.     wy = @help_window.y + @help_window.height + 48
  210.     wh = Graphics.height - wy
  211.     @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
  212.     @dummy_window.viewport = @viewport
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # 仠 屄悢擖椡僂傿儞僪僂偺嶌惉
  216.   #--------------------------------------------------------------------------
  217.   def create_number_window
  218.     wy = @dummy_window.y
  219.     wh = @dummy_window.height
  220.     @number_window = Window_ItemSynthesisNumber.new(0, wy, wh)
  221.     @number_window.viewport = @viewport
  222.     @number_window.hide
  223.     @number_window.set_handler(:ok,     method(:on_number_ok))
  224.     @number_window.set_handler(:cancel, method(:on_number_cancel))
  225.     @number_window.set_handler(:change_window, method(:on_change_window))   
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # 仠 僗僥乕僞僗僂傿儞僪僂偺嶌惉
  229.   #--------------------------------------------------------------------------
  230.   def create_status_window
  231.     wx = @number_window.width
  232.     wy = @dummy_window.y
  233.     ww = Graphics.width - wx
  234.     wh = @dummy_window.height
  235.     @status_window = Window_ShopStatus.new(wx, wy, ww, wh)
  236.     @status_window.viewport = @viewport
  237.     @status_window.hide
  238.   end
  239.   #--------------------------------------------------------------------------
  240.   # 仠 慺嵽僂傿儞僪僂偺嶌惉
  241.   #--------------------------------------------------------------------------
  242.   def create_material_window
  243.     wx = @number_window.width
  244.     wy = @dummy_window.y
  245.     ww = Graphics.width - wx
  246.     wh = @dummy_window.height
  247.     @material_window = Window_ItemSynthesisMaterial.new(wx, wy, ww, wh)
  248.     @material_window.viewport = @viewport
  249.     @material_window.hide
  250.     @number_window.material_window = @material_window
  251.   end
  252.   #--------------------------------------------------------------------------
  253.   # 仠 崌惉傾僀僥儉儕僗僩僂傿儞僪僂偺嶌惉
  254.   #--------------------------------------------------------------------------
  255.   def create_list_window
  256.     wy = @dummy_window.y
  257.     wh = @dummy_window.height
  258.     @list_window = Window_ItemSynthesisList.new(0, wy, wh)
  259.     @list_window.viewport = @viewport
  260.     @list_window.help_window = @help_window
  261.     @list_window.status_window = @status_window
  262.     @list_window.material_window = @material_window
  263.     @list_window.hide
  264.     @list_window.set_handler(:ok,     method(:on_list_ok))
  265.     @list_window.set_handler(:cancel, method(:on_list_cancel))
  266.     @list_window.set_handler(:change_window, method(:on_change_window))   
  267.   end
  268.   #--------------------------------------------------------------------------
  269.   # 仠 僇僥僑儕僂傿儞僪僂偺嶌惉
  270.   #--------------------------------------------------------------------------
  271.   def create_category_window
  272.     @category_window = Window_ItemSynthesisCategory.new
  273.     @category_window.viewport = @viewport
  274.     @category_window.help_window = @help_window
  275.     @category_window.y = @help_window.height
  276.     @category_window.activate
  277.     @category_window.item_window = @list_window
  278.     @category_window.set_handler(:ok,     method(:on_category_ok))
  279.     @category_window.set_handler(:cancel, method(:return_scene))
  280.   end
  281.   #--------------------------------------------------------------------------
  282.   # 仠 崌惉傾僀僥儉儕僗僩僂傿儞僪僂偺傾僋僥傿僽壔
  283.   #--------------------------------------------------------------------------
  284.   def activate_list_window
  285.     @list_window.money = money
  286.     @list_window.show.activate
  287.   end
  288.   #--------------------------------------------------------------------------
  289.   # 仠 崌惉乵寛掕乶
  290.   #--------------------------------------------------------------------------
  291.   def on_list_ok
  292.     @item = @list_window.item
  293.     @list_window.hide
  294.     @number_window.set(@item, max_buy, buying_price, currency_unit)
  295.     @number_window.show.activate
  296.   end
  297.   #--------------------------------------------------------------------------
  298.   # 仠 崌惉乵僉儍儞僙儖乶
  299.   #--------------------------------------------------------------------------
  300.   def on_list_cancel
  301.     @category_window.activate
  302.     @category_window.show
  303.     @dummy_window.show
  304.     @list_window.hide
  305.     @status_window.hide
  306.     @status_window.item = nil
  307.     @material_window.hide
  308.     @material_window.set(nil, nil)
  309.     @gold_window.hide
  310.     @change_window.hide
  311.     @help_window.clear
  312.   end
  313.   #--------------------------------------------------------------------------
  314.   # 仠 昞帵愗懼
  315.   #--------------------------------------------------------------------------
  316.   def on_change_window
  317.     if @status_window.visible
  318.       @status_window.hide
  319.       @material_window.show
  320.     else
  321.       @status_window.show
  322.       @material_window.hide
  323.     end
  324.   end
  325.   #--------------------------------------------------------------------------
  326.   # 仠 僇僥僑儕乵寛掕乶
  327.   #--------------------------------------------------------------------------
  328.   def on_category_ok
  329.     activate_list_window
  330.     @gold_window.show
  331.     @change_window.show
  332.     @material_window.show
  333.     @category_window.hide
  334.     @list_window.select(0)
  335.   end
  336.   #--------------------------------------------------------------------------
  337.   # 仠 屄悢擖椡乵寛掕乶
  338.   #--------------------------------------------------------------------------
  339.   def on_number_ok
  340.     Sound.play_shop
  341.     do_syntetic(@number_window.number)
  342.     end_number_input
  343.     @gold_window.refresh
  344.   end
  345.   #--------------------------------------------------------------------------
  346.   # 仠 屄悢擖椡乵僉儍儞僙儖乶
  347.   #--------------------------------------------------------------------------
  348.   def on_number_cancel
  349.     Sound.play_cancel
  350.     end_number_input
  351.   end
  352.   #--------------------------------------------------------------------------
  353.   # 仠 崌惉偺幚峴
  354.   #--------------------------------------------------------------------------
  355.   def do_syntetic(number)
  356.     $game_party.lose_gold(number * buying_price)
  357.     $game_party.gain_item(@item, number)
  358.    
  359.       @recipe = @list_window.recipe(@item)
  360.       for i in [email protected]
  361.         kind = @recipe[i][0]
  362.         id   = @recipe[i][1]
  363.         num  = @recipe[i][2]
  364.         if kind == "I"
  365.           item = $data_items[id]
  366.         elsif kind == "W"
  367.           item = $data_weapons[id]
  368.         elsif kind == "A"
  369.           item = $data_armors[id]
  370.         end
  371.         $game_party.lose_item(item, num*number)
  372.       end
  373.   end
  374.   #--------------------------------------------------------------------------
  375.   # 仠 屄悢擖椡偺廔椆
  376.   #--------------------------------------------------------------------------
  377.   def end_number_input
  378.     @number_window.hide
  379.     activate_list_window
  380.   end
  381.   #--------------------------------------------------------------------------
  382.   # 仠 嵟戝峸擖壜擻屄悢偺庢摼
  383.   #--------------------------------------------------------------------------
  384.   def max_buy
  385.     max = $game_party.max_item_number(@item) - $game_party.item_number(@item)
  386.    
  387.     @recipe = @list_window.recipe(@item)
  388.       for i in [email protected]
  389.         kind = @recipe[i][0]
  390.         id   = @recipe[i][1]
  391.         num  = @recipe[i][2]
  392.         if kind == "I"
  393.           item = $data_items[id]
  394.         elsif kind == "W"
  395.           item = $data_weapons[id]
  396.         elsif kind == "A"
  397.           item = $data_armors[id]
  398.         end
  399.         if num > 0
  400.           max_buf = $game_party.item_number(item)/num
  401.         else
  402.           max_buf = 999
  403.         end
  404.         max = [max, max_buf].min
  405.       end
  406.       
  407.     buying_price == 0 ? max : [max, money / buying_price].min

  408.   end
  409.   #--------------------------------------------------------------------------
  410.   # 仠 強帩嬥偺庢摼
  411.   #--------------------------------------------------------------------------
  412.   def money
  413.     @gold_window.value
  414.   end
  415.   #--------------------------------------------------------------------------
  416.   # 仠 捠壿扨埵偺庢摼
  417.   #--------------------------------------------------------------------------
  418.   def currency_unit
  419.     @gold_window.currency_unit
  420.   end
  421.   #--------------------------------------------------------------------------
  422.   # 仠 崌惉旓梡偺庢摼
  423.   #--------------------------------------------------------------------------
  424.   def buying_price
  425.     @list_window.price(@item)
  426.   end
  427. end


  428. #==============================================================================
  429. # 仭 Window_ItemSynthesisList
  430. #------------------------------------------------------------------------------
  431. # 丂崌惉夋柺偱丄崌惉壜擻側傾僀僥儉偺堦棗傪昞帵偡傞僂傿儞僪僂偱偡丅
  432. #==============================================================================

  433. class Window_ItemSynthesisList < Window_Selectable
  434.   include WD_itemsynthesis
  435.   #--------------------------------------------------------------------------
  436.   # 仠 岞奐僀儞僗僞儞僗曄悢
  437.   #--------------------------------------------------------------------------
  438.   attr_reader   :status_window            # 僗僥乕僞僗僂傿儞僪僂
  439.   #--------------------------------------------------------------------------
  440.   # 仠 僆僽僕僃僋僩弶婜壔
  441.   #--------------------------------------------------------------------------
  442.   def initialize(x, y, height)
  443.     super(x, y, window_width, height)
  444.    
  445.     @shop_goods = []
  446.     @shop_recipes = []
  447.    
  448.     for i in 1..WD_itemsynthesis_ini::I_recipe.size
  449.       recipe = WD_itemsynthesis_ini::I_recipe[i]
  450.       if recipe
  451.         good = [0, i, recipe[0]]
  452.         if i_recipe_switch_on?(i)
  453.           @shop_goods.push(good)
  454.           @shop_recipes.push(recipe)
  455.         end
  456.       end
  457.     end
  458.     for i in 1..WD_itemsynthesis_ini::W_recipe.size
  459.       recipe = WD_itemsynthesis_ini::W_recipe[i]
  460.       if recipe
  461.         good = [1, i, recipe[0]]
  462.         if w_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::A_recipe.size
  469.       recipe = WD_itemsynthesis_ini::A_recipe[i]
  470.       if recipe
  471.         good = [2, i, recipe[0]]
  472.         if a_recipe_switch_on?(i)
  473.           @shop_goods.push(good)
  474.           @shop_recipes.push(recipe)
  475.         end
  476.       end
  477.     end
  478.    
  479.     @money = 0
  480.     refresh
  481.     select(0)
  482.   end
  483.   #--------------------------------------------------------------------------
  484.   # 仠 僂傿儞僪僂暆偺庢摼
  485.   #--------------------------------------------------------------------------
  486.   def window_width
  487.     return 304
  488.   end
  489.   #--------------------------------------------------------------------------
  490.   # 仠 崁栚悢偺庢摼
  491.   #--------------------------------------------------------------------------
  492.   def item_max
  493.     @data ? @data.size : 1
  494.   end
  495.   #--------------------------------------------------------------------------
  496.   # 仠 傾僀僥儉偺庢摼
  497.   #--------------------------------------------------------------------------
  498.   def item
  499.     @data[index]
  500.   end
  501.   #--------------------------------------------------------------------------
  502.   # 仠 強帩嬥偺愝掕
  503.   #--------------------------------------------------------------------------
  504.   def money=(money)
  505.     @money = money
  506.     refresh
  507.   end
  508.   #--------------------------------------------------------------------------
  509.   # 仠 慖戰崁栚偺桳岠忬懺傪庢摼
  510.   #--------------------------------------------------------------------------
  511.   def current_item_enabled?
  512.     enable?(@data[index])
  513.   end
  514.   #--------------------------------------------------------------------------
  515.   # 仠 崌惉旓梡傪庢摼
  516.   #--------------------------------------------------------------------------
  517.   def price(item)
  518.     @price[item]
  519.   end
  520.   #--------------------------------------------------------------------------
  521.   # 仠 崌惉壜斲傪庢摼
  522.   #--------------------------------------------------------------------------
  523.   def enable?(item)
  524.     @makable[item]
  525.   end
  526.   #--------------------------------------------------------------------------
  527.   # 仠 儗僔僺傪庢摼
  528.   #--------------------------------------------------------------------------
  529.   def recipe(item)
  530.     @recipe[item]
  531.   end
  532.   #--------------------------------------------------------------------------
  533.   # 仠 傾僀僥儉傪嫋壜忬懺偱昞帵偡傞偐偳偆偐
  534.   #--------------------------------------------------------------------------
  535.   def have_mat?(recipe)
  536.     flag = true
  537.     if @money >= recipe[0]
  538.       for i in 1...recipe.size
  539.         kind = recipe[i][0]
  540.         id   = recipe[i][1]
  541.         num  = recipe[i][2]
  542.         if kind == "I"
  543.           item = $data_items[id]
  544.         elsif kind == "W"
  545.           item = $data_weapons[id]
  546.         elsif kind == "A"
  547.           item = $data_armors[id]
  548.         end
  549.         if $game_party.item_number(item) < [num, 1].max
  550.           flag = false
  551.         end
  552.       end
  553.     else
  554.       flag = false
  555.     end
  556.     return flag
  557.   end
  558.   #--------------------------------------------------------------------------
  559.   # 仠 僇僥僑儕偺愝掕
  560.   #--------------------------------------------------------------------------
  561.   def category=(category)
  562.     return if @category == category
  563.     @category = category
  564.     refresh
  565.   end
  566.   #--------------------------------------------------------------------------
  567.   # 仠 儕僼儗僢僔儏
  568.   #--------------------------------------------------------------------------
  569.   def refresh
  570.     make_item_list
  571.     create_contents
  572.     draw_all_items
  573.   end
  574.   #--------------------------------------------------------------------------
  575.   # 仠 傾僀僥儉傪儕僗僩偵娷傔傞偐偳偆偐
  576.   #--------------------------------------------------------------------------
  577.   def include?(item)
  578.     case @category
  579.     when :item
  580.       item.is_a?(RPG::Item) && !item.key_item?
  581.     when :weapon
  582.       item.is_a?(RPG::Weapon)
  583.     when :armor
  584.       item.is_a?(RPG::Armor)
  585.     when :key_item
  586.       item.is_a?(RPG::Item) && item.key_item?
  587.     else
  588.       false
  589.     end
  590.   end
  591.   #--------------------------------------------------------------------------
  592.   # 仠 傾僀僥儉儕僗僩偺嶌惉
  593.   #--------------------------------------------------------------------------
  594.   def make_item_list
  595.     @data = []
  596.     @price = {}
  597.     @makable = {}
  598.     @recipe = {}
  599.     for i in 0...@shop_goods.size
  600.       goods = @shop_goods[i]
  601.       recipe = @shop_recipes[i]
  602.       case goods[0]
  603.       when 0;  item = $data_items[goods[1]]
  604.       when 1;  item = $data_weapons[goods[1]]
  605.       when 2;  item = $data_armors[goods[1]]
  606.       end
  607.       if item
  608.         if include?(item)
  609.           @data.push(item)
  610.           @price[item] = goods[2]
  611.           @makable[item] = have_mat?(recipe)
  612.           @recipe[item] = recipe
  613.         end
  614.       end
  615.     end
  616.   end
  617.   #--------------------------------------------------------------------------
  618.   # 仠 崁栚偺昤夋
  619.   #--------------------------------------------------------------------------
  620.   def draw_item(index)
  621.     item = @data[index]
  622.     rect = item_rect(index)
  623.     draw_item_name(item, rect.x, rect.y, enable?(item))
  624.     rect.width -= 4
  625.     draw_text(rect, price(item), 2)  if WD_itemsynthesis_ini::Cost_view
  626.   end
  627.   #--------------------------------------------------------------------------
  628.   # 仠 僗僥乕僞僗僂傿儞僪僂偺愝掕
  629.   #--------------------------------------------------------------------------
  630.   def status_window=(status_window)
  631.     @status_window = status_window
  632.     call_update_help
  633.   end
  634.   #--------------------------------------------------------------------------
  635.   # 仠 慺嵽僂傿儞僪僂偺愝掕
  636.   #--------------------------------------------------------------------------
  637.   def material_window=(material_window)
  638.     @material_window = material_window
  639.     call_update_help
  640.   end
  641.   #--------------------------------------------------------------------------
  642.   # 仠 僿儖僾僥僉僗僩峏怴
  643.   #--------------------------------------------------------------------------
  644.   def update_help
  645.     @help_window.set_item(item) if @help_window
  646.     @status_window.item = item if @status_window
  647.     @material_window.set(item, recipe(item)) if @material_window
  648.   end
  649.   #--------------------------------------------------------------------------
  650.   # 仠 Z 儃僞儞乮昞帵愗懼乯偑墴偝傟偨偲偒偺張棟
  651.   #--------------------------------------------------------------------------
  652.   def process_change_window
  653.     Sound.play_cursor
  654.     Input.update
  655.     call_handler(:change_window)
  656.   end
  657.   #--------------------------------------------------------------------------
  658.   # 仠 寛掕傗僉儍儞僙儖側偳偺僴儞僪儕儞僌張棟
  659.   #--------------------------------------------------------------------------
  660.   def process_handling
  661.     super
  662.     if active
  663.       return process_change_window if handle?(:change_window) && Input.trigger?(:Z)
  664. #      return process_change_window if handle?(:change_window) && Input.trigger?(:Z)
  665.     end
  666.   end
  667. end


  668. #==============================================================================
  669. # 仭 Window_ItemSynthesisMaterial
  670. #------------------------------------------------------------------------------
  671. # 丂崌惉夋柺偱丄崌惉偵昁梫側慺嵽傪昞帵偡傞僂傿儞僪僂偱偡丅
  672. #==============================================================================

  673. class Window_ItemSynthesisMaterial < Window_Base
  674.   #--------------------------------------------------------------------------
  675.   # 仠 僆僽僕僃僋僩弶婜壔
  676.   #--------------------------------------------------------------------------
  677.   def initialize(x, y, width, height)
  678.     super(x, y, width, height)
  679.     @item = nil
  680.     refresh
  681.   end
  682.   #--------------------------------------------------------------------------
  683.   # 仠 儕僼儗僢僔儏
  684.   #--------------------------------------------------------------------------
  685.   def refresh
  686.     contents.clear
  687.     draw_possession(4, 0)
  688.     draw_material_info(0, line_height * 2)
  689.   end
  690.   #--------------------------------------------------------------------------
  691.   # 仠 傾僀僥儉偺愝掕
  692.   #--------------------------------------------------------------------------
  693.   def set(item, recipe)
  694.     @item = item
  695.     @recipe = recipe
  696.     @make_number = 1
  697.     refresh
  698.   end
  699.   #--------------------------------------------------------------------------
  700.   # 仠 嶌惉屄悢偺愝掕
  701.   #--------------------------------------------------------------------------
  702.   def set_num(make_number)
  703.     @make_number = make_number
  704.     refresh
  705.   end
  706.   #--------------------------------------------------------------------------
  707.   # 仠 強帩悢偺昤夋
  708.   #--------------------------------------------------------------------------
  709.   def draw_possession(x, y)
  710.     rect = Rect.new(x, y, contents.width - 4 - x, line_height)
  711.     change_color(system_color)
  712.     draw_text(rect, Vocab::Possession)
  713.     change_color(normal_color)
  714.     draw_text(rect, $game_party.item_number(@item), 2)
  715.   end
  716.   #--------------------------------------------------------------------------
  717.   # 仠 慺嵽忣曬偺昤夋
  718.   #--------------------------------------------------------------------------
  719.   def draw_material_info(x, y)
  720.     rect = Rect.new(x, y, contents.width, line_height)
  721.     change_color(system_color)
  722.     contents.font.size = 18
  723.     draw_text(rect, "昁梫慺嵽", 0)
  724.     if @recipe
  725.       for i in [email protected]
  726.         kind = @recipe[i][0]
  727.         id   = @recipe[i][1]
  728.         num  = @recipe[i][2]
  729.         if kind == "I"
  730.           item = $data_items[id]
  731.         elsif kind == "W"
  732.           item = $data_weapons[id]
  733.         elsif kind == "A"
  734.           item = $data_armors[id]
  735.         end
  736.         rect = Rect.new(x, y + line_height*i, contents.width, line_height)
  737.         enabled = true
  738.         enabled = false if [num*@make_number, 1].max  > $game_party.item_number(item)
  739.         draw_item_name(item, rect.x, rect.y, enabled)
  740.         change_color(normal_color, enabled)
  741.         if num > 0
  742.           draw_text(rect, "#{num*@make_number}/#{$game_party.item_number(item)}", 2)
  743.         end
  744.       end
  745.     end
  746.     change_color(normal_color)
  747.     contents.font.size = 24
  748.   end
  749. end


  750. #==============================================================================
  751. # 仭 Window_ItemSynthesisNumber
  752. #------------------------------------------------------------------------------
  753. # 丂崌惉夋柺偱丄崌惉偡傞傾僀僥儉偺屄悢傪擖椡偡傞僂傿儞僪僂偱偡丅
  754. #==============================================================================

  755. class Window_ItemSynthesisNumber < Window_ShopNumber
  756.   #--------------------------------------------------------------------------
  757.   # 仠 儕僼儗僢僔儏
  758.   #--------------------------------------------------------------------------
  759.   def refresh
  760.     contents.clear
  761.     draw_item_name(@item, 0, item_y)
  762.     draw_number
  763.     draw_total_price if WD_itemsynthesis_ini::Cost_view
  764.   end
  765.   #--------------------------------------------------------------------------
  766.   # 仠 僆僽僕僃僋僩弶婜壔
  767.   #--------------------------------------------------------------------------
  768.   def material_window=(material_window)
  769.     @material_window = material_window
  770.     call_update_help
  771.   end
  772.   #--------------------------------------------------------------------------
  773.   # 仠 嶌惉屄悢偺曄峏
  774.   #--------------------------------------------------------------------------
  775.   def change_number(amount)
  776.     @number = [[@number + amount, @max].min, 1].max
  777.     call_update_help #捛壛
  778.   end
  779.   #--------------------------------------------------------------------------
  780.   # 仠 僿儖僾僥僉僗僩峏怴
  781.   #--------------------------------------------------------------------------
  782.   def call_update_help
  783.     @material_window.set_num(@number) if @material_window
  784.   end
  785.   #--------------------------------------------------------------------------
  786.   # 仠 Z 儃僞儞乮昞帵愗懼乯偑墴偝傟偨偲偒偺張棟
  787.   #--------------------------------------------------------------------------
  788.   def process_change_window
  789.     Sound.play_cursor
  790.     Input.update
  791.     call_handler(:change_window)
  792.   end
  793.   #--------------------------------------------------------------------------
  794.   # 仠 寛掕傗僉儍儞僙儖側偳偺僴儞僪儕儞僌張棟
  795.   #--------------------------------------------------------------------------
  796.   def process_handling
  797.     super
  798.     if active
  799.       return process_change_window if handle?(:change_window) && Input.trigger?(:Z)
  800. #      return process_change_window if handle?(:change_window) && Input.trigger?(:Z)
  801.     end
  802.   end
  803. end


  804. #==============================================================================
  805. # 仭 Window_ItemSynthesisCategory
  806. #------------------------------------------------------------------------------
  807. # 丂崌惉夋柺偱丄捠忢傾僀僥儉傗憰旛昳偺暘椶傪慖戰偡傞僂傿儞僪僂偱偡丅
  808. #==============================================================================

  809. class Window_ItemSynthesisCategory < Window_ItemCategory
  810.   #--------------------------------------------------------------------------
  811.   # 仠 寘悢偺庢摼
  812.   #--------------------------------------------------------------------------
  813.   def col_max
  814.     i = 0
  815.     i += 1 if WD_itemsynthesis_ini::Category_i
  816.     i += 1 if WD_itemsynthesis_ini::Category_w
  817.     i += 1 if WD_itemsynthesis_ini::Category_a
  818.     i += 1 if WD_itemsynthesis_ini::Category_k
  819.     return i
  820.   end
  821.   #--------------------------------------------------------------------------
  822.   # 仠 僐儅儞僪儕僗僩偺嶌惉
  823.   #--------------------------------------------------------------------------
  824.   def make_command_list
  825.     add_command(Vocab::item,     :item)     if WD_itemsynthesis_ini::Category_i
  826.     add_command(Vocab::weapon,   :weapon)   if WD_itemsynthesis_ini::Category_w
  827.     add_command(Vocab::armor,    :armor)    if WD_itemsynthesis_ini::Category_a
  828.     add_command(Vocab::key_item, :key_item) if WD_itemsynthesis_ini::Category_k
  829.   end
  830. end


  831. #==============================================================================
  832. # 仭 Window_ItemSynthesisNumber
  833. #------------------------------------------------------------------------------
  834. # 丂崌惉夋柺偱丄愗懼傪昞帵偡傞僂傿儞僪僂偱偡丅
  835. #==============================================================================

  836. class Window_ItemSynthesisChange < Window_Base
  837.   #--------------------------------------------------------------------------
  838.   # 仠 僆僽僕僃僋僩弶婜壔
  839.   #--------------------------------------------------------------------------
  840.   def initialize(x, y, width, height)
  841.     super(x, y, width, height)
  842.     refresh
  843.   end
  844.   #--------------------------------------------------------------------------
  845.   # 仠 儕僼儗僢僔儏
  846.   #--------------------------------------------------------------------------
  847.   def refresh
  848.     contents.clear
  849.     text = "Z: 慺嵽 佁 僗僥乕僞僗 昞帵愗傝懼偊"
  850.     draw_text(0, 0, contents_width, line_height, text, 1)
  851.   end
  852. end
复制代码
就是这个了,我是看不懂啊。。
召唤术~
@Mic_洛洛
@xuzhengchi
@仲秋启明
@delv25
@杂兵天下
@fxwd
@迷糊的安安
<

Lv2.观梦者

梦石
0
星屑
758
在线时间
2064 小时
注册时间
2011-10-3
帖子
1686
2
发表于 2012-10-5 18:40:54 | 只看该作者
38行后添加

  #以下、合成レシピ。
  #例: I_recipe[3]  = [100, ["I",1,1], ["W",2,1], ["A",2,2], ["A",3,1]]
  #と記載した場合、ID3のアイテムの合成必要は、100G。
  #必要な素材は、ID1のアイテム1個、ID2の武器1個、ID2の防具2個、ID3の防具1個
  #となる。
  
  #アイテムの合成レシピ
  I_recipe[2]  = [10,  ["I",1,2]]←合成ID2的道具,需要10块钱,ID为1的道具2个,剩下的自己研究吧
  I_recipe[3]  = [100, ["I",1,1], ["I",2,1]]
  I_recipe[17] = [500, ["I",1,10]]

  #武器の合成レシピ
  W_recipe[3]  = [50,   ["W",1,1], ["W",2,1]]
  W_recipe[6]  = [600,  ["W",3,1], ["I",17,0]]
  
  #防具の合成レシピ  
  A_recipe[2]  = [40,   ["A",1,2]]
  A_recipe[5]  = [400,  ["A",2,1], ["W",2,2], ["I",17,0]]

点评

额。具体点。。这样还是看不懂呢。 就是告诉我怎么设置 你举个例子吧  发表于 2012-10-5 18:42
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
758
在线时间
2064 小时
注册时间
2011-10-3
帖子
1686
3
发表于 2012-10-5 18:45:42 | 只看该作者
要添加道具合成表就在#アイテムの合成レシピ下直接添加,其他同理

点评

谢谢。我懂了。  发表于 2012-10-5 18:48
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
60 小时
注册时间
2012-2-8
帖子
10
4
发表于 2012-10-26 20:00:36 | 只看该作者
布里蓝 发表于 2012-10-5 18:45
要添加道具合成表就在#アイテムの合成レシピ下直接添加,其他同理

再请教个问题。如果我想让不同的事件显示不同的合成按钮,比如说,一个事件只显示合成物品(例如专业的道具合成商店),一个事件只显示武器合成(例如专业的武器合成商店)。在呼出界面之前,要如何进行脚本上的控制才能实现?

点评

谢谢!知道了。就是感觉挺浪费资源的,呵呵……  发表于 2012-10-27 11:02
我研究过,因为一进去就初始化...我一直改不了。只有再用其他的脚本了  发表于 2012-10-27 09:22
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-23 04:33

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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