查看: 3230|回复: 2

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

[复制链接]
梦石
0
星屑
55
在线时间
148 小时
注册时间
2013-11-9
回帖
14
发表于 2014-7-27 16:30:08 | 显示全部楼层 |阅读模式

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

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

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

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

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

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

…あたしは天

梦石
0
星屑
2308
在线时间
4033 小时
注册时间
2010-10-4
回帖
10548

开拓者贵宾

发表于 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 我很赞同

查看全部评分

回复

使用道具 举报

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

开拓者

发表于 2014-7-27 16:43:32 | 显示全部楼层
你需要这个。
在技能库里设置一个新的技能,伤害计算方式自己设定。
然后在武器备注栏填上<attack skill: x>   X指的是技能库里的技能ID。填上你设定的新技能就可以让装备该武器的人物
普通攻击会变为该技能效果。
此脚本和taroxd的被动技能,tomoaky的RGSS3_パッシブスキル脚本冲突。
[pre lang="ruby" line="1"]#==============================================================================
#
# ▼ Yanfly Engine Ace - Weapon Attack Replace v1.01
# -- Last Updated: 2011.12.19
# -- Level: Normal
# -- Requires: n/a
#
#==============================================================================

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

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2011.12.19 - Added notetags for Actors, and Classes.
# 2011.12.17 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# By default, RPG Maker VX Ace sets all normal attacks to call upon Skill #1
# to do all of the basic attack functions. While this is a great idea, it also
# meant that all weapons would share the same basic attack damage formula and
# effects. With this script, you can set different weapon types to use any
# skill for its basic attack.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Actor Notetags - These notetags go in the actors notebox in the database.
# -----------------------------------------------------------------------------
# <attack skill: x>
# This sets the actor's default attack (if no weapon is equipped) to be x. The
# actor's custom attack skill will take priority over a class's custom attack
# skill, which will take priority over the default attack skill (skill #1).
#
# -----------------------------------------------------------------------------
# Class Notetags - These notetags go in the class notebox in the database.
# -----------------------------------------------------------------------------
# <attack skill: x>
# This sets the class's default attack (if no weapon is equipped) to be x. An
# actor's custom attack skill will take priority over the class's custom attack
# skill, which will take priority over the default attack skill (skill #1).
#
# -----------------------------------------------------------------------------
# Weapon Notetags - These notetags go in the weapons notebox in the database.
# -----------------------------------------------------------------------------
# <attack skill: x>
# This sets the worn weapon's attack skill to x. Note that if an actor is dual
# wielding, the attack skill of the first weapon will take priority over the
# second weapon.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
# For maximum compatibility with YEA - Ace Battle Engine, place this script
# below Ace Battle Engine in the script listing.
#
#==============================================================================

module YEA
  module WEAPON_ATTACK_REPLACE
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Basic Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # If for whatever reason, you wish to change the default attack skill to
    # something other than one, change the constant below.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    DEFAULT_ATTACK_SKILL_ID = 1
   
  end # WEAPON_ATTACK_REPLACE
end # YEA

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

module YEA
  module REGEXP
  module BASEITEM
   
    ATTACK_SKILL = /<(?:ATTACK_SKILL|attack skill):[ ](\d+)>/i
   
  end # BASEITEM
  module WEAPON
   
    ATTACK_SKILL = /<(?:ATTACK_SKILL|attack skill):[ ](\d+)>/i
   
  end # WEAPON
  end # REGEXP
end # YEA

#==============================================================================
# ■ DataManager
#==============================================================================

module DataManager
  
  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  class <<self; alias load_database_war load_database; end
  def self.load_database
    load_database_war
    load_notetags_war
  end
  
  #--------------------------------------------------------------------------
  # new method: load_notetags_war
  #--------------------------------------------------------------------------
  def self.load_notetags_war
    groups = [$data_actors, $data_classes, $data_weapons]
    for group in groups
      for obj in group
        next if obj.nil?
        obj.load_notetags_war
      end
    end
  end
  
end # DataManager

#==============================================================================
# ■ RPG::BaseItem
#==============================================================================

class RPG::BaseItem
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :attack_skill
  
  #--------------------------------------------------------------------------
  # common cache: load_notetags_war
  #--------------------------------------------------------------------------
  def load_notetags_war
    @attack_skill = nil
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when YEA::REGEXP::BASEITEM::ATTACK_SKILL
        @attack_skill = $1.to_i
      #---
      end
    } # self.note.split
    #---
    return if self.is_a?(RPG::Actor)
    return unless @attack_skill.nil?
    @attack_skill = YEA::WEAPON_ATTACK_REPLACE::DEFAULT_ATTACK_SKILL_ID
  end
  
end # RPG::BaseItem

#==============================================================================
# ■ RPG::Weapon
#==============================================================================

class RPG::Weapon < RPG::EquipItem
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :attack_skill
  
  #--------------------------------------------------------------------------
  # common cache: load_notetags_war
  #--------------------------------------------------------------------------
  def load_notetags_war
    @attack_skill = YEA::WEAPON_ATTACK_REPLACE::DEFAULT_ATTACK_SKILL_ID
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when YEA::REGEXP::WEAPON::ATTACK_SKILL
        @attack_skill = $1.to_i
      #---
      end
    } # self.note.split
    #---
  end
  
end # RPG::Weapon

#==============================================================================
# ■ Game_BattlerBase
#==============================================================================

class Game_BattlerBase
  
  #--------------------------------------------------------------------------
  # overwrite method: attack_skill_id
  #--------------------------------------------------------------------------
  def attack_skill_id
    return weapon_attack_skill_id if actor?
    return YEA::WEAPON_ATTACK_REPLACE::DEFAULT_ATTACK_SKILL_ID
  end
  
end # Game_BattlerBase

#==============================================================================
# ■ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  
  #--------------------------------------------------------------------------
  # new method: weapon_attack_skill_id
  #--------------------------------------------------------------------------
  def weapon_attack_skill_id
    for weapon in weapons
      next if weapon.nil?
      return weapon.attack_skill
    end
    return self.actor.attack_skill unless self.actor.attack_skill.nil?
    return self.class.attack_skill
  end
  
end # Game_Actor

#==============================================================================
# ■ Scene_Battle
#==============================================================================

class Scene_Battle < Scene_Base
  
  #--------------------------------------------------------------------------
  # new method: command_use_skill
  #--------------------------------------------------------------------------
  def command_attack
    @skill = $data_skills[BattleManager.actor.attack_skill_id]
    BattleManager.actor.input.set_skill(@skill.id)
    if $imported["YEA-BattleEngine"]
      status_redraw_target(BattleManager.actor)
      $game_temp.battle_aid = @skill
      if @skill.for_opponent?
        select_enemy_selection
      elsif @skill.for_friend?
        select_actor_selection
      else
        next_command
        $game_temp.battle_aid = nil
      end
    else
      if !@skill.need_selection?
        next_command
      elsif @skill.for_opponent?
        select_enemy_selection
      else
        select_actor_selection
      end
    end
  end
  
  #--------------------------------------------------------------------------
  # alias method: on_actor_cancel
  #--------------------------------------------------------------------------
  alias scene_battle_on_actor_cancel_war on_actor_cancel
  def on_actor_cancel
    scene_battle_on_actor_cancel_war
    case @actor_command_window.current_symbol
    when :attack
      @help_window.hide
      @status_window.show
      @actor_command_window.activate
      status_redraw_target(BattleManager.actor)
    end
  end
  
  #--------------------------------------------------------------------------
  # alias method: on_enemy_cancel
  #--------------------------------------------------------------------------
  alias scene_battle_on_enemy_cancel_war on_enemy_cancel
  def on_enemy_cancel
    scene_battle_on_enemy_cancel_war
    case @actor_command_window.current_symbol
    when :attack
      @help_window.hide
      @status_window.show
      @actor_command_window.activate
      status_redraw_target(BattleManager.actor)
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: status_redraw_target
  #--------------------------------------------------------------------------
  def status_redraw_target(target)
    return unless target.actor?
    @status_window.draw_item($game_party.battle_members.index(target))
  end
  
end # Scene_Battle

#==============================================================================
#
# ▼ End of File
#
#==============================================================================[/pre]

点评

我没看到哪儿撞了……算了  发表于 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 认可答案

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部