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

Project1

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

[已经解决] 帮忙看下这个物品合成脚本,运行之后语法错误,怎么回...

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1264
在线时间
900 小时
注册时间
2014-12-4
帖子
379
跳转到指定楼层
1
发表于 2014-12-15 11:32:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 翻滚牛宝宝 于 2014-12-15 11:33 编辑

运行之后132行出错

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

Lv1.梦旅人

梦石
0
星屑
55
在线时间
185 小时
注册时间
2014-9-4
帖子
82
2
发表于 2014-12-15 11:43:10 | 只看该作者
本帖最后由 希忆 于 2014-12-15 12:39 编辑
  1. #第132、395、662行
  2. [url=home.php?mod=space&uid=14254]@Forge[/url] #改成
  3. @forge########################
复制代码
  1. 所有类似[url=home.php?mod=space&uid=xxxxx]@yyyyy[/url]的都得改成@yyyyy
复制代码
这是论坛复制代码的bug

↓↓我还真没注意这个。是XP的脚本。。

点评

没注意。。已修  发表于 2014-12-15 12:41
改小写  发表于 2014-12-15 12:31

评分

参与人数 1梦石 +1 收起 理由
VIPArcher + 1 不吐槽一下$scene = Scene_Compose.new么.

查看全部评分

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1264
在线时间
900 小时
注册时间
2014-12-4
帖子
379
3
 楼主| 发表于 2014-12-15 12:38:37 | 只看该作者
我正想问这个$scene = Scene_Compose.new  在VA应该怎么调用 @VIPArcher

点评

Scene_Manager.call(Scene_Compose)  发表于 2014-12-15 12:41
回复 支持 反对

使用道具 举报

Lv4.逐梦者 (版主)

无限の剣制

梦石
0
星屑
10229
在线时间
5019 小时
注册时间
2013-2-28
帖子
5030

开拓者贵宾

4
发表于 2014-12-15 12:39:50 | 只看该作者
翻滚牛宝宝 发表于 2014-12-15 12:38
我正想问这个$scene = Scene_Compose.new  在VA应该怎么调用 @VIPArcher
  1. SceneManager.call(Scene_Compose)
复制代码
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1264
在线时间
900 小时
注册时间
2014-12-4
帖子
379
5
 楼主| 发表于 2014-12-15 12:45:14 | 只看该作者
痛苦的突然发现 这个是XP的脚本 VA不报错才不正常
…… 斑竹结贴吧
再找一个
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1264
在线时间
900 小时
注册时间
2014-12-4
帖子
379
6
 楼主| 发表于 2014-12-15 12:46:43 | 只看该作者
那啥…… 突然这是XP的脚本…… VA不报错才不正常…… 斑竹结贴吧  看来要再找一个 @VIPArcher
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-21 18:21

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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