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

Project1

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

[已经解决] 这个‘物品合成’的VA脚本运行出错,该如何修改?

[复制链接]

Lv3.寻梦者

梦石
1
星屑
472
在线时间
120 小时
注册时间
2016-3-6
帖子
83
跳转到指定楼层
1
发表于 2016-3-7 20:15:22 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我是个新手菜鸡,接触RM的时间还不长。关于物品合成的脚本,虽然之前论坛上见过不少关于物品合成或者装备锻造的脚本,这些脚本也大都提供范例工程下载,用起来十分方便。可问题是当我试过其中几款后感觉太复杂了,实际上我不想搞成网游的那种升装备方式。
终于有一天,我找到了一个相对简单些的合成脚本。可以合成包括装备和道具在内的所有物品。但问题也来了:该脚本运行一直出错,提示:第381行 发生SyntaxError  
下为脚本:
  1. #==============================================================================
  2. # ■ RGSS3 合成 ver 1.01
  3. #------------------------------------------------------------------------------
  4. #  配布元:
  5. #     白の魔 [url]http://izumiwhite.web.fc2.com/[/url]
  6. #
  7. #  利用規約:
  8. #     RPGツクールVXの正規の登録者のみご利用になれます。
  9. #     利用報告・著作権表示とかは必要ありません。
  10. #     改造もご自由にどうぞ。
  11. #     何か問題が発生しても責任は持ちません。
  12. #==============================================================================


  13. #--------------------------------------------------------------------------
  14. # ★ 初期設定。
  15. #    合成レシピ等の設定
  16. #--------------------------------------------------------------------------
  17. module WD_itemsynthesis_ini

  18.   Cost_view =  true #費用(G)の表示(合成の費用が全て0Gの場合はfalseを推奨)

  19.   Category_i = true #カテゴリウィンドウに「アイテム」の項目を表示
  20.   Category_w = true #カテゴリウィンドウに「武器」の項目を表示
  21.   Category_a = true #カテゴリウィンドウに「防具」の項目を表示
  22.   Category_k = true #カテゴリウィンドウに「大事なもの」の項目を表示

  23.   I_recipe = [] #この行は削除しないこと
  24.   W_recipe = [] #この行は削除しないこと
  25.   A_recipe = [] #この行は削除しないこと

  26.   #以下、合成レシピ。
  27.   #例: I_recipe[3]  = [100, ["I",1,1], ["W",2,1], ["A",2,2], ["A",3,1]]
  28.   #と記載した場合、ID3のアイテムの合成必要は、100G。(ID为3的道具合成需要花费100G)
  29.   #必要な素材は、ID1のアイテム1個、ID2の武器1個、ID2の防具2個、ID3の防具1個(合成所需的素材为ID为1的物品1个、ID为1的武器1个、ID为2的防具2个、ID为3的防具1个)
  30.   #となる。

  31. #这里下面几个是默认的几个公式,可以删除或者修改
  32.   #アイテムの合成レシピ
  33.   I_recipe[1]  = [10,  ["I",2,2]]
  34.   I_recipe[3]  = [100, ["I",1,1], ["I",2,1]]
  35.   I_recipe[17] = [500, ["I",1,10]]

  36.   #武器の合成レシピ
  37.   W_recipe[3]  = [50,   ["W",1,1], ["W",2,1]]
  38.   W_recipe[6]  = [600,  ["W",3,1], ["I",17,0]]

  39.   #防具の合成レシピ  
  40.   A_recipe[2]  = [40,   ["A",1,2]]
  41.   A_recipe[5]  = [400,  ["A",2,1], ["W",2,2], ["I",17,0]]



  42. end


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

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

  134. end

  135. class Game_Interpreter
  136.   include WD_itemsynthesis
  137. end

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


  156. #==============================================================================
  157. # ■ Scene_ItemSynthesis
  158. #------------------------------------------------------------------------------
  159. #  合成画面の処理を行うクラスです。
  160. #==============================================================================

  161. class Scene_ItemSynthesis < Scene_MenuBase
  162.   #--------------------------------------------------------------------------
  163.   # ● 開始処理
  164.   #--------------------------------------------------------------------------
  165.   def start
  166.     super

  167.     create_help_window
  168.     create_dummy_window
  169.     create_number_window
  170.     create_status_window
  171.     create_material_window
  172.     create_list_window
  173.     create_category_window
  174.     create_gold_window
  175.     create_change_window
  176.   end
  177.   #--------------------------------------------------------------------------
  178.   # ● ゴールドウィンドウの作成
  179.   #--------------------------------------------------------------------------
  180.   def create_gold_window
  181.     @gold_window = Window_Gold.new
  182.     @gold_window.viewport = @viewport
  183.     @gold_window.x = Graphics.width - @gold_window.width
  184.     @gold_window.y = @help_window.height
  185.     @gold_window.hide
  186.   end
  187.   #--------------------------------------------------------------------------
  188.   # ● 切り替え表示ウィンドウの作成
  189.   #--------------------------------------------------------------------------
  190.   def create_change_window
  191.     wx = 0
  192.     wy = @gold_window.y
  193.     ww = Graphics.width - @gold_window.width
  194.     wh = @gold_window.height
  195.     @change_window = Window_ItemSynthesisChange.new(wx, wy, ww, wh)
  196.     @change_window.viewport = @viewport
  197.     @change_window.hide
  198.   end
  199.   #--------------------------------------------------------------------------
  200.   # ● ダミーウィンドウの作成
  201.   #--------------------------------------------------------------------------
  202.   def create_dummy_window
  203.     wy = @help_window.y + @help_window.height + 48
  204.     wh = Graphics.height - wy
  205.     @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
  206.     @dummy_window.viewport = @viewport
  207.   end
  208.   #--------------------------------------------------------------------------
  209.   # ● 個数入力ウィンドウの作成
  210.   #--------------------------------------------------------------------------
  211.   def create_number_window
  212.     wy = @dummy_window.y
  213.     wh = @dummy_window.height
  214.     @number_window = Window_ItemSynthesisNumber.new(0, wy, wh)
  215.     @number_window.viewport = @viewport
  216.     @number_window.hide
  217.     @number_window.set_handler(:ok,     method(:on_number_ok))
  218.     @number_window.set_handler(:cancel, method(:on_number_cancel))
  219.   end
  220.   #--------------------------------------------------------------------------
  221.   # ● ステータスウィンドウの作成
  222.   #--------------------------------------------------------------------------
  223.   def create_status_window
  224.     wx = @number_window.width
  225.     wy = @dummy_window.y
  226.     ww = Graphics.width - wx
  227.     wh = @dummy_window.height
  228.     @status_window = Window_ShopStatus.new(wx, wy, ww, wh)
  229.     @status_window.viewport = @viewport
  230.     @status_window.hide
  231.   end
  232.   #--------------------------------------------------------------------------
  233.   # ● 素材ウィンドウの作成
  234.   #--------------------------------------------------------------------------
  235.   def create_material_window
  236.     wx = @number_window.width
  237.     wy = @dummy_window.y
  238.     ww = Graphics.width - wx
  239.     wh = @dummy_window.height
  240.     @material_window = Window_ItemSynthesisMaterial.new(wx, wy, ww, wh)
  241.     @material_window.viewport = @viewport
  242.     @material_window.hide
  243.     @number_window.material_window = @material_window
  244.   end
  245.   #--------------------------------------------------------------------------
  246.   # ● 合成アイテムリストウィンドウの作成
  247.   #--------------------------------------------------------------------------
  248.   def create_list_window
  249.     wy = @dummy_window.y
  250.     wh = @dummy_window.height
  251.     @list_window = Window_ItemSynthesisList.new(0, wy, wh)
  252.     @list_window.viewport = @viewport
  253.     @list_window.help_window = @help_window
  254.     @list_window.status_window = @status_window
  255.     @list_window.material_window = @material_window
  256.     @list_window.hide
  257.     @list_window.set_handler(:ok,     method(:on_list_ok))
  258.     @list_window.set_handler(:cancel, method(:on_list_cancel))
  259.     @list_window.set_handler(:change_window, method(:on_change_window))   
  260.   end
  261.   #--------------------------------------------------------------------------
  262.   # ● カテゴリウィンドウの作成
  263.   #--------------------------------------------------------------------------
  264.   def create_category_window
  265.     @category_window = Window_ItemSynthesisCategory.new
  266.     @category_window.viewport = @viewport
  267.     @category_window.help_window = @help_window
  268.     @category_window.y = @help_window.height
  269.     @category_window.activate
  270.     @category_window.item_window = @list_window
  271.     @category_window.set_handler(:ok,     method(:on_category_ok))
  272.     @category_window.set_handler(:cancel, method(:return_scene))
  273.   end

  274.   def return_scene
  275.     $game_map.autoplay
  276.     SceneManager.return
  277.   end

  278.   #--------------------------------------------------------------------------
  279.   # ● 合成アイテムリストウィンドウのアクティブ化
  280.   #--------------------------------------------------------------------------
  281.   def activate_list_window
  282.     @list_window.money = money
  283.     @list_window.show.activate
  284.   end
  285.   #--------------------------------------------------------------------------
  286.   # ● 合成[決定]
  287.   #--------------------------------------------------------------------------
  288.   def on_list_ok
  289.     @item = @list_window.item
  290.     @list_window.hide
  291.     @number_window.set(@item, max_buy, buying_price, currency_unit)
  292.     @number_window.show.activate
  293.   end
  294.   #--------------------------------------------------------------------------
  295.   # ● 合成[キャンセル]
  296.   #--------------------------------------------------------------------------
  297.   def on_list_cancel
  298.     @category_window.activate
  299.     @category_window.show
  300.     @dummy_window.show
  301.     @list_window.hide
  302.     @status_window.hide
  303.     @status_window.item = nil
  304.     @material_window.hide
  305.     @material_window.set(nil, nil)
  306.     @gold_window.hide
  307.     @change_window.hide
  308.     @help_window.clear
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   # ● 表示切替
  312.   #--------------------------------------------------------------------------
  313.   def on_change_window
  314.     if @status_window.visible
  315.       @status_window.hide
  316.       @material_window.show
  317.     else
  318.       @status_window.show
  319.       @material_window.hide
  320.     end
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ● カテゴリ[決定]
  324.   #--------------------------------------------------------------------------
  325.   def on_category_ok
  326.     activate_list_window
  327.     @gold_window.show
  328.     @change_window.show
  329.     @material_window.show
  330.     @category_window.hide
  331.     @list_window.select(0)
  332.   end
  333.   #--------------------------------------------------------------------------
  334.   # ● 個数入力[決定]
  335.   #--------------------------------------------------------------------------
  336.   def on_number_ok
  337.     Sound.play_shop
  338.     do_syntetic(@number_window.number)
  339.     end_number_input
  340.     @gold_window.refresh
  341.   end
  342.   #--------------------------------------------------------------------------
  343.   # ● 個数入力[キャンセル]
  344.   #--------------------------------------------------------------------------
  345.   def on_number_cancel
  346.     Sound.play_cancel
  347.     end_number_input
  348.   end
  349.   #--------------------------------------------------------------------------
  350.   # ● 合成の実行
  351.   #--------------------------------------------------------------------------
  352.   def do_syntetic(number)
  353.     $game_party.lose_gold(number * buying_price)
  354.     $game_party.gain_item(@item, number)

  355.       [url=home.php?mod=space&uid=2564094]@recipe[/url] = @list_window.recipe(@item)
  356.       for i in [email][email protected][/email]
  357.         kind = @recipe[i][0]
  358.         id   = @recipe[i][1]
  359.         num  = @recipe[i][2]
  360.         if kind == "I"
  361.           item = $data_items[id]
  362.         elsif kind == "W"
  363.           item = $data_weapons[id]
  364.         elsif kind == "A"
  365.           item = $data_armors[id]
  366.         end
  367.         $game_party.lose_item(item, num*number)
  368.       end
  369.   end
  370.   #--------------------------------------------------------------------------
  371.   # ● 個数入力の終了
  372.   #--------------------------------------------------------------------------
  373.   def end_number_input
  374.     @number_window.hide
  375.     activate_list_window
  376.   end
  377.   #--------------------------------------------------------------------------
  378.   # ● 最大購入可能個数の取得
  379.   #--------------------------------------------------------------------------
  380.   def max_buy
  381.     max = $game_party.max_item_number(@item) - $game_party.item_number(@item)

  382.     @recipe = @list_window.recipe(@item)
  383.       for i in [email][email protected][/email]
  384.         kind = @recipe[i][0]
  385.         id   = @recipe[i][1]
  386.         num  = @recipe[i][2]
  387.         if kind == "I"
  388.           item = $data_items[id]
  389.         elsif kind == "W"
  390.           item = $data_weapons[id]
  391.         elsif kind == "A"
  392.           item = $data_armors[id]
  393.         end
  394.         if num > 0
  395.           max_buf = $game_party.item_number(item)/num
  396.         else
  397.           max_buf = 999
  398.         end
  399.         max = [max, max_buf].min
  400.       end

  401.     buying_price == 0 ? max : [max, money / buying_price].min

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


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

  427. class Window_ItemSynthesisList < Window_Selectable
  428.   include WD_itemsynthesis
  429.   #--------------------------------------------------------------------------
  430.   # ● 公開インスタンス変数
  431.   #--------------------------------------------------------------------------
  432.   attr_reader   :status_window            # ステータスウィンドウ
  433.   #--------------------------------------------------------------------------
  434.   # ● オブジェクト初期化
  435.   #--------------------------------------------------------------------------
  436.   def initialize(x, y, height)
  437.     super(x, y, window_width, height)

  438.     @shop_goods = []
  439.     @shop_recipes = []

  440.     for i in 1..WD_itemsynthesis_ini::I_recipe.size
  441.       recipe = WD_itemsynthesis_ini::I_recipe[i]
  442.       if recipe
  443.         good = [0, i, recipe[0]]
  444.         if i_recipe_switch_on?(i)
  445.           @shop_goods.push(good)
  446.           @shop_recipes.push(recipe)
  447.         end
  448.       end
  449.     end
  450.     for i in 1..WD_itemsynthesis_ini::W_recipe.size
  451.       recipe = WD_itemsynthesis_ini::W_recipe[i]
  452.       if recipe
  453.         good = [1, i, recipe[0]]
  454.         if w_recipe_switch_on?(i)
  455.           @shop_goods.push(good)
  456.           @shop_recipes.push(recipe)
  457.         end
  458.       end
  459.     end
  460.     for i in 1..WD_itemsynthesis_ini::A_recipe.size
  461.       recipe = WD_itemsynthesis_ini::A_recipe[i]
  462.       if recipe
  463.         good = [2, i, recipe[0]]
  464.         if a_recipe_switch_on?(i)
  465.           @shop_goods.push(good)
  466.           @shop_recipes.push(recipe)
  467.         end
  468.       end
  469.     end

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


  659. #==============================================================================
  660. # ■ Window_ItemSynthesisMaterial
  661. #------------------------------------------------------------------------------
  662. #  合成画面で、合成に必要な素材を表示するウィンドウです。
  663. #==============================================================================

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


  741. #==============================================================================
  742. # ■ Window_ItemSynthesisNumber
  743. #------------------------------------------------------------------------------
  744. #  合成画面で、合成するアイテムの個数を入力するウィンドウです。
  745. #==============================================================================

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


  777. #==============================================================================
  778. # ■ Window_ItemSynthesisCategory
  779. #------------------------------------------------------------------------------
  780. #  合成画面で、通常アイテムや装備品の分類を選択するウィンドウです。
  781. #==============================================================================

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


  804. #==============================================================================
  805. # ■ Window_ItemSynthesisNumber
  806. #------------------------------------------------------------------------------
  807. #  合成画面で、切替を表示するウィンドウです。
  808. #==============================================================================

  809. class Window_ItemSynthesisChange < Window_Base
  810.   #--------------------------------------------------------------------------
  811.   # ● オブジェクト初期化
  812.   #--------------------------------------------------------------------------
  813.   def initialize(x, y, width, height)
  814.     super(x, y, width, height)
  815.     refresh
  816.   end
  817.   #--------------------------------------------------------------------------
  818.   # ● リフレッシュ
  819.   #--------------------------------------------------------------------------
  820.   def refresh
  821.     contents.clear
  822.     text = "← → :显示转换"
  823.     draw_text(0, 0, contents_width, line_height, text, 1)
  824.   end
  825. end
复制代码
原帖地址:https://rpg.blue/thread-369078-1-1.html     (原帖作者并没有提供范例下载)


以上....求教各路大神,这个脚本该作何种修改?

或者说有没有类似的脚本?就是那种简单不复杂合成脚本
R

Lv4.逐梦者

「Pemercyia」


Urhurrenna

梦石
0
星屑
9402
在线时间
2749 小时
注册时间
2008-9-5
帖子
3542

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

2
发表于 2016-3-7 20:44:55 | 只看该作者
坛子转码的锅,把所有带
  1. [email]xxx[/email]
复制代码
的email和中括号都删了。

点评

额= = 话说...日文注释有点看不懂...那个..按照格式写好合成的配方列表后,应该添加在脚本哪个地方?  发表于 2016-3-7 21:59
成了!我这菜鸡让你见笑了啊...说实话我也就只会弄弄事件设置而已,对脚本一窍不通...再次感谢!收下我的膝盖吧!  发表于 2016-3-7 21:04
还有url的也一样。  发表于 2016-3-7 20:45
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
1
星屑
472
在线时间
120 小时
注册时间
2016-3-6
帖子
83
3
 楼主| 发表于 2016-3-7 22:00:17 | 只看该作者
cinderelmini 发表于 2016-3-7 20:44
坛子转码的锅,把所有带的email和中括号都删了。

额= = 话说...日文注释有点看不懂...那个..按照格式写好合成的配方列表后,应该添加在脚本哪个地方?

点评

就在1L代码框里面的39行以下,54行的那个end以上的部分自己写配方,默认那里写着几个范例配方的那里。  发表于 2016-3-7 22:05
R
回复 支持 反对

使用道具 举报

Lv4.逐梦者

「Pemercyia」


Urhurrenna

梦石
0
星屑
9402
在线时间
2749 小时
注册时间
2008-9-5
帖子
3542

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

4
发表于 2016-3-7 22:14:28 | 只看该作者
顺便渣翻一下32~36行的注释好了……

在这下面开始设置合成配方。
例: I_recipe[3]  = [100, ["I",1,1], ["W",2,1], ["A",2,2], ["A",3,1]]
像↑这样设置的情况、合成ID为3的【物品】所需要的花费是:100G。
锁需要的素材是:ID为1的【物品】一件、ID为2的【武器】1件、ID为2的【防具】2件、ID为3的【防具】1件。
此外,等号左边的名词:I_recipe是【物品】,W_recipe是【武器】,A_recipe是【防具】
等号右边的数组里面,"I"是【物品】,"W"是【武器】,"A"【防具】

评分

参与人数 1梦石 +1 收起 理由
丿梁丶小柒 + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
1
星屑
472
在线时间
120 小时
注册时间
2016-3-6
帖子
83
5
 楼主| 发表于 2016-3-7 23:40:38 | 只看该作者
cinderelmini 发表于 2016-3-7 22:14
顺便渣翻一下32~36行的注释好了……

在这下面开始设置合成配方。

多谢帮助!感激不尽!竟然回答的这么仔细...
然而我设置好了脚本,角色身上带着素材去测试,跳出来的界面却是这个..

_(:з」∠)_看到的只有窗口,设置好的配方在哪咧?
R
回复 支持 反对

使用道具 举报

Lv4.逐梦者

「Pemercyia」


Urhurrenna

梦石
0
星屑
9402
在线时间
2749 小时
注册时间
2008-9-5
帖子
3542

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

6
发表于 2016-3-8 12:40:26 | 只看该作者
合成配方设置之后需要通过事件使用【脚本】来激活指定配方,
之后被激活的配方才会出现在合成界面里,
稍微翻译了一下脚本,有些没必要的地方就不翻了,
具体的激活操作见范例里面的NPC吧:
左边的NPC是关于激活配方的说明,
右边的NPC是打开合成界面,
中间的NPC给你所有数据库物品,武器,防具各10个和一笔钱。
合成.zip (1.43 MB, 下载次数: 202)
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
531
在线时间
310 小时
注册时间
2016-4-13
帖子
227

开拓者

7
发表于 2016-4-17 03:07:32 | 只看该作者
cinderelmini 发表于 2016-3-8 12:40
合成配方设置之后需要通过事件使用【脚本】来激活指定配方,
之后被激活的配方才会出现在合成界面里,
稍微 ...

感谢分享,请收下我的膝盖(ΦωΦ)
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-2-24 13:18

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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