Hime's Feature Conditions - Dual-Wielding

Script: http://himeworks.com/2013/07/feature-conditions/

I'm trying to get actors to hit twice while dual-wielding. I gave all one-handed weapons the ATK Times +1 feature, and tried creating conditions for it, but no luck with that approach so far.

I'm thinking I should be checking if "THIS" weapon is equipped in slots 0 or 1, but I don't know how to access the weapon object.

Just FYI, my weapons can be equipped in slots 0 or 1. Slot 0 isn't being duplicated, so please take that into consideration.
You can check if the user is dual wielding with this script condition:

Code:
a.dual_wield?
You can also check if the actor got a weapon equipped on a slot (any weapon):
Code:
a.equips[0].is_a?(RPG::Weapon) # For slot 0.a.equips[1].is_a?(RPG::Weapon) # For slot 1.
I guess, these checks should work for you.
I don't need to check if the user is holding a weapon, I already know how to do that. The issue is creating a condition which allows the user to hit twice if they're holding two weapons. If I were to give all weapons that can be dual-wielded a Atk Times +1 feature and use those script conditions, actors would hit 3 times instead.
I am fairly certain that there are scripts out there doing what you want (attack twice if wielding two weapons).

Here is a snippet you can try:

Spoiler
class Scene_Battle < Scene_Base alias attack_twice8875 use_item def use_item item = @subject.current_action.item times_do = 1 if @subject.is_a?(Game_Actor) && @subject.weapons.size > 1 && item.is_a?(RPG::Skill) && item.id == @subject.attack_skill_id times_do = @subject.weapons.size end times_do.times do attack_twice8875 break if @subject.current_action.make_targets.compact.all? {|trgt| trgt.dead?} end end end
This will repeat the normal attack if the actor got two or more weapons equipped. The number of repeats depends on the amount of weapons equipped.

In case the targets are all dead for the repeated attacks, the repeats will stop.

You can put this snippet at the bottom of your custom script list and test it.

Note that the animation played will be the same for all repeated attacks, and that animation is from the weapon equipped on the 1st slot.

I did not test this much, but it works so far.

But you should search for some dual wield scripts, maybe there are better alternatives out there already. I know that one of my old projects got this done with a script, I just don't know which one (I think, it is Yami's Symphony, but I guess you don't really want to use that battle engine just because of this function, right?).
Seems to override the <One Animation> notetag provided by Yanfly's Battle Engine. Works fine otherwise.

I did come up with an alternate solution, but it's probably more trouble than it's worth. I created a dual-wielding state to be applied to any actors equipped with two weapons. I already have a turn manager which runs at the beginning of each battle and once per turn, so I tried adding it this way.

#------------------------------------------------------------------------- # Dual Wielding #------------------------------------------------------------------------- if a.equips[0] && a.equips[1].is_a?(RPG::Weapon) a.add_state(72) if !a.state?(72) else a.remove_state(72) if a.state?(72) end # Dual Wielding
Spoiler
Code:
################################################################################=begin#==============================================================================#------------------------------ Turn Manager ------------------------------------#==============================================================================#By: RinobiThis script is called at the beginning of battle and once per turn there after. --------------------------------------------------------------------------------Instructions:--------------------------------------------------------------------------------Plug & Play--------------------------------------------------------------------------------List of Procs--------------------------------------------------------------------------------* Winged Barrier (Deity)Consumes 500 Mana per turn while state is active.Removes state upon insufficent Mana* Heavens Wrath (Deity)Consumes 500 Mana per turn while state is active.Removes state upon insufficent Mana* Typhoon (Warrior)Deals damage to all enemies while state is active.Plays animation 95 on actor, and 12 on enemies.* Bullet Hell (Gunner)Consumes 500 Mana per turn while state is active.Removes state upon insufficent ManaDeals damage to all enemies while state is active.Plays animation 81 on actor, and 92 on enemies.* No-Shadow (Gunner)Consumes 50 Mana per turn while state is active.Removes state upon insufficent Mana#==============================================================================#--------------------------------------------------------------------------------#==============================================================================#=end#################################################################################===============================================================================# ■ Turn Manager#===============================================================================module Turn_Manager  def self.proc_effects    #==========================================================================#    #=                      Actor Proc Effects Below                          =#    #==========================================================================#    $game_party.members.each do |a|    #==========================================================================#          #-------------------------------------------------------------------------      # Dual Wielding      #-------------------------------------------------------------------------      if a.equips[0] && a.equips[1].is_a?(RPG::Weapon)        a.add_state(72) if !a.state?(72)      else        a.remove_state(72) if a.state?(72)      end # Dual Wielding      #-------------------------------------------------------------------------      # Winged Barrier      #-------------------------------------------------------------------------      if a.state?(21)        if a.mp >= 500          $game_party.members.each {|aa| aa.add_state(20)}          dmg = 500          if $imported["YEA-BattleEngine"]            Sound.play_recovery            text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:mp_dmg], dmg.group)            a.create_popup(text, "MP_DMG")          end          a.mp -= dmg        else           a.remove_state(21)        end      end # if a.state?(21)      #-------------------------------------------------------------------------      # Heavens Wrath      #-------------------------------------------------------------------------      if a.state?(23)        if a.mp >= 500          $game_party.members.each {|aa| aa.add_state(22)}          dmg = 500          if $imported["YEA-BattleEngine"]            Sound.play_recovery            text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:mp_dmg], dmg.group)            a.create_popup(text, "MP_DMG")          end          a.mp -= dmg        else           a.remove_state(23)        end      end # Heaven's Wrath      #-------------------------------------------------------------------------      # Typhoon      #-------------------------------------------------------------------------      if a.state?(54)        $game_troop.members.each do |bb|          dmg = a.damage(a, bb, 20000, 450, 1)          rate = bb.element_rate(1) ; dmg = (rate * dmg).to_i          a.animation_id = 95 ; bb.animation_id = 12 ; 30.times { Fiber.yield }          if $imported["YEA-BattleEngine"] && dmg > 0            text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:hp_dmg], dmg.group)            bb.make_rate_popup(rate)            bb.create_popup(text, "HP_DMG")          end          bb.perform_damage_effect          bb.hp = [bb.hp - dmg, 1].max          bb.add_state(1) if bb.hp <= 1        end      end # Typhoon      #-------------------------------------------------------------------------      # Bullet Hell      #-------------------------------------------------------------------------      if a.state?(56)        if a.mp >= 500          a.mp -=500          $game_troop.members.each do |bb|            dmg = a.damage(a, bb, 4590, 200, 1)            rate = bb.element_rate(1) ; dmg = (rate * dmg).to_i            a.animation_id = 81 ; bb.animation_id = 92 ; 30.times { Fiber.yield }            if $imported["YEA-BattleEngine"] && dmg > 0              text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:hp_dmg], dmg.group)              bb.make_rate_popup(rate)              bb.create_popup(text, "HP_DMG")            end            bb.perform_damage_effect            bb.hp = [bb.hp - dmg, 1].max            bb.add_state(1) if bb.hp <= 1          end        else          a.remove_state(56)        end # Actor MP Check      end # Bullet Hell      #-------------------------------------------------------------------------      # No-Shadow      #-------------------------------------------------------------------------      if a.state?(70)        if a.mp >= 50          a.mp -= 50        else          a.remove_state(70)        end      end # No-Shadow    #==========================================================================#    end # $game_party.member.each do |a|    #==========================================================================#    #=                      Actor Proc Effects Above                          =#    #==========================================================================#  end # proc_effectsend # Turn_Manager
That's an additional state on any actor that happens to be dual wielding though. Means I would have to write in exceptions for skills that check (or rely on) the number of states on an actor, or halving the damage output of "Attack" via conditional. I'll either adapt your snipplet to better fit my project or go the state route; whichever has more options.

And yeah, trying to add another battle engine or replace the one I'm using is definitely overkill.

Original thread: https://forums.rpgmakerweb.com/threads/himes-feature-conditions-dual-wielding.50199/