Project1

标题: RMVA攻擊時消耗物品 [打印本页]

作者: A66018299    时间: 2012-8-20 17:57
标题: RMVA攻擊時消耗物品
本帖最后由 A66018299 于 2012-8-22 09:52 编辑

有看過VX 跟 XP的 就是沒有ACE的 =w=
所以我想發問(剛好自己要用的啦XD
弓箭手-
攻擊- -1
三連箭-3
...之類的
最好是可以設定多個
因為還有槍手= =或砲手
求教><
作者: fxwd    时间: 2012-8-20 19:13
http://rpg.blue/thread-226207-1-1.html,如果是攻击消耗物品,事件的话麻烦一些,脚本的话简单一些,不过感觉游戏不必这么逼真吧,这样的话玩家还得打一会就回城到武器店买弓箭,你看像那些网游,比如DNF吧,神枪打上几百抢也不费你一颗子弹,没必要这么逼真
作者: ANN244    时间: 2012-8-20 19:34
攻击消耗物品用LS说的脚本就可以
如果要在装备弓后
使用普通攻击也消耗物品
可以配搭以下脚本使用
  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.     for weapon in weapons
  209.       next if weapon.nil?
  210.       return weapon.attack_skill
  211.     end
  212.     return self.actor.attack_skill unless self.actor.attack_skill.nil?
  213.     return self.class.attack_skill
  214.   end
  215.   
  216. end # Game_Actor

  217. #==============================================================================
  218. # ■ Scene_Battle
  219. #==============================================================================

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

  289. #==============================================================================
  290. #
  291. # ▼ End of File
  292. #
  293. #==============================================================================
复制代码

作者: Password    时间: 2012-8-20 21:03
呐……把MP改成弓箭吧
作者: ANN244    时间: 2012-8-22 01:37
本帖最后由 ANN244 于 2012-8-22 02:22 编辑

VA預設資料庫的第1號技能是普通攻擊
我放的那個腳本是用來更改角色的普通攻擊使用哪一號技能的

只要再複製一次第1號技能
然後在技能資料庫新增一個空白欄位
再把剛複製的第1號技能貼上
按著在新增的那項技能的備註輸入消耗物品的指令
再在武器的備註輸入<attack skill: x>         (x是資料庫中技能的ID)

例子:

在技能資料庫中的第200號新增了一個與第1號技能相同的技能當作弓箭手的普通攻擊技能
這項技能每次使用都會消耗一支弓箭
在物品資料庫中新增了第50號物品是弓箭
然後在第200號技能的備註輸入ITEM:ID50NUM1         (代表每次使用該技能需要消耗第50號物品的數量1個)
最後在弓類武器的備註輸入<attack skill: 200>         (代表裝備此類武器時將使用技能資料庫中的第200號技能作為普通攻擊)

當身上的弓箭數量不足時,該角色連普通攻擊也不能使用

使用這個腳本時請配合以下腳本使用
http://rpg.blue/thread-226207-1-1.html
並且請將我放的那個腳本置於上面的腳本的上方
作者: A66018299    时间: 2012-8-22 09:52
ANN244 发表于 2012-8-22 01:37
VA預設資料庫的第1號技能是普通攻擊
我放的那個腳本是用來更改角色的普通攻擊使用哪一號技能的

非常謝謝您!! 我懂了!!!!!
作者: 4lnlove    时间: 2013-4-14 22:21
為何會出現脚本問題?是脚本衝突嗎?

未命名.png (61.68 KB, 下载次数: 25)

未命名.png





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1