查看: 90|回复: 0

[转载发布] 配方不公开的物品合成【合成系统】(XP)

[复制链接]
  • TA的每日心情
    开心
    7 天前
  • 签到天数: 37 天

    连续签到: 3 天

    [LV.5]常住居民I

    2028

    主题

    32

    回帖

    7260

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    0
    卡币
    5184
    OK点
    16
    积分
    7260
    发表于 同元一千年八月四日(秋) | 显示全部楼层 |阅读模式
    RUBY 代码
    1. #==============================================================================
    2. # ★ Item_Transmute
    3. #------------------------------------------------------------------------------
    4. #  配方不公开的物品合成 
    5. #  By Summoner
    6. #==============================================================================
    7. #
    8. # 本脚本以 知识共享署名-非商业性使用 3.0 Unported 许可协议进行许可。
    9. # 详见 [url]http://creativecommons.org/licenses/by-nc/3.0/[/url]
    10. #
    11. #==============================================================================
    12. #
    13. # 这是一个配方不公开的物品合成,也就是说什么材料可以合成什么物品玩家在
    14. # 游戏中的合成界面是不能直接看到的。由于物品的合成配方不是公开的,所以
    15. # 玩家需要通过自己探索或从NPC处得到合成配方(当然看攻略也是一种可能)
    16. #
    17. # 例如M&M中的配药水,Diablo II的盒子,NWV中的铁匠铺、Wizard Lab……
    18. #
    19. # 冲突可能性:基本上是添加新的内容,冲突可能性较小
    20. #
    21. # 可扩展性:可以加强、扩展的东西应该很多。
    22. #   例如:合成需要花费GP、SP甚至XP,合成需要特定器具,合成失败受到伤害,
    23. #   某些物品的几率合成、物品图鉴等等。
    24. #
    25. #   有的东西已经注释清楚了,搞懂原理的话,根据自己需要改起来也不会很麻烦。
    26. #
    27. #   个人一下子没时间实现这些,欢迎大家多多修改分享。
    28. #
    29. # 使用方法:在事件中使用脚本$scene = Scene_Compose.new,然后等待2帧
    30. #
    31. #
    32. #==============================================================================
    33. # 若合成失败(无匹配的配方)物品是否失去
    34. $Ingredient_Lost_When_Fail = false
    35. # 合成成功/失败SE
    36. # 若不使用SE请设置为“""”(不含外引号)
    37. $SE_Compose_Successful = "Audio/SE/109-Heal05"
    38. $SE_Compose_Failed = "Audio/SE/117-Fire01"
    39. #=============================================================================
    40. # ■ 配方及补充的定义
    41. #-----------------------------------------------------------------------------
    42. # Game_System
    43. #=============================================================================
    44. class Game_System
    45.   attr_accessor :formulas
    46.   attr_accessor :products
    47.   alias formulas_initialize initialize
    48.   def initialize
    49.     formulas_initialize
    50.     @formulas = []
    51.     @products = []
    52. #############################################################################
    53. #
    54. #===========================配方表===========================================   
    55. #
    56. #  配方格式
    57. #
    58. #  @formulas[i] = [[材料种类,材料编号,数量],[材料种类,材料编号,数量]……]                  
    59. #  @products[i] = [[成品种类,成品编号,数量],[成品种类,成品编号,数量]……]
    60. #  
    61. #  种类:物品 0 武器 1 防具 2
    62. #
    63. #  1.如果有两个配方材料相同,理论上会按编号较小的处理
    64. #  2.配方材料的顺序与合成是无关的(当然如果你想改成有关肯定也不会太麻烦)
    65. #  3.允许某个材料拆成多件成品(可能就不叫物品合成,应该叫物品分解了)
    66. #  4.暂时不支持多步合并为一步的合成
    67. #       例如 A + B = C,C + D = E,如果不存在A + B + D = E的配方
    68. #       A + B + D无法合成 E
    69. #
    70. #############################################################################
    71.     @formulas[0] = []
    72.     @products[0] = []
    73.     # 样例1: 回复剂x3 = 超回复剂x1
    74.     @formulas[1] = [[0,1,3]]         
    75.     @products[1] = [[0,2,1]]
    76.     @formulas[2] = [[0,2,3]]
    77.     @products[2] = [[0,3,1]]
    78.     @formulas[3] = [[0,4,3]]
    79.     @products[3] = [[0,5,1]]
    80.     @formulas[4] = [[0,5,3]]
    81.     @products[4] = [[0,6,1]]
    82.     # 样例2: 完全恢复剂x1 + 超级香水x1 = 圣灵药x1
    83.     @formulas[5] = [[0,3,1],[0,6,1]]
    84.     @products[5] = [[0,7,1]]
    85.     # 样例3: 完全恢复剂x1 + 超级香水x1 = 完全圣灵药x1
    86.     # 被样例2 被覆盖
    87.     @formulas[6] = [[0,3,1],[0,6,1]]
    88.     @products[6] = [[0,8,1]]
    89.     # 圣灵药x1 = 完全恢复剂x1 + 超级香水x1 (Item_Decompose...)
    90.     @formulas[7] = [[0,7,1]]
    91.     @products[7] = [[0,3,1],[0,6,1]]
    92.     # 样例5: 铜剑x1 + 回复剂x1 + 铜铠x1 = 密斯利尔剑x1
    93.     @formulas[8] = [[1,1,1],[0,1,1],[2,1,1]]
    94.     @products[8] = [[1,4,1]]
    95.   end
    96. end
    97. class Game_Temp
    98.   attr_accessor :forge
    99.   alias forge_item_initialize initialize
    100.   def initialize
    101.     forge_item_initialize
    102.     # 定义合成窗口中的物品储存区
    103.     @forge = []
    104.   end
    105. end
    106. #==============================================================================
    107. # ■ Window_ForgeCommand
    108. #------------------------------------------------------------------------------
    109. #  合成画面、选择要做的事的窗口
    110. #==============================================================================
    111. class Window_ComposeCommand < Window_Selectable
    112.   #--------------------------------------------------------------------------
    113.   # ● 初始化对像
    114.   #--------------------------------------------------------------------------
    115.   def initialize
    116.     super(0, 64, 640, 64)
    117.     self.contents = Bitmap.new(width - 32, height - 32)
    118.     @item_max = 4
    119.     @column_max = 4
    120.     @commands = ["更改材料", "合成", "放弃合成", "离开"]
    121.     refresh
    122.     self.index = 0
    123.   end
    124.   #--------------------------------------------------------------------------
    125.   # ● 刷新
    126.   #--------------------------------------------------------------------------
    127.   def refresh
    128.     self.contents.clear
    129.     for i in0...@item_max
    130.       draw_item(i)
    131.     end
    132.   end
    133.   #--------------------------------------------------------------------------
    134.   # ● 描绘项目
    135.   #     index : 项目编号
    136.   #--------------------------------------------------------------------------
    137.   def draw_item(index)
    138.     x = 4 + index * 160
    139.     self.contents.draw_text(x, 0, 128, 32, @commands[index])
    140.   end
    141. end
    142. #==============================================================================
    143. # ■ Window_ForgeLeft
    144. #------------------------------------------------------------------------------
    145. #  合成画面中显示拥有的物品的窗口
    146. #==============================================================================
    147. class Window_ComposeLeft < Window_Selectable
    148.   #--------------------------------------------------------------------------
    149.   # ● 初始化对像
    150.   #--------------------------------------------------------------------------
    151.   def initialize
    152.     super(0, 128, 320, 352)
    153.     @column_max = 1
    154.     refresh
    155.     self.index = 0
    156.   end
    157.   #--------------------------------------------------------------------------
    158.   # ● 获取物品
    159.   #--------------------------------------------------------------------------
    160.   def item
    161.     return@data[self.index]
    162.   end
    163.   #--------------------------------------------------------------------------
    164.   # ● 刷新
    165.   #--------------------------------------------------------------------------
    166.   def refresh
    167.     ifself.contents != nil
    168.       self.contents.dispose
    169.       self.contents = nil
    170.     end
    171.     self.update_cursor_rect
    172.     @data = []
    173.     for i in1...$data_items.size
    174.       if$game_party.item_number(i) > 0
    175.         @data.push($data_items[i])
    176.       end
    177.     end
    178.     for i in1...$data_weapons.size
    179.       if$game_party.weapon_number(i) > 0
    180.         @data.push($data_weapons[i])
    181.       end
    182.     end
    183.     for i in1...$data_armors.size
    184.       if$game_party.armor_number(i) > 0
    185.         @data.push($data_armors[i])
    186.       end
    187.     end
    188.     # 如果项目数不是 0 就生成位图、描绘全部项目
    189.     @item_max = @data.size
    190.     if@item_max > 0
    191.       self.contents = Bitmap.new(width - 32, row_max * 32)
    192.       for i in0...@item_max
    193.         draw_item(i)
    194.       end
    195.     end
    196.   end
    197.   #--------------------------------------------------------------------------
    198.   # ● 描绘项目
    199.   #     index : 项目标号
    200.   #--------------------------------------------------------------------------
    201.   def draw_item(index)
    202.     item = @data[index]
    203.     case item
    204.     whenRPG::Item
    205.       number = $game_party.item_number(item.id)
    206.     whenRPG::Weapon
    207.       number = $game_party.weapon_number(item.id)
    208.     whenRPG::Armor
    209.       number = $game_party.armor_number(item.id)
    210.     end
    211.     self.contents.font.color = normal_color
    212.     x = 4
    213.     y = index * 32
    214.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    215.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    216.     bitmap = RPG::Cache.icon(item.icon_name)
    217.     opacity = self.contents.font.color == normal_color ? 255 : 128
    218.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    219.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    220.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
    221.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
    222.   end
    223.   #--------------------------------------------------------------------------
    224.   # ● 刷新帮助文本
    225.   #--------------------------------------------------------------------------
    226.   def update_help
    227.     @help_window.set_text(self.item == nil ? "" : self.item.description)
    228.   end
    229. end
    230. #==============================================================================
    231. # ■ Window_ForgeRight
    232. #------------------------------------------------------------------------------
    233. #  合成画面中的合成区窗口
    234. #==============================================================================
    235. class Window_ComposeRight < Window_Selectable
    236.   attr_accessor :forge_item
    237.   #--------------------------------------------------------------------------
    238.   # ● 初始化对像
    239.   #--------------------------------------------------------------------------
    240.   def initialize(forge_item)
    241.     super(320, 128, 320, 352)
    242.     @column_max = 1
    243.     @forge_item = []
    244.     refresh
    245.     self.index = 0
    246.   end
    247.   #--------------------------------------------------------------------------
    248.   # ● 获取物品
    249.   #--------------------------------------------------------------------------
    250.   def item
    251.     return@data[self.index]
    252.   end
    253.   #--------------------------------------------------------------------------
    254.   # ● 获取物品
    255.   #--------------------------------------------------------------------------
    256.   def item_number
    257.     return@data_number[self.index]
    258.   end
    259.   #--------------------------------------------------------------------------
    260.   # ● 刷新
    261.   #--------------------------------------------------------------------------
    262.   def refresh
    263.     ifself.contents != nil
    264.       self.contents.dispose
    265.       self.contents = nil
    266.     end
    267.     @data = []
    268.     @data_number = []
    269.     @forge_item = $game_temp.forge
    270.     for item_forge in@forge_item
    271.       case item_forge[0]
    272.       when0
    273.         item = $data_items[item_forge[1]]
    274.       when1
    275.         item = $data_weapons[item_forge[1]]
    276.       when2
    277.         item = $data_armors[item_forge[1]]
    278.       end
    279.       if(item != nil)and(item_forge[2] != 0)
    280.         @data.push(item)
    281.         @data_number.push(item_forge[2])
    282.       else
    283.         @data.delete(item)
    284.       end
    285.     end
    286.     # 如果项目数不是 0 就生成位图、描绘全部项目
    287.     @item_max = @data.size
    288.     if@item_max > 0
    289.       self.contents = Bitmap.new(width - 32, row_max * 32)
    290.       for i in0...@item_max
    291.         draw_item(i)
    292.       end
    293.     end
    294.   end
    295.   #--------------------------------------------------------------------------
    296.   # ● 描绘项目
    297.   #     index : 项目标号
    298.   #--------------------------------------------------------------------------
    299.   def draw_item(index)
    300.     item = @data[index]
    301.     case item
    302.     whenRPG::Item
    303.       number = $game_temp.forge[index][2]
    304.     whenRPG::Weapon
    305.       number = $game_temp.forge[index][2]
    306.     whenRPG::Armor
    307.       number = $game_temp.forge[index][2]
    308.     end
    309.     self.contents.font.color = normal_color
    310.     x = 4
    311.     y = index * 32
    312.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    313.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    314.     bitmap = RPG::Cache.icon(item.icon_name)
    315.     opacity = self.contents.font.color == normal_color ? 255 : 128
    316.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    317.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    318.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
    319.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
    320.   end
    321.   #--------------------------------------------------------------------------
    322.   # ● 刷新帮助文本
    323.   #--------------------------------------------------------------------------
    324.   def update_help
    325.     @help_window.set_text(self.item == nil ? "" : self.item.description)
    326.   end
    327. end
    328. #==============================================================================
    329. # ■ Scene_Compose
    330. #------------------------------------------------------------------------------
    331. #  处理物品合成画面的类
    332. #==============================================================================
    333. class Scene_Compose
    334. #--------------------------------------------------------------------------
    335. # ● 初始化
    336. #--------------------------------------------------------------------------
    337. def initialize
    338.    # 生成帮助窗口
    339.    @help_window = Window_Help.new
    340.    # 生成命令窗口
    341.    @command_window = Window_ComposeCommand.new
    342.    @command_window.active = false
    343.    # 生成左方窗口
    344.    @item_window = Window_ComposeLeft.new
    345.    @item_window.active = true
    346.    @item_window.help_window = @help_window
    347.    # 生成右方窗口
    348.    @forge_window = Window_ComposeRight.new([])
    349.    @forge_window.active = false
    350.    @forge_window.help_window = @help_window
    351.    # 初始化配方与合成区
    352.    @formulas = $game_system.formulas
    353.    @products = $game_system.products
    354.    @forge = []
    355.    @products_temp = []      
    356. end
    357.   #--------------------------------------------------------------------------
    358.   # ● 主处理
    359.   #--------------------------------------------------------------------------
    360. def main
    361.    # 执行过渡
    362.    Graphics.transition
    363.    # 主循环
    364.    loopdo
    365.      # 刷新游戏画面
    366.      Graphics.update
    367.      # 刷新输入情报
    368.      Input.update
    369.      # 刷新画面
    370.      update
    371.      # 如果画面被切换的话就中断循环
    372.      if$scene != self
    373.        break
    374.      end
    375.    end
    376.    # 准备过渡
    377.    Graphics.freeze
    378.    # 释放窗口
    379.    @help_window.dispose
    380.    @command_window.dispose
    381.    @item_window.dispose
    382.    @forge_window.dispose
    383. end
    384.   #--------------------------------------------------------------------------
    385.   # ● 刷新画面
    386.   #--------------------------------------------------------------------------
    387. def update
    388.    @help_window.update
    389.    @command_window.update
    390.    @item_window.update
    391.    @forge_window.update
    392.    if@command_window.active
    393.      update_command
    394.      return
    395.    end
    396.    if@item_window.active
    397.      update_item
    398.      return
    399.    end
    400.    if@forge_window.active
    401.      update_forge
    402.      return
    403.    end
    404.     return
    405. end
    406.   #--------------------------------------------------------------------------
    407.   # ● 刷新画面(指令窗口激活的情况下)
    408.   #--------------------------------------------------------------------------
    409.   def update_command
    410.     # 按下 B 键的情况下
    411.     if Input.trigger?(Input::B)
    412.       # 演奏取消 SE
    413.       $game_system.se_play($data_system.cancel_se)
    414.       abort
    415.       # 切换到地图画面
    416.       $scene = Scene_Map.new
    417.       return
    418.     end
    419.      # 按下 C 键的情况下
    420.     if Input.trigger?(Input::C)
    421.       # 命令窗口光标位置分支
    422.       case@command_window.index
    423.       when0  # 更改材料
    424.         # 演奏确定 SE
    425.         $game_system.se_play($data_system.decision_se)
    426.         # 窗口状态转向物品窗口
    427.         @command_window.active = false
    428.         @item_window.active = true
    429.         @forge_window.active = false
    430.       when1  # 合成
    431.         # 演奏确定 SE
    432.         $game_system.se_play($data_system.decision_se)
    433.         # 执行合成命令
    434.         if$game_temp.forge != []
    435.           compose
    436.         end
    437.       when2  # 放弃合成
    438.         # 演奏确定 SE
    439.         $game_system.se_play($data_system.decision_se)
    440.         # 放弃合成
    441.         abort
    442.       when3  # 离开
    443.         # 演奏确定 SE
    444.         $game_system.se_play($data_system.decision_se)
    445.         # 放弃合成
    446.         abort
    447.         # 切换到地图画面
    448.         $scene = Scene_Map.new
    449.       end
    450.       return
    451.     end
    452.   end
    453.   #--------------------------------------------------------------------------
    454.   # ● 刷新画面(物品窗口激活的情况下)
    455.   #--------------------------------------------------------------------------
    456.   def update_item
    457.      # 按下 B 键的情况下
    458.     if Input.trigger?(Input::B)
    459.       # 演奏取消 SE
    460.       $game_system.se_play($data_system.cancel_se)
    461.       # 切换到指令窗口
    462.       @item_window.active = false
    463.       @command_window.active = true
    464.       @help_window.set_text("")
    465.       return
    466.     end
    467.      # 按下 C 键的情况
    468.     if Input.trigger?(Input::C)
    469.       # 演奏确定 SE
    470.       $game_system.se_play($data_system.decision_se)
    471.       # 获取物品
    472.       @item = @item_window.item
    473.       # 获取物品的所持数
    474.       case@item
    475.       whenRPG::Item
    476.         number = $game_party.item_number(@item.id)
    477.         typetemp = 0
    478.       whenRPG::Weapon
    479.         number = $game_party.weapon_number(@item.id)
    480.         typetemp = 1
    481.       whenRPG::Armor
    482.         number = $game_party.armor_number(@item.id)
    483.         typetemp = 2
    484.       end
    485.       if number != nil
    486.         # 更改合成窗口的物品
    487.         case@item
    488.         whenRPG::Item
    489.           $game_party.lose_item(@item.id, 1)
    490.         whenRPG::Weapon
    491.           $game_party.lose_weapon(@item.id, 1)
    492.         whenRPG::Armor
    493.           $game_party.lose_armor(@item.id, 1)
    494.         end
    495.         forge_change(typetemp, @item.id, 1)
    496.         # 刷新各窗口
    497.         @item_window.update
    498.         @help_window.update
    499.         @forge_window.update
    500.         @item_window.refresh
    501.         @forge_window.refresh
    502.       end
    503.     end
    504.      # 按下 右方向键 的情况
    505.     if Input.trigger?(Input::RIGHT)
    506.       # 切换到合成窗口
    507.       @item_window.active = false
    508.       @forge_window.active = true
    509.     end
    510.   end
    511.   #--------------------------------------------------------------------------
    512.   # ● 刷新画面(合成窗口激活的情况下)
    513.   #--------------------------------------------------------------------------
    514.   def update_forge
    515.      # 按下 B 键的情况下
    516.     if Input.trigger?(Input::B)
    517.       # 演奏取消 SE
    518.       $game_system.se_play($data_system.cancel_se)
    519.       # 切换到指令窗口
    520.       @forge_window.active = false
    521.       @command_window.active = true
    522.       @help_window.set_text("")
    523.       return
    524.     end
    525.      # 按下 C 键的情况
    526.     if Input.trigger?(Input::C)
    527.      # 演奏确定 SE
    528.      $game_system.se_play($data_system.decision_se)
    529.      # 获取物品
    530.       @item = @forge_window.item
    531.       # 获取物品的所持数
    532.       case@item
    533.       whenRPG::Item
    534.         number = @forge_window.item_number
    535.         typetemp = 0
    536.       whenRPG::Weapon
    537.         number = @forge_window.item_number
    538.         typetemp = 1
    539.       whenRPG::Armor
    540.         number = @forge_window.item_number
    541.         typetemp = 2
    542.       end
    543.      if number != nil
    544.        # 更改合成窗口的物品
    545.        case@item
    546.        whenRPG::Item
    547.          $game_party.gain_item(@item.id, 1)
    548.        whenRPG::Weapon
    549.          $game_party.gain_weapon(@item.id, 1)
    550.        whenRPG::Armor
    551.          $game_party.gain_armor(@item.id, 1)
    552.        end
    553.        #p number
    554.        forge_change(typetemp, @item.id, -1)
    555.        # 刷新各窗口
    556.        @item_window.refresh
    557.        @forge_window.refresh
    558.        @help_window.update
    559.        @item_window.update
    560.        @forge_window.update
    561.       end
    562.     end
    563.        # 按下 左方向键 的情况下
    564.     if Input.trigger?(Input::LEFT)
    565.       # 切换到合成窗口
    566.       @forge_window.active = false
    567.       @item_window.active = true
    568.     end
    569.   end
    570.   #--------------------------------------------------------------------------
    571.   # ● 更改合成窗口物品
    572.   #--------------------------------------------------------------------------
    573.   def forge_change(type,id,number)
    574.      quantity = number
    575.      for item in$game_temp.forge
    576.        if(item[0]==type)and(item[1]==id)
    577.          item[2] = [item[2] += quantity,99].min
    578.          if item[2] == 0
    579.            $game_temp.forge.delete(item)
    580.          end
    581.          return
    582.        end
    583.      end
    584.      $game_temp.forge.push([type,id,number])
    585.   end
    586.   #--------------------------------------------------------------------------
    587.   # ● 放弃合成
    588.   #--------------------------------------------------------------------------
    589.   def abort
    590.     # 将合成窗口中的物品转移至物品窗口中
    591.     for item in$game_temp.forge
    592.       # 判断物品类型并归还
    593.       case item[0]
    594.       when0
    595.         $game_party.gain_item(item[1], item[2])
    596.       when1
    597.         $game_party.gain_weapon(item[1], item[2])
    598.       when2
    599.         $game_party.gain_armor(item[1], item[2])
    600.       end
    601.     end
    602.     $game_temp.forge = []
    603.     # 刷新各窗口
    604.     @item_window.refresh
    605.     @forge_window.refresh
    606.   end
    607.   #--------------------------------------------------------------------------
    608.   # ● 检测是否有符合的配方
    609.   #--------------------------------------------------------------------------
    610. def match
    611.    match_one = false
    612.    match_this = false
    613.     # 检测每一个配方
    614.    for i in[email]0...@formulas.size[/email]
    615.      # 将合成窗口中的物品复制到合成缓存区
    616.      # 注意: 直接使用"="将传引用 导致检测配方是否匹配时合成窗口中物品被删除
    617.      @forge = $game_temp.forge.dup
    618.      # 检测这个配方中每一项材料
    619.      for ingredient in@formulas[i]
    620.        match_this = true
    621.        # 合成区中没有此项材料的情况
    622.        unless@forge.include?(ingredient)
    623.          match_this = false
    624.          break
    625.        end
    626.        # 从合成区中暂时删除这项材料
    627.        @forge.delete(ingredient)
    628.      end
    629.      if match_this == false
    630.        next
    631.      end
    632.      # 检测合成区中是否还有配方外的材料剩余
    633.      unless@forge == []
    634.        match_this = false
    635.      end
    636.      # 满足这一个配方的情况
    637.      if match_this == true
    638.        match_one = true
    639.        # 获取配方的成品
    640.        @products_temp = @products[i]
    641.        break
    642.      end
    643.    end
    644.    return match_one
    645. end
    646.   #--------------------------------------------------------------------------
    647.   # ● 合成
    648.   #--------------------------------------------------------------------------
    649. def compose
    650.    # 如果有符合的配方
    651.    if match
    652.      # 将合成窗口中的材料改变为成品
    653.      $game_temp.forge = []
    654.      for i in[email]0...@products_temp.size[/email]
    655.       forge_change(@products_temp[i][0], @products_temp[i][1], @products_temp[i][2])
    656.     end
    657.      if$SE_Compose_Successful != ""
    658.        Audio.se_play($SE_Compose_Successful)
    659.      end
    660.    # 合成失败的情况
    661.    else
    662.      if$SE_Compose_Failed != ""
    663.        Audio.se_play($SE_Compose_Failed)
    664.      end
    665.      if$Ingredient_Lost_When_Fail
    666.        $game_temp.forge = []
    667.      end
    668.    end
    669.     # 刷新各窗口
    670.    @item_window.refresh
    671.    @forge_window.refresh
    672. end
    673. end
    复制代码

    详细介绍已经在代码注释上了,是一个朋友叫我代发的,他可能不能上6R,作者:Summoner
    我试用过了,上面也注释的很清楚。
    调用语句为:$scene = Scene_Compose.new
    过后等待2帧
    上图


    像这样 回复剂放入3个后按合成即可,也可以放入一个圣灵药,再按合成,就分解出物品来,详细代码上注释的很清楚。
    好吧,还是附上范例,其实也没什么可说的。

                 本帖来自P1论坛作者纳尔德,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=245186  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。

    本帖子中包含更多资源

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

    x
    天天去同能,天天有童年!
    回复 论坛版权

    使用道具 举报

    ahome_bigavatar:guest
    ahome_bigavatar:welcomelogin
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2024-5-17 19:55 , Processed in 0.051025 second(s), 44 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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