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

Project1

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

[已经解决] 求,有没有铸剑系统

[复制链接]

Lv1.梦旅人

梦石
0
星屑
95
在线时间
187 小时
注册时间
2013-8-28
帖子
42
跳转到指定楼层
1
发表于 2013-10-19 00:46:35 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

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

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

x
我搜索了很多次,可就是找不到类似铸剑的系统,是不是我的搜索文字错了?还是没有这脚本?求这样的

Lv1.梦旅人

梦石
0
星屑
95
在线时间
187 小时
注册时间
2013-8-28
帖子
42
11
 楼主| 发表于 2013-10-21 18:01:14 | 只看该作者
chd114 发表于 2013-10-21 14:37
这个是即插即用的···只要直接放脚本编辑器MAIN前面就行···

哦。。谢谢了
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9280
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

10
发表于 2013-10-21 14:37:13 | 只看该作者
1105659784 发表于 2013-10-20 17:40
谢谢了,可是,有范例工程吗。。没范例工程我不会多少。。

这个是即插即用的···只要直接放脚本编辑器MAIN前面就行···
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
95
在线时间
187 小时
注册时间
2013-8-28
帖子
42
9
 楼主| 发表于 2013-10-20 17:40:31 | 只看该作者
chd114 发表于 2013-10-20 13:09
这个就可以了

谢谢了,可是,有范例工程吗。。没范例工程我不会多少。。
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9280
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

8
发表于 2013-10-20 13:09:38 | 只看该作者
1105659784 发表于 2013-10-20 09:11
和6楼的差不多,我不强求有强化,有合成就可以了
  1. =begin
  2. ==============================================================================
  3. ★ Item_Transmute
  4. ------------------------------------------------------------------------------
  5.   配方不公开的物品合成(加强版)
  6.   原作者 Summoner
  7.   By Chd114
  8. ------------------------------------------------------------------------------
  9.   注:该脚本具有至高权威性,可以覆盖任何此脚本的前身脚本!
  10. ==============================================================================
  11. 本脚本以知识共享署名-非商业性使用 3.0 Unported 许可协议进行许可。
  12. 详见 http://creativecommons.org/licenses/by-nc/3.0/
  13. ==============================================================================
  14. 原作者的话:  
  15. 这是一个配方不公开的物品合成,也就是说什么材料可以合成什么物品玩家在
  16. 游戏中的合成界面是不能直接看到的。由于物品的合成配方不是公开的,所以
  17. 玩家需要通过自己探索或从NPC处得到合成配方(当然看攻略也是一种可能)
  18. 例如M&M中的配药水,Diablo II的盒子,NWV中的铁匠铺、Wizard Lab……
  19. 可扩展性:可以加强、扩展的东西应该很多。
  20. 例如:合成需要花费GP、SP甚至XP,合成需要特定器具,合成失败受到伤害,
  21. 某些物品的几率合成、物品图鉴等等。
  22. 有的东西已经注释清楚了,搞懂原理的话,根据自己需要改起来也不会很麻烦。
  23. 个人一下子没时间实现这些,欢迎大家多多修改分享。

  24. Chd114的话:
  25. 其实这个脚本的改进思路早在去年此脚本出来之前就有想法了···只不过那个
  26. 时候本人的技术还差了一点所以就没有盲目去弄今天(2013年6月9日 9:33:40)
  27. 花了2小时左右的时间鼓捣了下最后把大部分东西都弄好了

  28. 此脚本冲突可能性:与装备耐久度、随即装备属性之类会导致装备具有独立性的
  29. 脚本功能冲突,其他脚本基本上不冲突

  30. 使用方法:在事件中使用脚本$scene = Scene_Compose.new,然后等待2帧
  31. ==============================================================================
  32. 若合成失败(无匹配的配方、因合成概率低而失败)物品是否失去
  33. =end
  34. $Ingredient_Lost_When_Fail = true#false
  35. # 合成成功/失败SE  
  36. # 若不使用SE请设置为“""”(不含外引号)
  37. $SE_Compose_Successful = ""  
  38. $SE_Compose_Failed = ""
  39.   
  40. #=============================================================================
  41. # ■ 配方及补充的定义
  42. #-----------------------------------------------------------------------------
  43. # Game_System
  44. #=============================================================================
  45. class Game_System
  46.   attr_accessor :formulas
  47.   attr_accessor :products
  48.   attr_accessor :sproducts
  49.   attr_accessor :fproducts
  50.   attr_accessor :probability
  51.   alias formulas_initialize initialize  
  52.   def initialize  
  53.     formulas_initialize
  54.     @formulas = []  
  55.     @products = []
  56.     @sproducts = []
  57.     @fproducts = []
  58.     @probability = []
  59. =begin
  60. ===========================配方表===========================================   

  61.   配方格式
  62.   @formulas[i] = [[材料种类,材料编号,数量],[材料种类,材料编号,数量]……]                  
  63.   @products[i] = [[成品种类,成品编号,数量],[成品种类,成品编号,数量]……]
  64.   @sproducts[i] = [[成功额外产物种类,编号,数量],[成功额外产物种类,编号,数量]]
  65.   @fproducts[i] = [[失败额外产物种类,编号,数量],[失败额外产物种类,编号,数量]]
  66.   @probability[i] = [合成成功率,成功额外产物概率,失败额外产物概率]
  67.   种类:物品 0 武器 1 防具 2
  68.   1.如果有两个配方材料相同,理论上会按编号较小的处理
  69.   2.配方材料的顺序与合成是无关的(当然如果你想改成有关肯定也不会太麻烦)
  70.   3.允许某个材料拆成多件成品(可能就不叫物品合成,应该叫物品分解了)
  71.   4.产物数量神马的理论上你可以无限写,只要你不怕麻烦加手抽筋。
  72.   5.暂时不支持多步合并为一步的合成  
  73.     例如 A + B = C,C + D = E,如果不存在A + B + D = E的配方
  74.     A + B + D无法合成 E
  75.   6.暂时不支持将配方逆向使用(本功能会尝试完善)
  76.     例如 A + B = C,C = A + B,如果不存在C = A + B的配方
  77.     C无法拆解成A + B
  78.   7.暂时不支持花费金钱的合成与配方学习(本功能会尝试完善)
  79.     例如A + B = C,作者设定成合成此配方的成品需要花费5000金币之类的
  80.   8.成功额外产物出现的概率与失败额外产物出现的概率会导致所有成功额外
  81.   产物或所有失败额外产物同时出现,比如失败额外产物有大药膏和艾西非远
  82.   古祭祀,则在合成失败后若出现失败的额外产物时同时出现大药膏和艾西非
  83.   远古祭祀。
  84.   9.成功额外产物和失败额外产物的设定和配方材料、配方成品设定格式是一致的。

  85. =end
  86.     #初始化模板
  87.     @formulas[0] = []
  88.     @products[0] = []
  89.     @sproducts[0] = []
  90.     @fproducts[0] = []
  91.     @probability[0] = []
  92.     #这个才是样例!!!
  93.     @formulas[1] = [[1,1,1]]         
  94.     @products[1] = [[2,29,1]]
  95.     @sproducts[1] = [[1,2,1]]
  96.     @fproducts[1] = [[0,2,1]]
  97.     @probability[1] = [50,50,50]
  98.   end  
  99. end
  100.   
  101. class Game_Temp  
  102.   attr_accessor :forge
  103.   alias forge_item_initialize initialize  
  104.   def initialize  
  105.     forge_item_initialize
  106.     # 定义合成窗口中的物品储存区
  107.     [url=home.php?mod=space&uid=14254]@Forge[/url] = []  
  108.   end  
  109. end
  110.   
  111. #==============================================================================
  112. # ■ Window_ForgeCommand
  113. #------------------------------------------------------------------------------
  114. #  合成画面、选择要做的事的窗口
  115. #==============================================================================
  116.   
  117. class Window_ComposeCommand < Window_Selectable
  118.   #--------------------------------------------------------------------------
  119.   # ● 初始化对像
  120.   #--------------------------------------------------------------------------
  121.   def initialize
  122.     super(0, 64, 640, 64)
  123.     self.contents = Bitmap.new(width - 32, height - 32)
  124.     @item_max = 4
  125.     @column_max = 4
  126.     @commands = ["更改材料", "合成", "放弃合成", "离开"]
  127.     refresh
  128.     self.index = 0
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # ● 刷新
  132.   #--------------------------------------------------------------------------
  133.   def refresh
  134.     self.contents.clear
  135.     for i in 0...@item_max
  136.       draw_item(i)
  137.     end
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ● 描绘项目
  141.   #     index : 项目编号
  142.   #--------------------------------------------------------------------------
  143.   def draw_item(index)
  144.     x = 4 + index * 160
  145.     self.contents.draw_text(x, 0, 128, 32, @commands[index])
  146.   end
  147. end
  148.   
  149. #==============================================================================
  150. # ■ Window_ForgeLeft
  151. #------------------------------------------------------------------------------
  152. #  合成画面中显示拥有的物品的窗口
  153. #==============================================================================
  154.   
  155. class Window_ComposeLeft < Window_Selectable
  156.   #--------------------------------------------------------------------------
  157.   # ● 初始化对像
  158.   #--------------------------------------------------------------------------
  159.   def initialize
  160.     super(0, 128, 320, 352)
  161.     @column_max = 1
  162.     refresh
  163.     self.index = 0
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ● 获取物品
  167.   #--------------------------------------------------------------------------
  168.   def item
  169.     return @data[self.index]
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ● 刷新
  173.   #--------------------------------------------------------------------------
  174.   def refresh
  175.     if self.contents != nil
  176.       self.contents.dispose
  177.       self.contents = nil
  178.     end
  179.     self.update_cursor_rect
  180.     @data = []
  181.     for i in 1...$data_items.size
  182.       if $game_party.item_number(i) > 0
  183.         @data.push($data_items[i])
  184.       end
  185.     end
  186.     for i in 1...$data_weapons.size
  187.       if $game_party.weapon_number(i) > 0
  188.         @data.push($data_weapons[i])
  189.       end
  190.     end
  191.     for i in 1...$data_armors.size
  192.       if $game_party.armor_number(i) > 0
  193.         @data.push($data_armors[i])
  194.       end
  195.     end
  196.     # 如果项目数不是 0 就生成位图、描绘全部项目
  197.     @item_max = @data.size
  198.     if @item_max > 0
  199.       self.contents = Bitmap.new(width - 32, row_max * 32)
  200.       for i in 0...@item_max
  201.         draw_item(i)
  202.       end
  203.     end
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # ● 描绘项目
  207.   #     index : 项目标号
  208.   #--------------------------------------------------------------------------
  209.   def draw_item(index)
  210.     item = @data[index]
  211.     case item
  212.     when RPG::Item
  213.       number = $game_party.item_number(item.id)
  214.     when RPG::Weapon
  215.       number = $game_party.weapon_number(item.id)
  216.     when RPG::Armor
  217.       number = $game_party.armor_number(item.id)
  218.     end
  219.     self.contents.font.color = text_color(item.name_color_66RPG)
  220.     x = 4
  221.     y = index * 32
  222.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  223.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  224.     bitmap = RPG::Cache.icon(item.icon_name)
  225.     opacity = self.contents.font.color == text_color(item.name_color_66RPG) ? 255 : 128
  226.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 32, 32), opacity)
  227.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  228.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  229.     self.contents.draw_text(x + 256, y, 32, 32, number.to_s, 2)
  230.   end
  231.   #--------------------------------------------------------------------------
  232.   # ● 刷新帮助文本
  233.   #--------------------------------------------------------------------------
  234.   def update_help
  235.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  236.   end
  237. end
  238.   
  239. #==============================================================================
  240. # ■ Window_ForgeRight
  241. #------------------------------------------------------------------------------
  242. #  合成画面中的合成区窗口
  243. #==============================================================================
  244.   
  245. class Window_ComposeRight < Window_Selectable
  246.   attr_accessor :forge_item
  247.   #--------------------------------------------------------------------------
  248.   # ● 初始化对像
  249.   #--------------------------------------------------------------------------
  250.   def initialize(forge_item)
  251.     super(320, 128, 320, 352)
  252.     @column_max = 1
  253.     @forge_item = []
  254.     refresh
  255.     self.index = 0
  256.   end
  257.   #--------------------------------------------------------------------------
  258.   # ● 获取物品
  259.   #--------------------------------------------------------------------------
  260.   def item
  261.     return @data[self.index]
  262.   end
  263.   #--------------------------------------------------------------------------  
  264.   # ● 获取物品  
  265.   #--------------------------------------------------------------------------  
  266.   def item_number  
  267.     return @data_number[self.index]  
  268.   end  
  269.   #--------------------------------------------------------------------------
  270.   # ● 刷新
  271.   #--------------------------------------------------------------------------
  272.   def refresh
  273.     if self.contents != nil
  274.       self.contents.dispose
  275.       self.contents = nil
  276.     end
  277.     @data = []
  278.     @data_number = []  
  279.     @forge_item = $game_temp.forge
  280.     for item_forge in @forge_item
  281.       case item_forge[0]
  282.       when 0
  283.         item = $data_items[item_forge[1]]
  284.       when 1
  285.         item = $data_weapons[item_forge[1]]
  286.       when 2
  287.         item = $data_armors[item_forge[1]]
  288.       end
  289.       if (item != nil) and (item_forge[2] != 0)  
  290.         @data.push(item)  
  291.         @data_number.push(item_forge[2])  
  292.       else  
  293.         @data.delete(item)  
  294.       end  
  295.     end
  296.     # 如果项目数不是 0 就生成位图、描绘全部项目
  297.     @item_max = @data.size
  298.     if @item_max > 0
  299.       self.contents = Bitmap.new(width - 32, row_max * 32)
  300.       for i in 0...@item_max
  301.         draw_item(i)
  302.       end
  303.     end
  304.   end
  305.   #--------------------------------------------------------------------------
  306.   # ● 描绘项目
  307.   #     index : 项目标号
  308.   #--------------------------------------------------------------------------
  309.   def draw_item(index)
  310.     item = @data[index]
  311.     case item
  312.     when RPG::Item
  313.       number = $game_temp.forge[index][2]
  314.     when RPG::Weapon
  315.       number = $game_temp.forge[index][2]
  316.     when RPG::Armor
  317.       number = $game_temp.forge[index][2]
  318.     end
  319.     self.contents.font.color = text_color(item.name_color_66RPG)
  320.     x = 4
  321.     y = index * 32
  322.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  323.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  324.     bitmap = RPG::Cache.icon(item.icon_name)
  325.     opacity = self.contents.font.color == text_color(item.name_color_66RPG) ? 255 : 128
  326.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 32, 32), opacity)
  327.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  328.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  329.     self.contents.draw_text(x + 256, y, 32, 32, number.to_s, 2)
  330.   end
  331.   #--------------------------------------------------------------------------
  332.   # ● 刷新帮助文本
  333.   #--------------------------------------------------------------------------
  334.   def update_help
  335.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  336.   end
  337. end
  338.   
  339. #==============================================================================
  340. # ■ Scene_Compose
  341. #------------------------------------------------------------------------------
  342. #  处理物品合成画面的类
  343. #==============================================================================
  344.   
  345. class Scene_Compose
  346. #--------------------------------------------------------------------------
  347. # ● 初始化
  348. #--------------------------------------------------------------------------
  349. def initialize
  350.    # 生成帮助窗口
  351.    @help_window = Window_Help.new
  352.    # 生成命令窗口
  353.    @command_window = Window_ComposeCommand.new
  354.    @command_window.active = false
  355.    # 生成左方窗口
  356.    @item_window = Window_ComposeLeft.new
  357.    @item_window.active = true
  358.    @item_window.help_window = @help_window
  359.    # 生成右方窗口
  360.    @forge_window = Window_ComposeRight.new([])
  361.    @forge_window.active = false
  362.    @forge_window.help_window = @help_window
  363.    # 初始化配方与合成区
  364.    @formulas = $game_system.formulas
  365.    @products = $game_system.products
  366.    @sproducts = $game_system.sproducts
  367.    @fproducts = $game_system.fproducts
  368.    @probability = $game_system.probability
  369.    @forge = []
  370.    @products_temp = []  
  371.    @sproducts_temp = []
  372.    @fproducts_temp = []
  373.    @probability_temp = []
  374. end
  375.   #--------------------------------------------------------------------------
  376.   # ● 主处理
  377.   #--------------------------------------------------------------------------
  378. def main
  379.    # 执行过渡
  380.    Graphics.transition
  381.    # 主循环
  382.    loop do
  383.      # 刷新游戏画面
  384.      Graphics.update
  385.      # 刷新输入情报
  386.      Input.update
  387.      # 刷新画面
  388.      update
  389.      # 如果画面被切换的话就中断循环
  390.      if $scene != self
  391.        break
  392.      end
  393.    end
  394.    # 准备过渡
  395.    Graphics.freeze
  396.    # 释放窗口
  397.    @help_window.dispose
  398.    @command_window.dispose
  399.    @item_window.dispose
  400.    @forge_window.dispose
  401. end
  402.   #--------------------------------------------------------------------------
  403.   # ● 刷新画面
  404.   #--------------------------------------------------------------------------  
  405. def update
  406.    @help_window.update
  407.    @command_window.update
  408.    @item_window.update
  409.    @forge_window.update
  410.    if @command_window.active
  411.      update_command
  412.      return
  413.    end
  414.    if @item_window.active
  415.      update_item
  416.      return
  417.    end
  418.    if @forge_window.active
  419.      update_forge
  420.      return
  421.    end
  422.     return
  423. end
  424.   #--------------------------------------------------------------------------
  425.   # ● 刷新画面(指令窗口激活的情况下)
  426.   #--------------------------------------------------------------------------
  427.   def update_command
  428.     # 按下 B 键的情况下
  429.     if Input.trigger?(Input::B)
  430.       # 演奏取消 SE
  431.       $game_system.se_play($data_system.cancel_se)
  432.       abort
  433.       # 切换到地图画面
  434.       $scene = Scene_Map.new
  435.       return
  436.     end
  437.      # 按下 C 键的情况下
  438.     if Input.trigger?(Input::C)
  439.       # 命令窗口光标位置分支
  440.       case @command_window.index
  441.       when 0  # 更改材料
  442.         # 演奏确定 SE
  443.         $game_system.se_play($data_system.decision_se)
  444.         # 窗口状态转向物品窗口
  445.         @command_window.active = false
  446.         @item_window.active = true
  447.         @forge_window.active = false
  448.       when 1  # 合成
  449.         # 演奏确定 SE
  450.         $game_system.se_play($data_system.decision_se)
  451.         # 执行合成命令
  452.         if $game_temp.forge != []
  453.           compose
  454.         end
  455.       when 2  # 放弃合成
  456.         # 演奏确定 SE
  457.         $game_system.se_play($data_system.decision_se)
  458.         # 放弃合成
  459.         abort
  460.       when 3  # 离开
  461.         # 演奏确定 SE
  462.         $game_system.se_play($data_system.decision_se)
  463.         # 放弃合成
  464.         abort
  465.         # 切换到地图画面
  466.         $scene = Scene_Map.new
  467.       end
  468.       return
  469.     end
  470.   end
  471.   #--------------------------------------------------------------------------
  472.   # ● 刷新画面(物品窗口激活的情况下)
  473.   #--------------------------------------------------------------------------
  474.   def update_item
  475.      # 按下 B 键的情况下
  476.     if Input.trigger?(Input::B)
  477.       # 演奏取消 SE
  478.       $game_system.se_play($data_system.cancel_se)
  479.       # 切换到指令窗口
  480.       @item_window.active = false
  481.       @command_window.active = true
  482.       @help_window.set_text("")
  483.       return
  484.     end
  485.      # 按下 C 键的情况
  486.     if Input.trigger?(Input::C)
  487.       # 演奏确定 SE
  488.       $game_system.se_play($data_system.decision_se)
  489.       # 获取物品
  490.       @item = @item_window.item
  491.       # 获取物品的所持数
  492.       case @item
  493.       when RPG::Item
  494.         number = $game_party.item_number(@item.id)
  495.         typetemp = 0
  496.       when RPG::Weapon
  497.         number = $game_party.weapon_number(@item.id)
  498.         typetemp = 1
  499.       when RPG::Armor
  500.         number = $game_party.armor_number(@item.id)
  501.         typetemp = 2
  502.       end
  503.       if number != nil
  504.         # 更改合成窗口的物品
  505.         case @item
  506.         when RPG::Item
  507.           $game_party.lose_item(@item.id, 1)
  508.         when RPG::Weapon
  509.           $game_party.lose_weapon(@item.id, 1)
  510.         when RPG::Armor
  511.           $game_party.lose_armor(@item.id, 1)
  512.         end
  513.         forge_change(typetemp, @item.id, 1)
  514.         # 刷新各窗口
  515.         @item_window.update
  516.         @help_window.update
  517.         @forge_window.update
  518.         @item_window.refresh
  519.         @forge_window.refresh
  520.       end
  521.     end
  522.      # 按下 右方向键 的情况
  523.     if Input.trigger?(Input::RIGHT)
  524.       # 切换到合成窗口
  525.       @item_window.active = false
  526.       @forge_window.active = true
  527.     end
  528.   end
  529.   #--------------------------------------------------------------------------
  530.   # ● 刷新画面(合成窗口激活的情况下)
  531.   #--------------------------------------------------------------------------
  532.   def update_forge
  533.      # 按下 B 键的情况下
  534.     if Input.trigger?(Input::B)
  535.       # 演奏取消 SE
  536.       $game_system.se_play($data_system.cancel_se)
  537.       # 切换到指令窗口
  538.       @forge_window.active = false
  539.       @command_window.active = true
  540.       @help_window.set_text("")
  541.       return
  542.     end
  543.      # 按下 C 键的情况
  544.     if Input.trigger?(Input::C)
  545.      # 演奏确定 SE
  546.      $game_system.se_play($data_system.decision_se)
  547.      # 获取物品
  548.       @item = @forge_window.item
  549.       # 获取物品的所持数
  550.       case @item
  551.       when RPG::Item
  552.         number = @forge_window.item_number
  553.         typetemp = 0
  554.       when RPG::Weapon
  555.         number = @forge_window.item_number
  556.         typetemp = 1
  557.       when RPG::Armor
  558.         number = @forge_window.item_number
  559.         typetemp = 2
  560.       end
  561.      if number != nil
  562.        # 更改合成窗口的物品
  563.        case @item
  564.        when RPG::Item
  565.          $game_party.gain_item(@item.id, 1)
  566.        when RPG::Weapon
  567.          $game_party.gain_weapon(@item.id, 1)
  568.        when RPG::Armor
  569.          $game_party.gain_armor(@item.id, 1)
  570.        end
  571.        #p number
  572.        forge_change(typetemp, @item.id, -1)
  573.        # 刷新各窗口
  574.        @item_window.refresh
  575.        @forge_window.refresh
  576.        @help_window.update
  577.        @item_window.update
  578.        @forge_window.update
  579.       end
  580.     end
  581.        # 按下 左方向键 的情况下
  582.     if Input.trigger?(Input::LEFT)
  583.       # 切换到合成窗口
  584.       @forge_window.active = false
  585.       @item_window.active = true
  586.     end
  587.   end
  588.   #--------------------------------------------------------------------------
  589.   # ● 更改合成窗口物品
  590.   #--------------------------------------------------------------------------
  591.   def forge_change(type,id,number)  
  592.      quantity = number  
  593.      for item in $game_temp.forge
  594.        if (item[0]==type) and (item[1]==id)  
  595.          item[2] = [item[2] += quantity,99].min  
  596.          if item[2] == 0  
  597.            $game_temp.forge.delete(item)  
  598.          end
  599.          return  
  600.        end  
  601.      end  
  602.      $game_temp.forge.push([type,id,number])  
  603.   end  
  604.   #--------------------------------------------------------------------------
  605.   # ● 放弃合成
  606.   #--------------------------------------------------------------------------  
  607.   def abort
  608.     # 将合成窗口中的物品转移至物品窗口中
  609.     for item in $game_temp.forge
  610.       # 判断物品类型并归还
  611.       case item[0]
  612.       when 0
  613.         $game_party.gain_item(item[1], item[2])
  614.       when 1
  615.         $game_party.gain_weapon(item[1], item[2])
  616.       when 2
  617.         $game_party.gain_armor(item[1], item[2])
  618.       end
  619.     end
  620.     $game_temp.forge = []
  621.     # 刷新各窗口
  622.     @item_window.refresh
  623.     @forge_window.refresh
  624.   end
  625.   #--------------------------------------------------------------------------
  626.   # ● 检测是否有符合的配方
  627.   #--------------------------------------------------------------------------
  628. def match
  629.    match_one = false
  630.    match_this = false
  631.     # 检测每一个配方
  632.    for i in [email protected]
  633.      # 将合成窗口中的物品复制到合成缓存区
  634.      # 注意: 直接使用"="将传引用 导致检测配方是否匹配时合成窗口中物品被删除
  635.      @forge = $game_temp.forge.dup
  636.      # 检测这个配方中每一项材料
  637.      for ingredient in @formulas[i]
  638.        match_this = true
  639.        # 合成区中没有此项材料的情况
  640.        unless @forge.include?(ingredient)
  641.          match_this = false
  642.          break
  643.        end
  644.        # 从合成区中暂时删除这项材料
  645.        @forge.delete(ingredient)
  646.      end
  647.      if match_this == false
  648.        next
  649.      end
  650.      # 检测合成区中是否还有配方外的材料剩余
  651.      unless @forge == []
  652.        match_this = false
  653.      end
  654.      # 满足这一个配方的情况
  655.      if match_this == true
  656.        match_one = true
  657.        # 获取配方的成品、成功额外产物、失败额外产物、合成各种概率
  658.        @products_temp = @products[i]
  659.        @sproducts_temp = @sproducts[i]
  660.        @fproducts_temp = @fproducts[i]
  661.        @probability_temp = @probability[i]
  662.        $g=i
  663.        break
  664.      end
  665.    end
  666.    return match_one
  667. end
  668.   #--------------------------------------------------------------------------
  669.   # ● 合成
  670.   #--------------------------------------------------------------------------
  671. def compose
  672.    # 如果有符合的配方
  673.    if match
  674.      # 将合成窗口中的材料改变为成品
  675.      $game_temp.forge = []
  676.      p @probability_temp[$g]
  677.      if @probability_temp[$g-1]==100
  678.        @pro1=0#当成功率为100%时随机概率是0
  679.      else
  680.        @pro1=rand(99)#当成功率不为100%时随即概率为0-99
  681.      end
  682.      if @pro1<@probability_temp[$g-1]
  683.        for i in 0...@products_temp.size
  684.          forge_change(@products_temp[i][0], @products_temp[i][1], @products_temp[i][2])
  685.        end
  686.        if @probability_temp[$g]==100
  687.          @pro2=0#成功额外产率为100%时随即概率为0
  688.        elsif @probability_temp[$g]<100
  689.          @pro2=rand(99)#成功额外产率为0-99%时随即概率为0-99%
  690.        else
  691.          @pro2=0#成功额外产率为0%时没有成功额外产物
  692.        end
  693.        if @pro2<@probability_temp[$g]
  694.          for i in 0...@sproducts_temp.size
  695.            forge_change(@sproducts_temp[i][0], @sproducts_temp[i][1], @sproducts_temp[i][2])
  696.          end
  697.        end
  698.      else
  699.        if @probability_temp[$g+1]==100
  700.          @pro3=0#成功额外产率为100%时随即概率为0
  701.        elsif @probability_temp[$g+1]<100
  702.          @pro3=rand(99)#成功额外产率为0-99%时随即概率为0-99%
  703.        else
  704.          @pro3=0#成功额外产率为0%时没有成功额外产物
  705.        end
  706.        if @pro3<@probability_temp[$g+1]
  707.          for i in 0...@fproducts_temp.size
  708.            forge_change(@fproducts_temp[i][0], @fproducts_temp[i][1], @fproducts_temp[i][2])
  709.          end
  710.        end
  711.      end
  712.      if $SE_Compose_Successful != ""
  713.        Audio.se_play($SE_Compose_Successful)
  714.      end
  715.    # 合成失败的情况
  716.    else  
  717.      if $SE_Compose_Failed != ""
  718.        Audio.se_play($SE_Compose_Failed)
  719.      end
  720.      if $Ingredient_Lost_When_Fail
  721.        $game_temp.forge = []
  722.      end
  723.    end
  724.     # 刷新各窗口
  725.    @item_window.refresh
  726.    @forge_window.refresh
  727. end
  728. end
复制代码
这个就可以了

评分

参与人数 1星屑 +90 收起 理由
myownroc + 90 认可答案

查看全部评分

[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
95
在线时间
187 小时
注册时间
2013-8-28
帖子
42
7
 楼主| 发表于 2013-10-20 09:11:03 | 只看该作者
chd114 发表于 2013-10-19 21:49
= =你到底想表达什么···铸剑有很多解释···举个例子啊···

和6楼的差不多,我不强求有强化,有合成就可以了
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3570
在线时间
3064 小时
注册时间
2011-11-17
帖子
980
6
发表于 2013-10-19 22:18:07 | 只看该作者
本质就是 合成 和 强化
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9280
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

5
发表于 2013-10-19 21:49:09 | 只看该作者
1105659784 发表于 2013-10-19 21:30
抱歉……不是这个,是应该铸剑的系统脚本,换句话说,可以在游戏中铸剑的 ...

= =你到底想表达什么···铸剑有很多解释···举个例子啊···
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
95
在线时间
187 小时
注册时间
2013-8-28
帖子
42
4
 楼主| 发表于 2013-10-19 21:30:51 | 只看该作者
chd114 发表于 2013-10-19 18:07
http://games.sina.com.cn/handbook/2004/10/091328.shtml你是说这个?

抱歉……不是这个,是应该铸剑的系统脚本,换句话说,可以在游戏中铸剑的
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9280
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

3
发表于 2013-10-19 18:07:45 | 只看该作者
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-30 06:32

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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