The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX Ace => VXA Scripts Database => Topic started by: Lytanathan on May 25, 2012, 09:07:08 PM

Title: Dual Wield Separate Attacks by Lytanathan
Post by: Lytanathan on May 25, 2012, 09:07:08 PM
Dual Wield Separate Attacks
Version: 1.0
Author: Lytanathan
Date: May 25, 2012

Version History




Planned Future Versions


Description



When a character is wielding more than one weapon, perform an attack for each weapon equipped, using only that stats of that weapon and not the others.
Features


Instructions


Script




#==============================================================================
#
# Dual Wield Separate Attacks by Lytanathan
#
# When a character is wielding more than one weapon, perform an attack for
# each weapon equipped, using only that stats of that weapon and not the
# others.
#
# Instructions: Place any skills that are attack skills inside the array
#               ATTACK_SKILL_IDS found below. That is all.
#
# Is (as far as I can tell) compatible with Yanfly's Ace Equip Engine.
#
# So far, partially compatible with Yanfly's and Victor Sant's scripts for
# changing the attack formula of the equipped weapon. (Or rather, those scripts
# work as they are supposed to, but both weapons end up using the same formula.
# If both weapons HAVE the same formula then it everything is good, but if not
# then the slot 1 weapon's formula overrides the slot 2 formula)
# I am working on this, but I am not a very good scripter and I am not very
# confident I will be able to fix it. It took me nearly 24 total hours of coding
# just to come up with the single function you see below here.
#
#==============================================================================

#==============================================================================
#+-----------------------------------------------------------------------------
#| BEGIN EDITABLE REGION
#+-----------------------------------------------------------------------------
#==============================================================================
module LytBase
  ATTACK_SKILL_IDS = [1]
end
#==============================================================================
#+-----------------------------------------------------------------------------
#| END EDITABLE REGION
#+-----------------------------------------------------------------------------
#==============================================================================
class Scene_Battle
 
  alias lyt_dwsa_apply_item_effects apply_item_effects
  def apply_item_effects(target, item)
   
    #If attacker is an actor
    if @subject.is_a?(Game_Actor) && LytBase::ATTACK_SKILL_IDS.include?(item.id)
      #Remember equipped weapons
      weapon_list = @subject.weapons
         
      for current_weapon in 0..weapon_list.size-1

        #Remove weapons not being used to attack       
        for weapon in 0..weapon_list.size-1
          if weapon != current_weapon
            @subject.change_equip(weapon, nil)
          end
        end
       
        #Perform attack

        lyt_dwsa_apply_item_effects(target, item)

        #Replace weapons not being used to attack
        for weapon in 0..weapon_list.size-1
          @subject.change_equip(weapon, weapon_list[weapon])
        end
      end
   
    #If attacker is not an actor 
    else
      lyt_dwsa_apply_item_effects(target, item)
    end
  end 


Credit




Thanks


Support



You can contact me on this forum, but don't expect me to be much help. I am not a good scripter, and will likely not be able to do much. But I will try my best if you're stuck.

Known Compatibility Issues

Technically partially works with both Yanfly's Weapon Attack Replace and Victor Sant's Custom Basic Actions scripts, except that it uses the slot 1 weapon attack skill for all of a character's equipped weapons, even if they use different ones. Which, unfortunately, was half of what I wanted to fix by making this to begin with.

Author's Notes



Inspired by the Final Fantasy series, or at least 6 and Tactics, where if a character is
dual wielding they actually do get two separate attacks with each weapon.

Terms of Use



Please do not claim as your own, or post on any other websites without my permission. Other than that, I don't really care if I am credited or not, whether you use my script commercially or otherwise. If, however, you modify it to fix one of the issues I listed above or any other issues, please let me know so I may improve the original.
Title: Re: Dual Wield Separate Attacks by Lytanathan
Post by: modern algebra on July 17, 2012, 03:49:58 PM
It sounds neat. Sorry for the delayed response, but I've been away. I will look at your code sometime.