查看: 2580|回复: 4

[已经解决] 请问如何使用盗取技能脚本后,学习的和盗取的技能不一样?

[复制链接]
梦石
0
星屑
254
在线时间
316 小时
注册时间
2015-7-2
回帖
1629

开拓者

发表于 2016-1-21 18:59:08 | 显示全部楼层 |阅读模式

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

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

×
脚本
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Skill Steal v1.00
  4. # -- Last Updated: 2011.12.10
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-SkillSteal"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2011.12.10 - Started Script and Finished.
  15. #
  16. #==============================================================================
  17. # ▼ Introduction
  18. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  19. # This script enables items and skills to have skill stealing properties. When
  20. # an actor uses that said item or skill on an enemy and the enemy has skills
  21. # that can be stolen, that actor will learn all of the skills the enemy has to
  22. # provide. This skill stealing system is madeakin to the Final Fantasy X's
  23. # Lancet skill from Kimahri.
  24. #
  25. #==============================================================================
  26. # ▼ Instructions
  27. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  28. # To install this script, open up your script editor and copy/paste this script
  29. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  30. #
  31. # -----------------------------------------------------------------------------
  32. # Skill Notetags - These notetags go in the skills notebox in the database.
  33. # -----------------------------------------------------------------------------
  34. # <skill steal>
  35. # If this skill targets an enemy, the actor who uses it will learn all of the
  36. # stealable skills the enemy knows in its action list.
  37. #
  38. # <stealable skill>
  39. # A skill with this notetag can be stolen from enemies if it is listed within
  40. # the enemy's action list.
  41. #
  42. # -----------------------------------------------------------------------------
  43. # Item Notetags - These notetags go in the items notebox in the database.
  44. # -----------------------------------------------------------------------------
  45. # <skill steal>
  46. # If this item targets an enemy, the actor who uses it will learn all of the
  47. # stealable skills the enemy knows in its action list.
  48. #
  49. #==============================================================================
  50. # ▼ Compatibility
  51. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  52. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  53. # it will run with RPG Maker VX without adjusting.
  54. #
  55. #==============================================================================

  56. module YEA
  57.   module SKILL_STEAL
  58.    
  59.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  60.     # - Battlelog Settings -
  61.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  62.     # These are the various battlelog settings made for skill stealing. Change
  63.     # the text and message duration for a successful skill stealing.
  64.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  65.     MSG_SKILL_STEAL = "%s 模仿了 %s 从 %s!" # Text for successful steal.
  66.     MSG_DURATION    = 4                       # Lower number = shorter duration.
  67.    
  68.   end # SKILL_STEAL
  69. end # YEA

  70. #==============================================================================
  71. # ▼ Editting anything past this point may potentially result in causing
  72. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  73. # halitosis so edit at your own risk.
  74. #==============================================================================

  75. module YEA
  76.   module REGEXP
  77.   module USABLEITEM
  78.    
  79.     SKILL_STEAL     = /<(?:SKILL_STEAL|skill steal)>/i
  80.     STEALABLE_SKILL = /<(?:STEALABLE_SKILL|stealable skill)>/i
  81.    
  82.   end # USABLEITEM
  83.   end # REGEXP
  84. end # YEA

  85. #==============================================================================
  86. # ■ DataManager
  87. #==============================================================================

  88. module DataManager
  89.   
  90.   #--------------------------------------------------------------------------
  91.   # alias method: load_database
  92.   #--------------------------------------------------------------------------
  93.   class <<self; alias load_database_ss load_database; end
  94.   def self.load_database
  95.     load_database_ss
  96.     load_notetags_ss
  97.   end
  98.   
  99.   #--------------------------------------------------------------------------
  100.   # new method: load_notetags_ss
  101.   #--------------------------------------------------------------------------
  102.   def self.load_notetags_ss
  103.     groups = [$data_skills, $data_items]
  104.     for group in groups
  105.       for obj in group
  106.         next if obj.nil?
  107.         obj.load_notetags_ss
  108.       end
  109.     end
  110.   end
  111.   
  112. end # DataManager

  113. #==============================================================================
  114. # ■ RPG::UsableItem
  115. #==============================================================================

  116. class RPG::UsableItem < RPG::BaseItem
  117.   
  118.   #--------------------------------------------------------------------------
  119.   # public instance variables
  120.   #--------------------------------------------------------------------------
  121.   attr_accessor :skill_steal
  122.   attr_accessor :stealable_skill
  123.   
  124.   #--------------------------------------------------------------------------
  125.   # common cache: load_notetags_ss
  126.   #--------------------------------------------------------------------------
  127.   def load_notetags_ss
  128.     #---
  129.     self.note.split(/[\r\n]+/).each { |line|
  130.       case line
  131.       #---
  132.       when YEA::REGEXP::USABLEITEM::SKILL_STEAL
  133.         @skill_steal = true
  134.       when YEA::REGEXP::USABLEITEM::STEALABLE_SKILL
  135.         next unless self.is_a?(RPG::Skill)
  136.         @stealable_skill = true
  137.       #---
  138.       end
  139.     } # self.note.split
  140.     #---
  141.   end
  142.   
  143. end # RPG::UsableItem

  144. #==============================================================================
  145. # ■ Game_Battler
  146. #==============================================================================

  147. class Game_Battler < Game_BattlerBase
  148.   
  149.   #--------------------------------------------------------------------------
  150.   # alias method: item_user_effect
  151.   #--------------------------------------------------------------------------
  152.   alias game_battler_item_user_effect_ss item_user_effect
  153.   def item_user_effect(user, item)
  154.     game_battler_item_user_effect_ss(user, item)
  155.     item_skill_steal_effect(user, item)
  156.   end
  157.   
  158.   #--------------------------------------------------------------------------
  159.   # new method: item_skill_steal_effect
  160.   #--------------------------------------------------------------------------
  161.   def item_skill_steal_effect(user, item)
  162.     return unless item.skill_steal
  163.     return unless user.actor?
  164.     return if self.actor?
  165.     for skill in stealable_skills
  166.       next if user.skill_learn?(skill)
  167.       @result.success = true
  168.       break
  169.     end
  170.   end
  171.   
  172. end # Game_Battler

  173. #==============================================================================
  174. # ■ Game_Enemy
  175. #==============================================================================

  176. class Game_Enemy < Game_Battler
  177.   
  178.   #--------------------------------------------------------------------------
  179.   # stealable_skills
  180.   #--------------------------------------------------------------------------
  181.   def stealable_skills
  182.     array = []
  183.     for action in enemy.actions
  184.       skill = $data_skills[action.skill_id]
  185.       array.push(skill) if skill.stealable_skill
  186.     end
  187.     return array
  188.   end
  189.   
  190. end # Game_Enemy

  191. #==============================================================================
  192. # ■ Scene_Battle
  193. #==============================================================================

  194. class Scene_Battle < Scene_Base
  195.   
  196.   #--------------------------------------------------------------------------
  197.   # alias method: apply_item_effects
  198.   #--------------------------------------------------------------------------
  199.   alias scene_battle_apply_item_effects_ss apply_item_effects
  200.   def apply_item_effects(target, item)
  201.     scene_battle_apply_item_effects_ss(target, item)
  202.     apply_skill_steal(target, item)
  203.   end
  204.   
  205.   #--------------------------------------------------------------------------
  206.   # new method: apply_skill_steal
  207.   #--------------------------------------------------------------------------
  208.   def apply_skill_steal(target, item)
  209.     return unless item.skill_steal
  210.     return if target.actor?
  211.     return unless @subject.actor?
  212.     for skill in target.stealable_skills
  213.       next if @subject.skill_learn?(skill)
  214.       @subject.learn_skill(skill.id)
  215.       string = YEA::SKILL_STEAL::MSG_SKILL_STEAL
  216.       skill_text = sprintf("\\i[%d]%s", skill.icon_index, skill.name)
  217.       text = sprintf(string, @subject.name, skill_text, target.name)
  218.       @log_window.add_text(text)
  219.       YEA::SKILL_STEAL::MSG_DURATION.times do @log_window.wait end
  220.       @log_window.back_one
  221.     end
  222.   end
  223.   
  224. end # Scene_Battle

  225. #==============================================================================
  226. #
  227. # ▼ End of File
  228. #
  229. #==============================================================================
复制代码

这是盗取敌方技能的脚本。
问题在于,假设说我盗取了敌方的技能A,但是掌握的却是技能B,如何设置?
不要告诉我一个一个事件设置,虽然那样……理论上也可以……
测试你的东方project认知程度?那就来玩[url=https://store.steampowered.com/app/930840/TouHouAsked/]《东方百问》[/url]吧!
东方风自作曲认知企划绝赞咕咕咕中

梦石
0
星屑
9726
在线时间
2775 小时
注册时间
2008-9-5
回帖
3458

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

发表于 2016-1-21 20:34:34 | 显示全部楼层
本帖最后由 cinderelmini 于 2016-1-21 20:39 编辑

在【module SKILL_STEAL】里面添加了个哈希表做技能对应,
然后在【Game_Enemy】里面调整了偷盗的技能ID获取。
(未测试,BUG未知……)
点击展开/收起
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Skill Steal v1.00
  4. # -- Last Updated: 2011.12.10
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-SkillSteal"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2011.12.10 - Started Script and Finished.
  15. #
  16. #==============================================================================
  17. # ▼ Introduction
  18. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  19. # This script enables items and skills to have skill stealing properties. When
  20. # an actor uses that said item or skill on an enemy and the enemy has skills
  21. # that can be stolen, that actor will learn all of the skills the enemy has to
  22. # provide. This skill stealing system is madeakin to the Final Fantasy X's
  23. # Lancet skill from Kimahri.
  24. #
  25. #==============================================================================
  26. # ▼ Instructions
  27. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  28. # To install this script, open up your script editor and copy/paste this script
  29. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  30. #
  31. # -----------------------------------------------------------------------------
  32. # Skill Notetags - These notetags go in the skills notebox in the database.
  33. # -----------------------------------------------------------------------------
  34. # <skill steal>
  35. # If this skill targets an enemy, the actor who uses it will learn all of the
  36. # stealable skills the enemy knows in its action list.
  37. #
  38. # <stealable skill>
  39. # A skill with this notetag can be stolen from enemies if it is listed within
  40. # the enemy's action list.
  41. #
  42. # -----------------------------------------------------------------------------
  43. # Item Notetags - These notetags go in the items notebox in the database.
  44. # -----------------------------------------------------------------------------
  45. # <skill steal>
  46. # If this item targets an enemy, the actor who uses it will learn all of the
  47. # stealable skills the enemy knows in its action list.
  48. #
  49. #==============================================================================
  50. # ▼ Compatibility
  51. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  52. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  53. # it will run with RPG Maker VX without adjusting.
  54. #
  55. #==============================================================================

  56. module YEA::SKILL_STEAL::STEAL_SKILLS
  57.   module SKILL_STEAL

  58.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  59.     # - Battlelog Settings -
  60.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  61.     # These are the various battlelog settings made for skill stealing. Change
  62.     # the text and message duration for a successful skill stealing.
  63.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  64.     MSG_SKILL_STEAL = "%s 模仿了 %s 从 %s!" # Text for successful steal.
  65.     MSG_DURATION    = 4                       # Lower number = shorter duration.
  66.    
  67.     STEAL_SKILLS = {# 偷盗的目标技能ID => 实际偷到的技能ID
  68.                     # 不设置的话就直接学偷盗的目标技能
  69.                     1 => 11,
  70.                     2 => 21,
  71.                     3 => 22,
  72.                     # 自己扩展,有多少就写多少
  73.                     }

  74.   end # SKILL_STEAL
  75. end # YEA

  76. #==============================================================================
  77. # ▼ Editting anything past this point may potentially result in causing
  78. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  79. # halitosis so edit at your own risk.
  80. #==============================================================================

  81. module YEA
  82.   module REGEXP
  83.   module USABLEITEM

  84.     SKILL_STEAL     = /<(?:SKILL_STEAL|skill steal)>/i
  85.     STEALABLE_SKILL = /<(?:STEALABLE_SKILL|stealable skill)>/i

  86.   end # USABLEITEM
  87.   end # REGEXP
  88. end # YEA

  89. #==============================================================================
  90. # ■ DataManager
  91. #==============================================================================

  92. module DataManager

  93.   #--------------------------------------------------------------------------
  94.   # alias method: load_database
  95.   #--------------------------------------------------------------------------
  96.   class <<self; alias load_database_ss load_database; end
  97.   def self.load_database
  98.     load_database_ss
  99.     load_notetags_ss
  100.   end

  101.   #--------------------------------------------------------------------------
  102.   # new method: load_notetags_ss
  103.   #--------------------------------------------------------------------------
  104.   def self.load_notetags_ss
  105.     groups = [$data_skills, $data_items]
  106.     for group in groups
  107.       for obj in group
  108.         next if obj.nil?
  109.         obj.load_notetags_ss
  110.       end
  111.     end
  112.   end

  113. end # DataManager

  114. #==============================================================================
  115. # ■ RPG::UsableItem
  116. #==============================================================================

  117. class RPG::UsableItem < RPG::BaseItem

  118.   #--------------------------------------------------------------------------
  119.   # public instance variables
  120.   #--------------------------------------------------------------------------
  121.   attr_accessor :skill_steal
  122.   attr_accessor :stealable_skill

  123.   #--------------------------------------------------------------------------
  124.   # common cache: load_notetags_ss
  125.   #--------------------------------------------------------------------------
  126.   def load_notetags_ss
  127.     #---
  128.     self.note.split(/[\r\n]+/).each { |line|
  129.       case line
  130.       #---
  131.       when YEA::REGEXP::USABLEITEM::SKILL_STEAL
  132.         @skill_steal = true
  133.       when YEA::REGEXP::USABLEITEM::STEALABLE_SKILL
  134.         next unless self.is_a?(RPG::Skill)
  135.         @stealable_skill = true
  136.       #---
  137.       end
  138.     } # self.note.split
  139.     #---
  140.   end

  141. end # RPG::UsableItem

  142. #==============================================================================
  143. # ■ Game_Battler
  144. #==============================================================================

  145. class Game_Battler < Game_BattlerBase

  146.   #--------------------------------------------------------------------------
  147.   # alias method: item_user_effect
  148.   #--------------------------------------------------------------------------
  149.   alias game_battler_item_user_effect_ss item_user_effect
  150.   def item_user_effect(user, item)
  151.     game_battler_item_user_effect_ss(user, item)
  152.     item_skill_steal_effect(user, item)
  153.   end

  154.   #--------------------------------------------------------------------------
  155.   # new method: item_skill_steal_effect
  156.   #--------------------------------------------------------------------------
  157.   def item_skill_steal_effect(user, item)
  158.     return unless item.skill_steal
  159.     return unless user.actor?
  160.     return if self.actor?
  161.     for skill in stealable_skills
  162.       next if user.skill_learn?(skill)
  163.       @result.success = true
  164.       break
  165.     end
  166.   end

  167. end # Game_Battler

  168. #==============================================================================
  169. # ■ Game_Enemy
  170. #==============================================================================

  171. class Game_Enemy < Game_Battler

  172.   #--------------------------------------------------------------------------
  173.   # stealable_skills
  174.   #--------------------------------------------------------------------------
  175.   def stealable_skills
  176.     array = []
  177.     for action in enemy.actions
  178.       # 如果设置对应列表里有偷盗对应技能ID的话就代入,否则直接代入行动技能ID
  179.       steal_skill_id = YEA::SKILL_STEAL::STEAL_SKILLS[action.skill_id] || action.skill_id
  180.       skill_1 = $data_skills[action.skill_id]   # 偷盗目标技能
  181.       skill_2 = $data_skills[steal_skill_id]     # 实际偷到的技能
  182.       array.push(skill_2) if skill_1.stealable_skill
  183.     end
  184.     return array
  185.   end

  186. end # Game_Enemy

  187. #==============================================================================
  188. # ■ Scene_Battle
  189. #==============================================================================

  190. class Scene_Battle < Scene_Base

  191.   #--------------------------------------------------------------------------
  192.   # alias method: apply_item_effects
  193.   #--------------------------------------------------------------------------
  194.   alias scene_battle_apply_item_effects_ss apply_item_effects
  195.   def apply_item_effects(target, item)
  196.     scene_battle_apply_item_effects_ss(target, item)
  197.     apply_skill_steal(target, item)
  198.   end

  199.   #--------------------------------------------------------------------------
  200.   # new method: apply_skill_steal
  201.   #--------------------------------------------------------------------------
  202.   def apply_skill_steal(target, item)
  203.     return unless item.skill_steal
  204.     return if target.actor?
  205.     return unless @subject.actor?
  206.     for skill in target.stealable_skills
  207.       next if @subject.skill_learn?(skill)
  208.       @subject.learn_skill(skill.id)
  209.       string = YEA::SKILL_STEAL::MSG_SKILL_STEAL
  210.       skill_text = sprintf("\\i[%d]%s", skill.icon_index, skill.name)
  211.       text = sprintf(string, @subject.name, skill_text, target.name)
  212.       @log_window.add_text(text)
  213.       YEA::SKILL_STEAL::MSG_DURATION.times do @log_window.wait end
  214.       @log_window.back_one
  215.     end
  216.   end

  217. end # Scene_Battle

  218. #==============================================================================
  219. #
  220. # ▼ End of File
  221. #
  222. #==============================================================================
复制代码

评分

参与人数 1梦石 +1 收起 理由
VIPArcher + 1 认可答案

查看全部评分

回复

使用道具 举报

梦石
0
星屑
254
在线时间
316 小时
注册时间
2015-7-2
回帖
1629

开拓者

 楼主| 发表于 2016-1-22 00:03:24 | 显示全部楼层
cinderelmini 发表于 2016-1-21 20:34
在【module SKILL_STEAL】里面添加了个哈希表做技能对应,
然后在【Game_Enemy】里面调整了偷盗的技能ID获 ...

4.png
启动游戏时报错
测试你的东方project认知程度?那就来玩[url=https://store.steampowered.com/app/930840/TouHouAsked/]《东方百问》[/url]吧!
东方风自作曲认知企划绝赞咕咕咕中
回复

使用道具 举报

梦石
0
星屑
9726
在线时间
2775 小时
注册时间
2008-9-5
回帖
3458

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

发表于 2016-1-22 19:53:06 | 显示全部楼层
落雪鸦杀 发表于 2016-1-22 00:03
启动游戏时报错

【module YEA::SKILL_STEAL::STEAL_SKILLS】》【module YEA】
后面那段忘记删掉了…………

点评

多谢!  发表于 2016-1-22 22:51
回复

使用道具 举报

梦石
0
星屑
9726
在线时间
2775 小时
注册时间
2008-9-5
回帖
3458

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

发表于 2016-1-22 19:53:28 | 显示全部楼层
落雪鸦杀 发表于 2016-1-22 00:03
启动游戏时报错

【module YEA::SKILL_STEAL::STEAL_SKILLS】》【module YEA】
后面那段忘记删掉了…………

点评

手残hhhhhh  发表于 2016-1-23 14:20
卧槽……岂可修……肿么就连楼了…………  发表于 2016-1-23 14:10
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部