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

Project1

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

[已经解决] 研究了半天,还是过来请教下好了,谢谢。

[复制链接]

Lv1.梦旅人

梦石
0
星屑
239
在线时间
2399 小时
注册时间
2008-4-11
帖子
12326

贵宾第6届短篇游戏比赛季军

跳转到指定楼层
1
发表于 2013-8-13 02:56:34 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
3星屑

研究了一会儿,但是始终不知道该怎么做,只好来求助各位了。
这个合成脚本一切都很满意,只是目前它只对合成物品分了四个类:道具、武器、防具、重要品
我想要给武器和防具再细分出来,比如武器分成剑系、斧系、枪系,而防具分成盾、甲、盔、饰

我知道可能有些强人所难,因为看了这一段这样写:
   case @category
    when :item
      item.is_a?(RPG::Item) && !item.key_item?
    when :weapon
      item.is_a?(RPG::Weapon)
    when :armor
      item.is_a?(RPG::Armor)
    when :key_item
      item.is_a?(RPG::Item) && item.key_item?

如果要添加新的类,肯定不是件容易事。
总之谢谢大家,如果能给个思路也可以的,
比如说把weapon设定成id1~20是weapon_sword,21~40是weapon_axe
这样我只需要把剑系都设定在武器栏的1~20就可以实现分类的读取了。
  1. #==============================================================================
  2. # ■ RGSS3 アイテム合成 ver 1.02
  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 #費用(G)の表示(合成の費用が全て0Gの場合はfalseを推奨)
  20.   
  21.   Category_i = true #カテゴリウィンドウに「道具」の項目を表示
  22.   Category_w = true #カテゴリウィンドウに「武器」の項目を表示
  23.   Category_a = true #カテゴリウィンドウに「防具」の項目を表示
  24.   Category_k = false #カテゴリウィンドウに「重要物」の項目を表示
  25.   
  26.   I_recipe = [] #この行は削除しないこと
  27.   W_recipe = [] #この行は削除しないこと
  28.   A_recipe = [] #この行は削除しないこと
  29.   
  30.   #以下、合成レシピ。
  31.   #例: I_recipe[3]  = [100, ["I",1,1], ["W",2,1], ["A",2,2], ["A",3,1]]
  32.   #と記載した場合、ID3のアイテムの合成必要は、100G。
  33.   #必要な素材は、ID1のアイテム1個、ID2の武器1個、ID2の防具2個、ID3の防具1個
  34.   #となる。
  35.   
  36.   #アイテムの合成レシピ
  37.   I_recipe[31]  = [1,  ["I",21,1], ["I",41,1]]
  38.   I_recipe[32]  = [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.   end
  226.   #--------------------------------------------------------------------------
  227.   # ● ステータスウィンドウの作成
  228.   #--------------------------------------------------------------------------
  229.   def create_status_window
  230.     wx = @number_window.width
  231.     wy = @dummy_window.y
  232.     ww = Graphics.width - wx
  233.     wh = @dummy_window.height
  234.     @status_window = Window_ShopStatus.new(wx, wy, ww, wh)
  235.     @status_window.viewport = @viewport
  236.     @status_window.hide
  237.   end
  238.   #--------------------------------------------------------------------------
  239.   # ● 素材ウィンドウの作成
  240.   #--------------------------------------------------------------------------
  241.   def create_material_window
  242.     wx = @number_window.width
  243.     wy = @dummy_window.y
  244.     ww = Graphics.width - wx
  245.     wh = @dummy_window.height
  246.     @material_window = Window_ItemSynthesisMaterial.new(wx, wy, ww, wh)
  247.     @material_window.viewport = @viewport
  248.     @material_window.hide
  249.     @number_window.material_window = @material_window
  250.   end
  251.   #--------------------------------------------------------------------------
  252.   # ● 合成アイテムリストウィンドウの作成
  253.   #--------------------------------------------------------------------------
  254.   def create_list_window
  255.     wy = @dummy_window.y
  256.     wh = @dummy_window.height
  257.     @list_window = Window_ItemSynthesisList.new(0, wy, wh)
  258.     @list_window.viewport = @viewport
  259.     @list_window.help_window = @help_window
  260.     @list_window.status_window = @status_window
  261.     @list_window.material_window = @material_window
  262.     @list_window.hide
  263.     @list_window.set_handler(:ok,     method(:on_list_ok))
  264.     @list_window.set_handler(:cancel, method(:on_list_cancel))
  265.     @list_window.set_handler(:change_window, method(:on_change_window))   
  266.   end
  267.   #--------------------------------------------------------------------------
  268.   # ● カテゴリウィンドウの作成
  269.   #--------------------------------------------------------------------------
  270.   def create_category_window
  271.     @category_window = Window_ItemSynthesisCategory.new
  272.     @category_window.viewport = @viewport
  273.     @category_window.help_window = @help_window
  274.     @category_window.y = @help_window.height
  275.     @category_window.activate
  276.     @category_window.item_window = @list_window
  277.     @category_window.set_handler(:ok,     method(:on_category_ok))
  278.     @category_window.set_handler(:cancel, method(:return_scene))
  279.   end
  280.   #--------------------------------------------------------------------------
  281.   # ● 合成アイテムリストウィンドウのアクティブ化
  282.   #--------------------------------------------------------------------------
  283.   def activate_list_window
  284.     @list_window.money = money
  285.     @list_window.show.activate
  286.   end
  287.   #--------------------------------------------------------------------------
  288.   # ● 合成[決定]
  289.   #--------------------------------------------------------------------------
  290.   def on_list_ok
  291.     @item = @list_window.item
  292.     @list_window.hide
  293.     @number_window.set(@item, max_buy, buying_price, currency_unit)
  294.     @number_window.show.activate
  295.   end
  296.   #--------------------------------------------------------------------------
  297.   # ● 合成[キャンセル]
  298.   #--------------------------------------------------------------------------
  299.   def on_list_cancel
  300.     @category_window.activate
  301.     @category_window.show
  302.     @dummy_window.show
  303.     @list_window.hide
  304.     @status_window.hide
  305.     @status_window.item = nil
  306.     @material_window.hide
  307.     @material_window.set(nil, nil)
  308.     @gold_window.hide
  309.     @change_window.hide
  310.     @help_window.clear
  311.   end
  312.   #--------------------------------------------------------------------------
  313.   # ● 表示切替
  314.   #--------------------------------------------------------------------------
  315.   def on_change_window
  316.     if @status_window.visible
  317.       @status_window.hide
  318.       @material_window.show
  319.     else
  320.       @status_window.show
  321.       @material_window.hide
  322.     end
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # ● カテゴリ[決定]
  326.   #--------------------------------------------------------------------------
  327.   def on_category_ok
  328.     activate_list_window
  329.     @gold_window.show
  330.     @change_window.show
  331.     @material_window.show
  332.     @category_window.hide
  333.     @list_window.select(0)
  334.   end
  335.   #--------------------------------------------------------------------------
  336.   # ● 個数入力[決定]
  337.   #--------------------------------------------------------------------------
  338.   def on_number_ok
  339.     Sound.play_shop
  340.     do_syntetic(@number_window.number)
  341.     end_number_input
  342.     @gold_window.refresh
  343.   end
  344.   #--------------------------------------------------------------------------
  345.   # ● 個数入力[キャンセル]
  346.   #--------------------------------------------------------------------------
  347.   def on_number_cancel
  348.     Sound.play_cancel
  349.     end_number_input
  350.   end
  351.   #--------------------------------------------------------------------------
  352.   # ● 合成の実行
  353.   #--------------------------------------------------------------------------
  354.   def do_syntetic(number)
  355.     $game_party.lose_gold(number * buying_price)
  356.     $game_party.gain_item(@item, number)
  357.    
  358.       @recipe = @list_window.recipe(@item)
  359.       for i in [email protected]
  360.         kind = @recipe[i][0]
  361.         id   = @recipe[i][1]
  362.         num  = @recipe[i][2]
  363.         if kind == "I"
  364.           item = $data_items[id]
  365.         elsif kind == "W"
  366.           item = $data_weapons[id]
  367.         elsif kind == "A"
  368.           item = $data_armors[id]
  369.         end
  370.         $game_party.lose_item(item, num*number)
  371.       end
  372.   end
  373.   #--------------------------------------------------------------------------
  374.   # ● 個数入力の終了
  375.   #--------------------------------------------------------------------------
  376.   def end_number_input
  377.     @number_window.hide
  378.     activate_list_window
  379.   end
  380.   #--------------------------------------------------------------------------
  381.   # ● 最大購入可能個数の取得
  382.   #--------------------------------------------------------------------------
  383.   def max_buy
  384.     max = $game_party.max_item_number(@item) - $game_party.item_number(@item)
  385.    
  386.     @recipe = @list_window.recipe(@item)
  387.       for i in [email protected]
  388.         kind = @recipe[i][0]
  389.         id   = @recipe[i][1]
  390.         num  = @recipe[i][2]
  391.         if kind == "I"
  392.           item = $data_items[id]
  393.         elsif kind == "W"
  394.           item = $data_weapons[id]
  395.         elsif kind == "A"
  396.           item = $data_armors[id]
  397.         end
  398.         if num > 0
  399.           max_buf = $game_party.item_number(item)/num
  400.         else
  401.           max_buf = 999
  402.         end
  403.         max = [max, max_buf].min
  404.       end
  405.       
  406.     buying_price == 0 ? max : [max, money / buying_price].min

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


  427. #==============================================================================
  428. # ■ Window_ItemSynthesisList
  429. #------------------------------------------------------------------------------
  430. #  合成画面で、合成可能なアイテムの一覧を表示するウィンドウです。
  431. #==============================================================================

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


  667. #==============================================================================
  668. # ■ Window_ItemSynthesisMaterial
  669. #------------------------------------------------------------------------------
  670. #  合成画面で、合成に必要な素材を表示するウィンドウです。
  671. #==============================================================================

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


  749. #==============================================================================
  750. # ■ Window_ItemSynthesisNumber
  751. #------------------------------------------------------------------------------
  752. #  合成画面で、合成するアイテムの個数を入力するウィンドウです。
  753. #==============================================================================

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


  785. #==============================================================================
  786. # ■ Window_ItemSynthesisCategory
  787. #------------------------------------------------------------------------------
  788. #  合成画面で、通常アイテムや装備品の分類を選択するウィンドウです。
  789. #==============================================================================

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


  812. #==============================================================================
  813. # ■ Window_ItemSynthesisNumber
  814. #------------------------------------------------------------------------------
  815. #  合成画面で、切替を表示するウィンドウです。
  816. #==============================================================================

  817. class Window_ItemSynthesisChange < Window_Base
  818.   #--------------------------------------------------------------------------
  819.   # ● オブジェクト初期化
  820.   #--------------------------------------------------------------------------
  821.   def initialize(x, y, width, height)
  822.     super(x, y, width, height)
  823.     refresh
  824.   end
  825.   #--------------------------------------------------------------------------
  826.   # ● リフレッシュ
  827.   #--------------------------------------------------------------------------
  828.   def refresh
  829.     contents.clear
  830.     text = "点击A键隐藏材料清单"
  831.     draw_text(0, 0, contents_width, line_height, text, 1)
  832.   end
  833. end

复制代码

最佳答案

查看完整内容

我稍微调整了一下,应该可以实现楼主想要的功能了 是通过物品ID实现的 默认是20个一组 我把改动的、新增的地方都添加了形如#########的标记 需要自定义的地方都有形如#▼▼▼▼的标记 很显眼,应该看得到 因为没有完整版的脚本(其实我根本没去试= =!)所以如果还有什么问题就请@我,我应该晚上会再来 脚本:#============================================================================== # ■ RGSS3 アイテム合成 ver 1.02 ...

Lv4.逐梦者 (版主)

百合控

梦石
0
星屑
6438
在线时间
1274 小时
注册时间
2013-8-21
帖子
3657

开拓者

2
发表于 2013-8-13 02:56:35 | 只看该作者
本帖最后由 76213585 于 2013-10-5 19:36 编辑

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

無法滾動的代碼框什麼的好影響閱讀

点评

不過我想你現在早就會了........  发表于 2013-10-28 07:51
我現在才看到........... 代碼框有Ruby版跟一般Code版 在高級模式中的就是Ruby版  发表于 2013-10-28 07:51
好吧我又忘了,点评里@不到人…………  发表于 2013-10-6 10:52
哇,感谢版主,话说…………怎么调整代码框……@76213585  发表于 2013-10-6 10:51
萌新瑟瑟发抖
看到我请叫我去干活
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
323 小时
注册时间
2010-8-21
帖子
666
3
发表于 2013-8-13 03:51:47 | 只看该作者
貌似没懂lz意思,“用语”里面不是有“武器类型”(weapon_obj.wtype_id)和"护甲类型"(armor_obj.atype_id)么,对照设定就能
设定为剑系、斧系、枪系等等等等...
>>猛戳>>MetalSagaR游戏主页<<这里<<
欢迎提供您的意见
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
79 小时
注册时间
2013-1-15
帖子
100
4
发表于 2013-8-13 06:22:07 | 只看该作者
本帖最后由 qqabcc 于 2013-8-13 06:24 编辑

弄下来研究下
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
681
在线时间
791 小时
注册时间
2011-10-20
帖子
2394

开拓者

5
发表于 2013-8-13 10:04:40 | 只看该作者
瞬鼠的题一般都很简单,俺也来试试手气

点评

既然这么多人俺就放弃抢撸主了。  发表于 2013-8-14 18:00
欢迎点此进入我的egames.wink.ws,有RMQQ堂等

[url=http://rpg.blue/thread-317273-1-1.html]短篇八-赶选

http://yun.baidu.com/share/link?shareid=2158225779&uk=169642147&third=0


历险ARPG赢回你的疆域新的战斗模式?…………点击这里:[宋乱贼狂 for QQ堂]
http://rpg.blue/group-368-1.html
programing ....?
[url=http://rpg.blue/thrd-234658-1-1.html]
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
239
在线时间
2399 小时
注册时间
2008-4-11
帖子
12326

贵宾第6届短篇游戏比赛季军

6
 楼主| 发表于 2013-8-13 13:34:23 手机端发表。 | 只看该作者
end55rpg 发表于 2013-8-13 10:04
瞬鼠的题一般都很简单,俺也来试试手气

谢谢啊,希望能研究出来
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
256 小时
注册时间
2013-5-27
帖子
196
7
发表于 2013-8-13 13:43:51 | 只看该作者
我这个应该对你有帮助,剩下的我估计你自己能搞定。
http://rpg.blue/thread-325946-1-1.html
回复

使用道具 举报

Lv5.捕梦者 (暗夜天使)

只有笨蛋才会看到

梦石
1
星屑
21020
在线时间
9338 小时
注册时间
2012-6-19
帖子
7107

开拓者短篇九导演组冠军

8
发表于 2013-8-13 15:40:41 | 只看该作者
本帖最后由 喵呜喵5 于 2013-8-14 16:06 编辑

瞬鼠的题一般都很简单,俺也来试试手气+1

只说思路,因为这个白之魔的脚本好长懒得看了…………= =

先插入这两段脚本:

RUBY 代码复制
  1. class RPG::UsableItem
  2.   def item2?
  3.     /<item2>/ =~ @note ? true : false  
  4.   end
  5. end
  6. #检查物品的备注栏里面有没有<item2>这样的备注
  7.  
  8. class RPG::EquipItem
  9.   def equip2?
  10.     /<equip2>/ =~ @note ? true : false  
  11.   end
  12. end
  13. #检查武器、护甲的备注栏里面有没有<Equip2>这样的备注


然后修改你拿出来的那段脚本

RUBY 代码复制
  1. case @category
  2.     when :item
  3.       item.is_a?(RPG::Item) && !item.key_item? && !item.item2? #如果备注栏里有<item2>就不在这个分类中显示本物品
  4.     when :item2
  5.       item.is_a?(RPG::Item) && !item.key_item? && item.item2? #只在这个分类中显示备注栏里有<item2>的物品
  6.     when :weapon
  7.       item.is_a?(RPG::Weapon) && !item.hide_item? && !item.equip2? #如果备注栏里有<equip2>就不在这个分类中显示本武器
  8.     when :weapon2
  9.       item.is_a?(RPG::Weapon) && !item.hide_item? && item.equip2? #只在这个分类中显示备注栏里有<equip2>的武器
  10.     when :armor
  11.       item.is_a?(RPG::Armor)  && !item.hide_item? && !item.equip2? #如果备注栏里有<equip2>就不在这个分类中显示本护甲
  12.     when :armor2
  13.       item.is_a?(RPG::Armor)  && !item.hide_item? && item.equip2? #只在这个分类中显示备注栏里有<equip2>的护甲
  14.     when :key_item
  15.       item.is_a?(RPG::Item) && item.key_item?
  16.     else
  17.       false
  18.     end


这样应该就可以了,接着修改一下分类菜单就好了……
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
239
在线时间
2399 小时
注册时间
2008-4-11
帖子
12326

贵宾第6届短篇游戏比赛季军

9
 楼主| 发表于 2013-8-13 18:09:22 手机端发表。 | 只看该作者
喵呜喵5 发表于 2013-8-13 15:40
瞬鼠的题一般都很简单,俺也来试试手气+1

只说思路,因为这个白之魔的脚本好长懒得看了…………= =

利用备注栏这个我也想到了,之所以没有提出来是因为我不知道会不会有什么潜在的冲突(我现在的系统里面就有利用备注栏的),不知道会不会有冲突
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
239
在线时间
2399 小时
注册时间
2008-4-11
帖子
12326

贵宾第6届短篇游戏比赛季军

10
 楼主| 发表于 2013-8-13 18:09:59 手机端发表。 | 只看该作者
喵呜喵5 发表于 2013-8-13 15:40
瞬鼠的题一般都很简单,俺也来试试手气+1

只说思路,因为这个白之魔的脚本好长懒得看了…………= =

利用备注栏这个我也想到了,之所以没有提出来是因为我不知道会不会有什么潜在的冲突(我现在的系统里面就有利用备注栏的),不知道会不会有冲突
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-12 21:58

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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