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

Project1

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

[已经过期] 麻烦帮忙改一下武器替换攻击脚本的查找优先级。

[复制链接]

Lv1.梦旅人

梦石
0
星屑
140
在线时间
345 小时
注册时间
2009-5-15
帖子
111
跳转到指定楼层
1
发表于 2012-11-10 23:59:55 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
著名的武器替换攻击文本,用法是这样的。
在注释中输入  <attack skill: x> 则这把武器的普通攻击替换为技能X

用法多多,不具体介绍。

这个注释的优先级为
先查找武器注释,如果武器注释为空,则找人物ID注释,如果人物ID注释为空,再找职业ID注释。

现在想改变一下这个优先级,让它先查找职业ID 再查找武器ID

我自己弄了几次,发现改完以后,普通攻击的确优先按职业查找,但是武器的注释替换失效了,在论坛这边恳求一下达人协助,不胜感激。
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Weapon Attack Replace v1.01
  4. # -- Last Updated: 2011.12.19
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

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

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2011.12.19 - Added notetags for Actors, and Classes.
  15. # 2011.12.17 - Started Script and Finished.
  16. #
  17. #==============================================================================
  18. # ▼ Introduction
  19. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  20. # By default, RPG Maker VX Ace sets all normal attacks to call upon Skill #1
  21. # to do all of the basic attack functions. While this is a great idea, it also
  22. # meant that all weapons would share the same basic attack damage formula and
  23. # effects. With this script, you can set different weapon types to use any
  24. # skill for its basic attack.
  25. #
  26. #==============================================================================
  27. # ▼ Instructions
  28. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  29. # To install this script, open up your script editor and copy/paste this script
  30. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  31. #
  32. # -----------------------------------------------------------------------------
  33. # Actor Notetags - These notetags go in the actors notebox in the database.
  34. # -----------------------------------------------------------------------------
  35. # <attack skill: x>
  36. # This sets the actor's default attack (if no weapon is equipped) to be x. The
  37. # actor's custom attack skill will take priority over a class's custom attack
  38. # skill, which will take priority over the default attack skill (skill #1).
  39. #
  40. # -----------------------------------------------------------------------------
  41. # Class Notetags - These notetags go in the class notebox in the database.
  42. # -----------------------------------------------------------------------------
  43. # <attack skill: x>
  44. # This sets the class's default attack (if no weapon is equipped) to be x. An
  45. # actor's custom attack skill will take priority over the class's custom attack
  46. # skill, which will take priority over the default attack skill (skill #1).
  47. #
  48. # -----------------------------------------------------------------------------
  49. # Weapon Notetags - These notetags go in the weapons notebox in the database.
  50. # -----------------------------------------------------------------------------
  51. # <attack skill: x>
  52. # This sets the worn weapon's attack skill to x. Note that if an actor is dual
  53. # wielding, the attack skill of the first weapon will take priority over the
  54. # second weapon.
  55. #
  56. #==============================================================================
  57. # ▼ Compatibility
  58. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  59. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  60. # it will run with RPG Maker VX without adjusting.
  61. #
  62. # For maximum compatibility with YEA - Ace Battle Engine, place this script
  63. # below Ace Battle Engine in the script listing.
  64. #
  65. #==============================================================================

  66. module YEA
  67.   module WEAPON_ATTACK_REPLACE
  68.    
  69.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  70.     # - Basic Settings -
  71.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  72.     # If for whatever reason, you wish to change the default attack skill to
  73.     # something other than one, change the constant below.
  74.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  75.     DEFAULT_ATTACK_SKILL_ID = 1
  76.    
  77.   end # WEAPON_ATTACK_REPLACE
  78. end # YEA

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

  84. module YEA
  85.   module REGEXP
  86.   module BASEITEM
  87.    
  88.     ATTACK_SKILL = /<(?:ATTACK_SKILL|attack skill):[ ](\d+)>/i
  89.    
  90.   end # BASEITEM
  91.   module WEAPON
  92.    
  93.     ATTACK_SKILL = /<(?:ATTACK_SKILL|attack skill):[ ](\d+)>/i
  94.    
  95.   end # WEAPON
  96.   end # REGEXP
  97. end # YEA

  98. #==============================================================================
  99. # ■ DataManager
  100. #==============================================================================

  101. module DataManager
  102.   
  103.   #--------------------------------------------------------------------------
  104.   # alias method: load_database
  105.   #--------------------------------------------------------------------------
  106.   class <<self; alias load_database_war load_database; end
  107.   def self.load_database
  108.     load_database_war
  109.     load_notetags_war
  110.   end
  111.   
  112.   #--------------------------------------------------------------------------
  113.   # new method: load_notetags_war
  114.   #--------------------------------------------------------------------------
  115.   def self.load_notetags_war
  116.     groups = [$data_actors, $data_classes, $data_weapons]
  117.     for group in groups
  118.       for obj in group
  119.         next if obj.nil?
  120.         obj.load_notetags_war
  121.       end
  122.     end
  123.   end
  124.   
  125. end # DataManager

  126. #==============================================================================
  127. # ■ RPG::BaseItem
  128. #==============================================================================

  129. class RPG::BaseItem
  130.   
  131.   #--------------------------------------------------------------------------
  132.   # public instance variables
  133.   #--------------------------------------------------------------------------
  134.   attr_accessor :attack_skill
  135.   
  136.   #--------------------------------------------------------------------------
  137.   # common cache: load_notetags_war
  138.   #--------------------------------------------------------------------------
  139.   def load_notetags_war
  140.     @attack_skill = nil
  141.     #---
  142.     self.note.split(/[\r\n]+/).each { |line|
  143.       case line
  144.       #---
  145.       when YEA::REGEXP::BASEITEM::ATTACK_SKILL
  146.         @attack_skill = $1.to_i
  147.       #---
  148.       end
  149.     } # self.note.split
  150.     #---
  151.     return if self.is_a?(RPG::Actor)
  152.     return unless @attack_skill.nil?
  153.     @attack_skill = YEA::WEAPON_ATTACK_REPLACE::DEFAULT_ATTACK_SKILL_ID
  154.   end
  155.   
  156. end # RPG::BaseItem

  157. #==============================================================================
  158. # ■ RPG::Weapon
  159. #==============================================================================

  160. class RPG::Weapon < RPG::EquipItem
  161.   
  162.   #--------------------------------------------------------------------------
  163.   # public instance variables
  164.   #--------------------------------------------------------------------------
  165.   attr_accessor :attack_skill
  166.   
  167.   #--------------------------------------------------------------------------
  168.   # common cache: load_notetags_war
  169.   #--------------------------------------------------------------------------
  170.   def load_notetags_war
  171.     @attack_skill = YEA::WEAPON_ATTACK_REPLACE::DEFAULT_ATTACK_SKILL_ID
  172.     #---
  173.     self.note.split(/[\r\n]+/).each { |line|
  174.       case line
  175.       #---
  176.       when YEA::REGEXP::WEAPON::ATTACK_SKILL
  177.         @attack_skill = $1.to_i
  178.       #---
  179.       end
  180.     } # self.note.split
  181.     #---
  182.   end
  183.   
  184. end # RPG::Weapon

  185. #==============================================================================
  186. # ■ Game_BattlerBase
  187. #==============================================================================

  188. class Game_BattlerBase
  189.   
  190.   #--------------------------------------------------------------------------
  191.   # overwrite method: attack_skill_id
  192.   #--------------------------------------------------------------------------
  193.   def attack_skill_id
  194.     return weapon_attack_skill_id if actor?
  195.     return YEA::WEAPON_ATTACK_REPLACE::DEFAULT_ATTACK_SKILL_ID
  196.   end
  197.   
  198. end # Game_BattlerBase

  199. #==============================================================================
  200. # ■ Game_Actor
  201. #==============================================================================

  202. class Game_Actor < Game_Battler
  203.   
  204.   #--------------------------------------------------------------------------
  205.   # new method: weapon_attack_skill_id
  206.   #--------------------------------------------------------------------------

  207.   def weapon_attack_skill_id
  208.    
  209.    
  210.     for weapon in weapons
  211.       next if weapon.nil?
  212.       return weapon.attack_skill
  213.     end
  214.     return self.actor.attack_skill unless self.actor.attack_skill.nil?
  215.     return self.class.attack_skill
  216.   end
  217.   
  218.   
  219. =begin  

  220.     for weapon in weapons
  221.       next if weapon.nil?
  222.       return weapon.attack_skill
  223.     end
  224.     return self.actor.attack_skill unless self.actor.attack_skill.nil?
  225.     return self.class.attack_skill
  226.   end

  227.   
  228. =end  
  229.   
  230. end # Game_Actor

  231. #==============================================================================
  232. # ■ Scene_Battle
  233. #==============================================================================

  234. class Scene_Battle < Scene_Base
  235.   
  236.   #--------------------------------------------------------------------------
  237.   # new method: command_use_skill
  238.   #--------------------------------------------------------------------------
  239.   def command_attack
  240.     @skill = $data_skills[BattleManager.actor.attack_skill_id]
  241.     BattleManager.actor.input.set_skill(@skill.id)
  242.     if $imported["YEA-BattleEngine"]
  243.       status_redraw_target(BattleManager.actor)
  244.       $game_temp.battle_aid = @skill
  245.       if @skill.for_opponent?
  246.         select_enemy_selection
  247.       elsif @skill.for_friend?
  248.         select_actor_selection
  249.       else
  250.         next_command
  251.         $game_temp.battle_aid = nil
  252.       end
  253.     else
  254.       if [email protected]_selection?
  255.         next_command
  256.       elsif @skill.for_opponent?
  257.         select_enemy_selection
  258.       else
  259.         select_actor_selection
  260.       end
  261.     end
  262.   end
  263.   
  264.   #--------------------------------------------------------------------------
  265.   # alias method: on_actor_cancel
  266.   #--------------------------------------------------------------------------
  267.   alias scene_battle_on_actor_cancel_war on_actor_cancel
  268.   def on_actor_cancel
  269.     scene_battle_on_actor_cancel_war
  270.     case @actor_command_window.current_symbol
  271.     when :attack
  272.       @help_window.hide
  273.       @status_window.show
  274.       @actor_command_window.activate
  275.       status_redraw_target(BattleManager.actor)
  276.     end
  277.   end
  278.   
  279.   #--------------------------------------------------------------------------
  280.   # alias method: on_enemy_cancel
  281.   #--------------------------------------------------------------------------
  282.   alias scene_battle_on_enemy_cancel_war on_enemy_cancel
  283.   def on_enemy_cancel
  284.     scene_battle_on_enemy_cancel_war
  285.     case @actor_command_window.current_symbol
  286.     when :attack
  287.       @help_window.hide
  288.       @status_window.show
  289.       @actor_command_window.activate
  290.       status_redraw_target(BattleManager.actor)
  291.     end
  292.   end
  293.   
  294.   #--------------------------------------------------------------------------
  295.   # new method: status_redraw_target
  296.   #--------------------------------------------------------------------------
  297.   def status_redraw_target(target)
  298.     return unless target.actor?
  299.     @status_window.draw_item($game_party.battle_members.index(target))
  300.   end
  301.   
  302. end # Scene_Battle

  303. #==============================================================================
  304. #
  305. # ▼ End of File
  306. #
  307. #==============================================================================
复制代码
敌人自动排列系统    1/1
技能类型着色   1/1
物品着色     0/1
仿网游强化系统    0/1
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-5-7 18:04

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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