RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Dual Wield Separate Attacks by Lytanathan

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 82
Living proof that paradoxes exist in reality.
Dual Wield Separate Attacks
Version: 1.0
Author: Lytanathan
Date: May 25, 2012

Version History


  • <Version 1.0> 2012.05.25 - Original Release

Planned Future Versions

  • <Version 1.1> Compatibility with various weapon formula changing scripts

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

  • Attack once using each weapon equipped, one at a time.
  • This prevents weapons with different attributes from sharing attributes with each other (like elemental attributes, improved accuracy, critical rates, states added, etc.
  • It also gives you multiple chances for critical hits, states applied, etc., as long as each weapon has a chance for those things. (An Iron sword and a Sleep sword would only have a chance of inflicting Sleep once, but both could result in a critical hit)

Instructions

  • Insert above Main.
  • Place any skills that are attack skills inside the array ATTACK_SKILL_IDS. That is all.

Script


Code: [Select]
#==============================================================================
#
# 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


  • Lytanathan

Thanks

  • Final Fantasy 6, Tactics, and possibly some others for inspiring the script.

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.
« Last Edit: September 22, 2012, 05:43:43 PM by modern algebra »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
It sounds neat. Sorry for the delayed response, but I've been away. I will look at your code sometime.