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

Project1

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

[已经解决] 武器普通攻击

[复制链接]

Lv1.梦旅人

梦石
0
星屑
55
在线时间
148 小时
注册时间
2013-11-9
帖子
20
跳转到指定楼层
1
发表于 2014-7-27 16:30:08 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

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

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

x
想请教一下,一般战斗时普通攻击是按造角色的物理攻击来做伤害

有没有办法把一种武器类型的普通攻击改成吃魔法攻击系数而不是物理

其余武器类型依旧是按造物理攻击来做伤害

例如武器类型斧头的普通攻击伤害是依造物理攻击系数,魔法长枪的普通攻击伤害改成依造魔法攻击系数这样

Lv1.梦旅人

梦石
0
星屑
50
在线时间
444 小时
注册时间
2011-1-3
帖子
151

开拓者

3
发表于 2014-7-27 16:43:32 | 只看该作者
你需要这个。
在技能库里设置一个新的技能,伤害计算方式自己设定。
然后在武器备注栏填上<attack skill: x>   X指的是技能库里的技能ID。填上你设定的新技能就可以让装备该武器的人物
普通攻击会变为该技能效果。
此脚本和taroxd的被动技能,tomoaky的RGSS3_パッシブスキル脚本冲突。
RUBY 代码复制
  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.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-WeaponAttackReplace"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2011.12.19 - Added notetags for Actors, and Classes.
  17. # 2011.12.17 - Started Script and Finished.
  18. #
  19. #==============================================================================
  20. # ▼ Introduction
  21. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22. # By default, RPG Maker VX Ace sets all normal attacks to call upon Skill #1
  23. # to do all of the basic attack functions. While this is a great idea, it also
  24. # meant that all weapons would share the same basic attack damage formula and
  25. # effects. With this script, you can set different weapon types to use any
  26. # skill for its basic attack.
  27. #
  28. #==============================================================================
  29. # ▼ Instructions
  30. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  31. # To install this script, open up your script editor and copy/paste this script
  32. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  33. #
  34. # -----------------------------------------------------------------------------
  35. # Actor Notetags - These notetags go in the actors notebox in the database.
  36. # -----------------------------------------------------------------------------
  37. # <attack skill: x>
  38. # This sets the actor's default attack (if no weapon is equipped) to be x. The
  39. # actor's custom attack skill will take priority over a class's custom attack
  40. # skill, which will take priority over the default attack skill (skill #1).
  41. #
  42. # -----------------------------------------------------------------------------
  43. # Class Notetags - These notetags go in the class notebox in the database.
  44. # -----------------------------------------------------------------------------
  45. # <attack skill: x>
  46. # This sets the class's default attack (if no weapon is equipped) to be x. An
  47. # actor's custom attack skill will take priority over the class's custom attack
  48. # skill, which will take priority over the default attack skill (skill #1).
  49. #
  50. # -----------------------------------------------------------------------------
  51. # Weapon Notetags - These notetags go in the weapons notebox in the database.
  52. # -----------------------------------------------------------------------------
  53. # <attack skill: x>
  54. # This sets the worn weapon's attack skill to x. Note that if an actor is dual
  55. # wielding, the attack skill of the first weapon will take priority over the
  56. # second weapon.
  57. #
  58. #==============================================================================
  59. # ▼ Compatibility
  60. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  61. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  62. # it will run with RPG Maker VX without adjusting.
  63. #
  64. # For maximum compatibility with YEA - Ace Battle Engine, place this script
  65. # below Ace Battle Engine in the script listing.
  66. #
  67. #==============================================================================
  68.  
  69. module YEA
  70.   module WEAPON_ATTACK_REPLACE
  71.  
  72.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  73.     # - Basic Settings -
  74.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  75.     # If for whatever reason, you wish to change the default attack skill to
  76.     # something other than one, change the constant below.
  77.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  78.     DEFAULT_ATTACK_SKILL_ID = 1
  79.  
  80.   end # WEAPON_ATTACK_REPLACE
  81. end # YEA
  82.  
  83. #==============================================================================
  84. # ▼ Editting anything past this point may potentially result in causing
  85. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  86. # halitosis so edit at your own risk.
  87. #==============================================================================
  88.  
  89. module YEA
  90.   module REGEXP
  91.   module BASEITEM
  92.  
  93.     ATTACK_SKILL = /<(?:ATTACK_SKILL|attack skill):[ ](\d+)>/i
  94.  
  95.   end # BASEITEM
  96.   module WEAPON
  97.  
  98.     ATTACK_SKILL = /<(?:ATTACK_SKILL|attack skill):[ ](\d+)>/i
  99.  
  100.   end # WEAPON
  101.   end # REGEXP
  102. end # YEA
  103.  
  104. #==============================================================================
  105. # ■ DataManager
  106. #==============================================================================
  107.  
  108. module DataManager
  109.  
  110.   #--------------------------------------------------------------------------
  111.   # alias method: load_database
  112.   #--------------------------------------------------------------------------
  113.   class <<self; alias load_database_war load_database; end
  114.   def self.load_database
  115.     load_database_war
  116.     load_notetags_war
  117.   end
  118.  
  119.   #--------------------------------------------------------------------------
  120.   # new method: load_notetags_war
  121.   #--------------------------------------------------------------------------
  122.   def self.load_notetags_war
  123.     groups = [$data_actors, $data_classes, $data_weapons]
  124.     for group in groups
  125.       for obj in group
  126.         next if obj.nil?
  127.         obj.load_notetags_war
  128.       end
  129.     end
  130.   end
  131.  
  132. end # DataManager
  133.  
  134. #==============================================================================
  135. # ■ RPG::BaseItem
  136. #==============================================================================
  137.  
  138. class RPG::BaseItem
  139.  
  140.   #--------------------------------------------------------------------------
  141.   # public instance variables
  142.   #--------------------------------------------------------------------------
  143.   attr_accessor :attack_skill
  144.  
  145.   #--------------------------------------------------------------------------
  146.   # common cache: load_notetags_war
  147.   #--------------------------------------------------------------------------
  148.   def load_notetags_war
  149.     @attack_skill = nil
  150.     #---
  151.     self.note.split(/[\r\n]+/).each { |line|
  152.       case line
  153.       #---
  154.       when YEA::REGEXP::BASEITEM::ATTACK_SKILL
  155.         @attack_skill = $1.to_i
  156.       #---
  157.       end
  158.     } # self.note.split
  159.     #---
  160.     return if self.is_a?(RPG::Actor)
  161.     return unless @attack_skill.nil?
  162.     @attack_skill = YEA::WEAPON_ATTACK_REPLACE::DEFAULT_ATTACK_SKILL_ID
  163.   end
  164.  
  165. end # RPG::BaseItem
  166.  
  167. #==============================================================================
  168. # ■ RPG::Weapon
  169. #==============================================================================
  170.  
  171. class RPG::Weapon < RPG::EquipItem
  172.  
  173.   #--------------------------------------------------------------------------
  174.   # public instance variables
  175.   #--------------------------------------------------------------------------
  176.   attr_accessor :attack_skill
  177.  
  178.   #--------------------------------------------------------------------------
  179.   # common cache: load_notetags_war
  180.   #--------------------------------------------------------------------------
  181.   def load_notetags_war
  182.     @attack_skill = YEA::WEAPON_ATTACK_REPLACE::DEFAULT_ATTACK_SKILL_ID
  183.     #---
  184.     self.note.split(/[\r\n]+/).each { |line|
  185.       case line
  186.       #---
  187.       when YEA::REGEXP::WEAPON::ATTACK_SKILL
  188.         @attack_skill = $1.to_i
  189.       #---
  190.       end
  191.     } # self.note.split
  192.     #---
  193.   end
  194.  
  195. end # RPG::Weapon
  196.  
  197. #==============================================================================
  198. # ■ Game_BattlerBase
  199. #==============================================================================
  200.  
  201. class Game_BattlerBase
  202.  
  203.   #--------------------------------------------------------------------------
  204.   # overwrite method: attack_skill_id
  205.   #--------------------------------------------------------------------------
  206.   def attack_skill_id
  207.     return weapon_attack_skill_id if actor?
  208.     return YEA::WEAPON_ATTACK_REPLACE::DEFAULT_ATTACK_SKILL_ID
  209.   end
  210.  
  211. end # Game_BattlerBase
  212.  
  213. #==============================================================================
  214. # ■ Game_Actor
  215. #==============================================================================
  216.  
  217. class Game_Actor < Game_Battler
  218.  
  219.   #--------------------------------------------------------------------------
  220.   # new method: weapon_attack_skill_id
  221.   #--------------------------------------------------------------------------
  222.   def weapon_attack_skill_id
  223.     for weapon in weapons
  224.       next if weapon.nil?
  225.       return weapon.attack_skill
  226.     end
  227.     return self.actor.attack_skill unless self.actor.attack_skill.nil?
  228.     return self.class.attack_skill
  229.   end
  230.  
  231. end # Game_Actor
  232.  
  233. #==============================================================================
  234. # ■ Scene_Battle
  235. #==============================================================================
  236.  
  237. class Scene_Battle < Scene_Base
  238.  
  239.   #--------------------------------------------------------------------------
  240.   # new method: command_use_skill
  241.   #--------------------------------------------------------------------------
  242.   def command_attack
  243.     [url=home.php?mod=space&uid=260100]@skill[/url] = $data_skills[BattleManager.actor.attack_skill_id]
  244.     BattleManager.actor.input.set_skill(@skill.id)
  245.     if $imported["YEA-BattleEngine"]
  246.       status_redraw_target(BattleManager.actor)
  247.       $game_temp.battle_aid = @skill
  248.       if @skill.for_opponent?
  249.         select_enemy_selection
  250.       elsif @skill.for_friend?
  251.         select_actor_selection
  252.       else
  253.         next_command
  254.         $game_temp.battle_aid = nil
  255.       end
  256.     else
  257.       if !@skill.need_selection?
  258.         next_command
  259.       elsif @skill.for_opponent?
  260.         select_enemy_selection
  261.       else
  262.         select_actor_selection
  263.       end
  264.     end
  265.   end
  266.  
  267.   #--------------------------------------------------------------------------
  268.   # alias method: on_actor_cancel
  269.   #--------------------------------------------------------------------------
  270.   alias scene_battle_on_actor_cancel_war on_actor_cancel
  271.   def on_actor_cancel
  272.     scene_battle_on_actor_cancel_war
  273.     case @actor_command_window.current_symbol
  274.     when :attack
  275.       @help_window.hide
  276.       @status_window.show
  277.       @actor_command_window.activate
  278.       status_redraw_target(BattleManager.actor)
  279.     end
  280.   end
  281.  
  282.   #--------------------------------------------------------------------------
  283.   # alias method: on_enemy_cancel
  284.   #--------------------------------------------------------------------------
  285.   alias scene_battle_on_enemy_cancel_war on_enemy_cancel
  286.   def on_enemy_cancel
  287.     scene_battle_on_enemy_cancel_war
  288.     case @actor_command_window.current_symbol
  289.     when :attack
  290.       @help_window.hide
  291.       @status_window.show
  292.       @actor_command_window.activate
  293.       status_redraw_target(BattleManager.actor)
  294.     end
  295.   end
  296.  
  297.   #--------------------------------------------------------------------------
  298.   # new method: status_redraw_target
  299.   #--------------------------------------------------------------------------
  300.   def status_redraw_target(target)
  301.     return unless target.actor?
  302.     @status_window.draw_item($game_party.battle_members.index(target))
  303.   end
  304.  
  305. end # Scene_Battle
  306.  
  307. #==============================================================================
  308. #
  309. # ▼ End of File
  310. #
  311. #==============================================================================

点评

我没看到哪儿撞了……算了  发表于 2014-7-27 17:16
@taroxd 有的,使用该脚本后在使用或者tomoaky写的被动技能脚本。会导致Yanfly的脚本失效。  发表于 2014-7-27 17:10
我没看出冲突的说……  发表于 2014-7-27 16:51
神速!感谢大触帮忙。  发表于 2014-7-27 16:46

评分

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

查看全部评分

回复 支持 反对

使用道具 举报

Lv3.寻梦者 (版主)

…あたしは天使なんかじゃないわ

梦石
0
星屑
2208
在线时间
4033 小时
注册时间
2010-10-4
帖子
10779

开拓者贵宾

2
发表于 2014-7-27 16:37:07 | 只看该作者
https://rpg.blue/thread-365973-1-1.html

注意群组的置顶 && 公告哦~ 不然报错别怪我哦~

点评

↓ VIP是说他差点重复回答了= =  发表于 2014-7-27 16:57
不好意思,下次会多注意一点。  发表于 2014-7-27 16:45
差点又追尾~  发表于 2014-7-27 16:38

评分

参与人数 1星屑 +100 收起 理由
VIPArcher + 100 我很赞同

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-28 08:58

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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