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

Project1

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

[已经解决] 大佬们,Ace有没有装备镶嵌打孔脚本啊!

[复制链接]

Lv1.梦旅人

梦石
0
星屑
86
在线时间
9 小时
注册时间
2015-8-2
帖子
4
跳转到指定楼层
1
发表于 2021-12-18 03:04:49 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
400星屑
大哥们,全部身家求能用的装备打孔镶嵌脚本啊!

Lv3.寻梦者

梦石
0
星屑
2323
在线时间
274 小时
注册时间
2017-7-25
帖子
163
2
发表于 2021-12-18 03:04:50 | 只看该作者
  1. #==============================================================================#
  2. #  #*****************#                                                         #
  3. #  #*** By Falcao ***#          * Falcao 宝石镶嵌系统 1.6              #
  4. #  #*****************#          This script allows you to enchants, weapons and#
  5. #                               armors in order to increa se the actor stats.   #
  6. #       RMVXACE                                                                #
  7. #                               Date: October 22 2012                          #
  8. #                                                                              #
  9. # Falcao RGSS site:  http://falcaorgss.wordpress.com                           #
  10. # Falcao Forum site: http://makerpalace.com                                    #
  11. #==============================================================================#
  12. # 1.6 change log
  13. # - Fixed crash when mana stones are destroyed before the socketing process
  14. #
  15. # 1.5 change log
  16. # - Added new stand alone GUI
  17. # - Fixed bug when you set the DefaultSockets to cero and unequipp a weapon/armo
  18. # - Mana stones container expanded on more line
  19. #-------------------------------------------------------------------------------
  20. # * 安装
  21. # 复制本脚本到main之上,没有对任何方法重命名,所宜兼容性是极好的。
  22. #-------------------------------------------------------------------------------
  23. # * 特点
  24. # - 支持武器、防具镶嵌
  25. # - 镶嵌槽数量任意设置
  26. # - 通过镶嵌提升角色属性,已镶嵌的宝石可以被摘除
  27. # - 在物品栏添加备注来设定其为可镶嵌的宝石
  28. # - 有几率镶嵌失败
  29. # - 镶嵌失败时宝石会被摧毁
  30. # - 使用者友好的UI.
  31. #
  32. # 注释: 武器和防具默认是独一无二的。所以当有多个武器和防具使用同一个id且被镶嵌时,
  33. # 宝石会全部镶嵌在它们上。
  34. #-------------------------------------------------------------------------------
  35. # * 使用方法
  36. #
  37. # 在装备窗口中按下A键来呼出镶嵌窗口,只有装备在角色身上的武器和防具才能进行镶嵌。
  38. #
  39. # 武器和防具备注栏:
  40. # <镶嵌孔:x>      - x为其镶嵌孔数量
  41. #
  42. # 物品备注栏: (带有以下备注的物品都会被视为可镶嵌的宝石)
  43. # <提升体力:x>
  44. # <提升魔力:x>
  45. # <提升物攻:x>
  46. # <提升物防:x>       => x为提升数值
  47. # <提升魔攻:x>
  48. # <提升魔防:x>
  49. # <提升敏捷:x>
  50. # <提升幸运:x>
  51. #
  52. # <镶嵌几率:x>  x为镶嵌成功的几率,设定范围为"0~100"(即代表0%~100%)
  53. #                无此备注的镶嵌宝石则视为100%会被镶嵌成功
  54. #-------------------------------------------------------------------------------
  55. # * 使用执照
  56. # 仅可用于非商业游戏, 对于商业游戏请联系我:
  57. # [email protected]
  58. #-------------------------------------------------------------------------------

  59. module FalMana
  60.   
  61.   # 默认武器和防具的镶嵌孔数
  62.   DefaultSockets = 0
  63.   
  64.   # 默认镶嵌成功几率
  65.   DefaultChance = 100
  66.   
  67.   # 镶嵌中播放的音效
  68.   SoketingSe = "Heal6"
  69.   
  70.   # 镶嵌成功时播放的音效
  71.   SocketSuccessSe = "Decision2"
  72.   
  73.   # 镶嵌失败时播放的音效
  74.   SocketFailSe = "Down1"
  75.   
  76.   # 摘除宝石时播放的音效
  77.   ClearSocketSe = "Equip3"
  78.   
  79. #-------------------------------------------------------------------------------
  80.   def self.stones(actor)
  81.     @actor = actor
  82.     SceneManager.call(Scene_ManaStones)
  83.   end
  84.   
  85.   def self.actor ; @actor ; end

  86.   def self.socket_manastone(item, index, value, actor)
  87.     item.manaslots[index] = value
  88.     actor.add_param(value.manastone_param[0], value.manastone_param[1])
  89.   end
  90.   
  91.   def self.remove_manastone(item, index, value, actor)
  92.     item.manaslots[index] = nil
  93.     actor.add_param(value.manastone_param[0], - value.manastone_param[1])
  94.   end
  95.   
  96.   def self.clear_manastones(item, actor)
  97.     item.manaslots.each {|m| actor.add_param(m.manastone_param[0],
  98.     - m.manastone_param[1]) unless m.nil?}
  99.     item.manaslots.size.times {|i| item.manaslots[i] = nil}
  100.   end
  101.   
  102.   def self.add_param(actor, item, sub=false)
  103.     return if item.nil?
  104.     return if item.manaslots.nil?
  105.      item.manaslots.each {|m| actor.add_param(m.manastone_param[0],
  106.      sub ? - m.manastone_param[1] : m.manastone_param[1]) unless m.nil?}
  107.   end
  108. end

  109. # Game system: Register mana stones values
  110. class Game_System
  111.   attr_reader   :weapon_slots, :armor_slots
  112.   alias falcaomana_slots_ini initialize
  113.   def initialize
  114.     @weapon_slots = {}
  115.     @armor_slots = {}
  116.     dataslots_ini(@weapon_slots, $data_weapons)
  117.     dataslots_ini(@armor_slots, $data_armors)
  118.     falcaomana_slots_ini
  119.   end
  120.   
  121.   def dataslots_ini(operand, item)
  122.     for kind in item
  123.       next if kind.nil?
  124.       if kind.given_sl != nil
  125.         data = []
  126.         kind.given_sl.times {|i| data.push(nil)}
  127.         operand[kind.id] = data
  128.       end
  129.     end
  130.   end
  131. end

  132. # Scene_Equip: main mana stones socketing system
  133. class Scene_Equip < Scene_MenuBase
  134.   def update
  135.     super
  136.     update_manacalling
  137.   end
  138.   
  139.   def update_manacalling
  140.     update_enchant_help
  141.     if Input.trigger?(:X)
  142.       FalMana.stones(@actor)
  143.       Sound.play_ok
  144.     end
  145.   end
  146.   
  147.   def update_enchant_help
  148.     @help_window.contents.font.size = Font.default_size
  149.     @help_window.refresh
  150.     @help_window.contents.font.size = 18
  151.     @help_window.draw_text(-22,22,@help_window.width,32, '按下 A 来进行镶嵌',2)
  152.   end
  153. end

  154. # RPG::EquipItem: get slots data for each weapon and armor
  155. class RPG::EquipItem < RPG::BaseItem
  156.   def given_sl
  157.     @note =~ /<镶嵌孔:(.*)>/i ? n = $1.to_i : n = nil
  158.     n = FalMana::DefaultSockets if n.nil? and FalMana::DefaultSockets > 0
  159.     return n
  160.   end
  161.   
  162.   def manaslots
  163.     self.is_a?(RPG::Weapon) ? i = $game_system.weapon_slots[self.id] :
  164.     i = $game_system.armor_slots[self.id]
  165.     return i
  166.   end
  167. end

  168. # RPG::Item: Mana stones item definition
  169. class RPG::Item < RPG::UsableItem
  170.   def socket_chance
  171.     @note =~ /<镶嵌几率:(.*)>/i ? n = $1.to_i : n = FalMana::DefaultChance
  172.     return n
  173.   end
  174.   
  175.   def manastone_param
  176.     param = [0, $1.to_i] if @note =~ /<提升体力:(.*)>/i
  177.     param = [1, $1.to_i] if @note =~ /<提升魔力:(.*)>/i
  178.     param = [2, $1.to_i] if @note =~ /<提升物攻:(.*)>/i
  179.     param = [3, $1.to_i] if @note =~ /<提升物防:(.*)>/i
  180.     param = [4, $1.to_i] if @note =~ /<提升魔攻:(.*)>/i
  181.     param = [5, $1.to_i] if @note =~ /<提升魔防:(.*)>/i
  182.     param = [6, $1.to_i] if @note =~ /<提升敏捷:(.*)>/i
  183.     param = [7, $1.to_i] if @note =~ /<提升幸运:(.*)>/i
  184.     return param
  185.   end
  186. end

  187. #-------------------------------------------------------------------------------
  188. # Window mana slots
  189. class Window_ItemSlots < Window_Selectable
  190.   def initialize(x=0, y=0, w=280, h=124)
  191.     super(x, y,  w, h)
  192.     unselect
  193.   end
  194.   
  195.   def item()        return @data[self.index] end
  196.   def line_height() return 24                end
  197.   def spacing()     return 6                 end
  198.   def col_max()     return 2                 end
  199.    
  200.   def refresh(object)
  201.     self.contents.clear if self.contents != nil
  202.     @data = []
  203.     return if object.manaslots.nil? rescue return
  204.     object.manaslots.each {|i| @data.push(i)}
  205.     @item_max = @data.size
  206.     if @item_max > 0
  207.       self.contents = Bitmap.new(width - 32, row_max * 26)
  208.       for i in 0...@item_max
  209.         draw_item(i)
  210.       end
  211.     end
  212.   end

  213.   def draw_item(index)
  214.     item = @data[index]
  215.     x, y = index % col_max * (129), index / col_max  * 24
  216.     self.contents.font.size = 18
  217.     self.contents.draw_text(x + 2, y - 2, 212, 32, '无', 0)
  218.     draw_icon(item.icon_index, x, y) rescue nil
  219.     param = Vocab.param(item.manastone_param[0]) rescue nil
  220.     value = item.manastone_param[1] rescue nil
  221.     self.contents.draw_text(x + 24,y,212,32, param + " +#{value}") rescue nil
  222.   end
  223.   
  224.   def item_max
  225.     return @item_max.nil? ? 0 : @item_max
  226.   end
  227. end

  228. #-------------------------------------------------------------------------------
  229. # Window mana stones
  230. class Window_ManaStones < Window_Selectable
  231.   def initialize(x=0, y=124, w=280, h=148)
  232.     super(x, y,  w, h)
  233.     refresh ; unselect
  234.   end
  235.   
  236.   def item() return @data[self.index] end
  237.   
  238.   def refresh
  239.     self.contents.clear if self.contents != nil
  240.     @data = []
  241.     for it in $data_items
  242.       next if it.nil?
  243.       @data.push(it) if $game_party.has_item?(it) and !it.manastone_param.nil?
  244.     end
  245.     @item_max = @data.size
  246.     if @item_max > 0
  247.       self.contents = Bitmap.new(width - 32, row_max * 26)
  248.       for i in 0...@item_max
  249.         draw_item(i)
  250.       end
  251.     end
  252.   end

  253.   def draw_item(index)
  254.     item = @data[index]
  255.     x, y = index % col_max * (90), index / col_max  * 24
  256.     self.contents.font.size = 18
  257.     draw_icon(item.icon_index, x, y)
  258.     param = Vocab.param(item.manastone_param[0])
  259.     value = item.manastone_param[1]
  260.     number = $game_party.item_number(item)
  261.     contents.draw_text(x + 24,y,212,32, item.name + "  #{param} +#{value}")
  262.     contents.draw_text(x -30, y, self.width, 32, ':' + number.to_s, 2)
  263.   end
  264.   
  265.   def item_max
  266.     return @item_max.nil? ? 0 : @item_max
  267.   end
  268. end

  269. class Game_Actor < Game_Battler
  270.   alias falcaomanastones_change change_equip
  271.   def change_equip(slot_id, item)
  272.     FalMana.add_param(self, @equips[slot_id].object, true)
  273.     FalMana.add_param(self, item)
  274.     falcaomanastones_change(slot_id, item)
  275.   end
  276. end


  277. #-------------------------------------------------------------------------------
  278. # Window actor equipped
  279. class Window_Equippedwa < Window_Selectable
  280.   def initialize(x=0, y=124)
  281.     super(x, y,  190, 148)
  282.     refresh(FalMana.actor) ; activate ; select(0)
  283.   end
  284.   
  285.   def item() return @data[self.index] end
  286.   
  287.   def refresh(actor)
  288.     self.contents.clear if self.contents != nil
  289.     @data = []
  290.     actor.equips.each {|equips| @data.push(equips) if !equips.nil?}
  291.     @item_max = @data.size
  292.     if @item_max > 0
  293.       self.contents = Bitmap.new(width - 32, row_max * 26)
  294.       for i in 0...@item_max
  295.         draw_item(i)
  296.       end
  297.     end
  298.   end

  299.   def draw_item(index)
  300.     item = @data[index]
  301.     x, y = index % col_max * (90), index / col_max  * 24
  302.     self.contents.font.size = 18
  303.     draw_icon(item.icon_index, x, y)
  304.     contents.draw_text(x + 24,y,212,32, item.name)
  305.   end
  306.   
  307.   def item_max
  308.     return @item_max.nil? ? 0 : @item_max
  309.   end
  310. end

  311. # Scene mana stones
  312. class Scene_ManaStones < Scene_MenuBase
  313.   def start
  314.     super
  315.     w = Graphics.width ; h = Graphics.height ; @actor = FalMana.actor
  316.     @slot_window = Window_Equippedwa.new(w/2 - 190/2 - 137, h/2 - 148/2 - 106)
  317.     @param_window = Window_Base.new(@slot_window.x,@slot_window.y + 148,190,214)
  318.     refresh_param
  319.     @socket_window = Window_Base.new(w/2 - 280/2 + 97,h/2 - 90/2 - 136, 280, 90)
  320.     @col = [Color.new(180, 225, 245), Color.new(20, 160, 225), Color.new(0,0,0)]
  321.     @itemslots = Window_ItemSlots.new(@socket_window.x, @socket_window.y + 90)
  322.     @manastones = Window_ManaStones.new(@itemslots.x, @itemslots.y + 124)
  323.     @result = '' ; @meter = 0
  324.     update_indexes
  325.   end
  326.   
  327.   def refresh_param
  328.     @param_window.contents.clear
  329.     @param_window.contents.font.size = 18
  330.     @param_window.contents.font.color = @param_window.normal_color
  331.     @param_window.contents.fill_rect(0, 0, 190, 44, Color.new(0, 0, 0, 60))
  332.     @param_window.draw_character(@actor.character_name,
  333.     @actor.character_index, 20, 42)
  334.     @param_window.draw_text(50, -6, 190, 32, @actor.name)
  335.     @param_window.draw_text(50, 18, 190, 32, '装备')
  336.     y = 0
  337.     for i in 0...8
  338.       y += 17
  339.       @param_window.contents.font.color = @param_window.normal_color
  340.       @param_window.draw_text(0, y + 28, 190, 32, Vocab.param(i))
  341.       @param_window.contents.font.color = @param_window.system_color
  342.       @param_window.draw_text(70, y + 28, 190, 32, "=> #{@actor.param(i)}")
  343.     end
  344.   end
  345.   
  346.   def refresh_socketing
  347.     @socket_window.contents.clear
  348.     @socket_window.contents.font.size = 18
  349.     if @slot_window.item.nil? || @slot_window.item.manaslots.nil?
  350.       @socket_window.draw_text(-16, 0, 280, 32, '无镶嵌孔', 1)
  351.       return
  352.     end
  353.     @socket_window.draw_icon(@slot_window.item.icon_index, 0, 0)
  354.     @socket_window.draw_text(26, 0, @socket_window.width, 32,
  355.     @slot_window.item.name + "的镶嵌孔数: #{@slot_window.item.manaslots.size}")
  356.     @socket_window.draw_text(-20, 44, 280, 32, 'S键 = 摘除宝石', 2)
  357.     if @meter > 0 and @meter < 100
  358.       x, y = 78, 34
  359.       @socket_window.draw_text(0, 22, 212, 32, '镶嵌:')
  360.       @socket_window.contents.fill_rect(x, y, 152, 12, @col[2])
  361.       @socket_window.contents.fill_rect(x+1, y+1, 150 *@meter / 100, 5, @col[0])
  362.       @socket_window.contents.fill_rect(x+1, y+6, 150 *@meter / 100, 5, @col[1])
  363.     elsif @meter > 100
  364.       @socket_window.draw_text(0, 22, @socket_window.width, 32, @result)
  365.     elsif @meter == 0
  366.       @itemslots.item.nil? ? @result = '准备镶嵌' : @result = '无法镶嵌'
  367.       @socket_window.draw_text(0, 22, @socket_window.width, 32, @result)
  368.     end
  369.   end

  370.   def terminate
  371.     super
  372.     @itemslots.dispose
  373.     @manastones.dispose
  374.     @socket_window.dispose
  375.     @slot_window.dispose
  376.     @param_window.dispose
  377.   end

  378.   def update
  379.     super
  380.     update_selection       if Input.trigger?(:C)
  381.     update_cancel          if Input.trigger?(:B)
  382.     update_clear_socket    if Input.trigger?(:Y)
  383.     start_socketing
  384.     update_indexes
  385.   end
  386.   
  387.   def update_indexes
  388.     if @equipp_slot != @slot_window.index
  389.       @itemslots.refresh(@slot_window.item)
  390.       refresh_socketing
  391.       @equipp_slot = @slot_window.index
  392.     elsif @slots_index != @itemslots.index and @itemslots.visible
  393.       @slots_index = @itemslots.index
  394.       refresh_socketing
  395.     end
  396.   end
  397.   
  398.   def start_socketing
  399.     return if @soketing.nil?
  400.     @meter += 1 ; refresh_socketing
  401.     if @meter == 100
  402.       r = rand(101)
  403.       r <= @manastones.item.socket_chance ? success_socketing : fail_socketing
  404.     elsif @meter == 200
  405.       @soketing = nil ; @meter = 0 ; @manastones.activate
  406.       refresh_socketing
  407.     end
  408.   end
  409.   
  410.   def update_selection
  411.     return if @meter > 0 || [email protected]
  412.     if [email protected]? || @slot_window.item.nil? ||
  413.       @slot_window.item.manaslots.nil?
  414.       if !@slot_window.active
  415.         Sound.play_buzzer; return
  416.       elsif @slot_window.active and @slot_window.item.nil?
  417.         Sound.play_buzzer; return
  418.       elsif @slot_window.item.manaslots.nil?
  419.         Sound.play_buzzer; return
  420.       end
  421.     end
  422.     if @slot_window.active and [email protected]
  423.       @itemslots.select(0)
  424.       @itemslots.activate
  425.       @slot_window.deactivate ; Sound.play_ok
  426.     elsif @itemslots.active and [email protected]
  427.       @itemslots.deactivate
  428.       @manastones.activate ; @manastones.select(0)
  429.       Sound.play_ok
  430.     elsif @manastones.active and [email protected]?
  431.       @manastones.deactivate
  432.       RPG::SE.new(FalMana::SoketingSe, 80,).play
  433.       @soketing = true
  434.     end
  435.   end
  436.   
  437.   def fail_socketing
  438.     FalMana.clear_manastones(@slot_window.item, @actor)
  439.     @itemslots.refresh(@slot_window.item)
  440.     refresh_param
  441.     @result = '宝石已损坏!'
  442.     RPG::SE.new(FalMana::SocketFailSe, 80,).play
  443.     destroy_manastone
  444.   end
  445.   
  446.   def success_socketing
  447.     FalMana.socket_manastone(@slot_window.item, @itemslots.index,
  448.     @manastones.item, @actor)
  449.     @itemslots.refresh(@slot_window.item)
  450.     refresh_param
  451.     @result = '镶嵌成功!!'
  452.     RPG::SE.new(FalMana::SocketSuccessSe, 80,).play
  453.     destroy_manastone
  454.   end
  455.   
  456.   def destroy_manastone
  457.     $game_party.lose_item(@manastones.item, 1)
  458.     @manastones.refresh
  459.   end
  460.   
  461.   def update_cancel
  462.     return if @meter > 0
  463.     Sound.play_cancel
  464.     if @slot_window.active
  465.       SceneManager.return
  466.     elsif @itemslots.active
  467.       @slot_window.activate
  468.       @itemslots.unselect
  469.       @itemslots.deactivate
  470.     elsif @manastones.active
  471.       @manastones.unselect ; @manastones.deactivate
  472.       @itemslots.activate
  473.     end
  474.   end
  475.   
  476.   def update_clear_socket
  477.     return if @itemslots.item.nil? || [email protected]
  478.     RPG::SE.new(FalMana::ClearSocketSe, 80,).play
  479.     FalMana.remove_manastone(@slot_window.item, @itemslots.index,
  480.     @itemslots.item, @actor)
  481.     @itemslots.refresh(@slot_window.item)
  482.     refresh_param
  483.     refresh_socketing
  484.   end
  485. end
复制代码

评分

参与人数 2星屑 +30 +1 收起 理由
alexncf125 + 30 LZ认可的回答
黑夜守望者 + 1 塞糖

查看全部评分

回复

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2851
在线时间
446 小时
注册时间
2016-9-26
帖子
1222
3
发表于 2021-12-18 19:56:25 | 只看该作者
我的理解是,每一次镶嵌强化都是生成新的装备。
然后,装备的注释有所变动。
state的读取和赋值也是需要的。
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
841
在线时间
85 小时
注册时间
2005-11-21
帖子
85
4
发表于 2021-12-19 19:51:02 | 只看该作者
XP有看到这种脚本
本人自开仙境传说RO怀旧1.0服务器,QQ群552321558,人不多,娱乐用。
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-29 09:41

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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