Jump to content
Sign in to follow this  
Jolt Android

Dual Wield Seperate Attacks: features (elemental, status, etc.)

Recommended Posts

Good day/evening/night, depending on where in the world you are :)

 

I'm using a script that when a character is wielding more than one weapon, that a separate attack is performed for each weapon. The script works mostly as it's supposed to, but there's one big limitation, and that is the second weapon has the same features as the first (same attack element, status effects applied, etc.)

 

For example, the hand 1 weapon can poison, the hand 2 weapon cannot. With this script, both weapons end up being able to poison. Same with say, weapon 1 is water elemental, weapon 2 is fire. When striking, both weapons end up being water elemental.

 

If anyone could look into this, it'd be great. I think the solution is fairly simple, but I'm too simple to figure it out.

Thanks.

 

 

 

#==============================================================================
#
# 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,155,156,157,159,170,171,548,549]
end
#==============================================================================
#+-----------------------------------------------------------------------------
#| END EDITABLE REGION
#+-----------------------------------------------------------------------------
#==============================================================================
class Scene_Battle < Scene_Base
  alias :apply_item_effects_lyt :apply_item_effects
  def apply_item_effects(target, item)
    #If attacker is an actor and dual_wield
    if @subject.dual_wield? && @subject.is_a?(Game_Actor) && LytBase::ATTACK_SKILL_IDS.include?(item.id)
      #Remember equipped weapons
      
      $weap = 0
      weapon_list = @subject.weapons
      
      case
      #Do weapon 0 stuff
      when $weap == 0
      #Remove weapons not being used to attack        
      for weapon in 1..weapon_list.size-1
        @subject.change_equip(weapon, nil)
      end
      #Perform attack
      target.item_apply(@subject, item)
      refresh_status
      @log_window.display_action_results(target, item)
      #Replace weapons not being used to attack
      for weapon in 1..weapon_list.size-1
        @subject.change_equip(weapon, weapon_list[weapon])
      end
      
      $weap = 1
      
      #Do weapon 1 stuff
      when $weap == 1
      #Remove weapons not being used to attack        
      for weapon in 0..weapon_list.size-1
        @subject.change_equip(weapon, nil)
      end
      
      #Perform attack
      target.item_apply(@subject, item)
      refresh_status
      @log_window.display_action_results(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
      $weap = 0
      end #case
    #Else regular attack stuff
  else
      target.item_apply(@subject, item)
      refresh_status
      @log_window.display_action_results(target, item)
    end
  end
end 

 

 

Share this post


Link to post
Share on other sites

I didn't read the script but features are automatically set up as all your features from equipment (even armor) ,class,actor,states and it would actually require rewriting  a non-neglectable amount of methods to make it work as you want ...

unless you want the attack skill to only use weapon features and ignore the other stuff which may be easier to do

 

Edit : "it would actually require rewriting  a non-neglectable amount of methods to make it work as you want ... " the logic isn't hard but it's a bit tedious

 

Edit 2 : I thought of a clever way to do it without rewriting , I also rewrote a good chunk of the initial script because it was messy . I did this on Notepad++ and didn'ttest it so there may be issues .

 

https://www.dropbox.com/s/39ytfn5va63qdf1/dual_weild.rb?dl=0&s=sl

Edited by Shiggy

Share this post


Link to post
Share on other sites

Thanks for taking the time to rewrite it. I fixed a typo or two, but I get the error line 75:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)

And if I change line 75 to def initialize then I get the error Game_Actors:20:in `new': wrong number of arguments (1 for 0) (ArgumentError)

Edited by Jolt Android

Share this post


Link to post
Share on other sites

I fixed it on the dropbox,you need to add (actor_id) to dual_wield_initialize at line 76

Share this post


Link to post
Share on other sites

Alright, did that, but now I get this error: Lytanathan Dual Wield SepAtt:82:in `feature_objects': undefined method `>=' for nil:NilClass (NoMethodError)

 

:)

Share this post


Link to post
Share on other sites

Are ou loading a save or startign a new game?

Loading a save might cause issues

Edited by Shiggy

Share this post


Link to post
Share on other sites

Doing both, and using the battle tester. Same thing.

 

I had to fix several typos (such as feature_objects instead of feature objects) attr instead of atrr, etc. I don't know RGSS all that well so there might be some other oversights in the script that I can't figure out.

Thanks for all your help anyway though. It's giving me hope that this can be done :)

Edited by Jolt Android

Share this post


Link to post
Share on other sites

I would need some time to test then ,as Isaid I wrote it quickly on notepad++

Share this post


Link to post
Share on other sites

Yes, mais comme on dit l'hâte fait des déchets. Merci beaucoup quand même. Pour l'instant je vais m'occuper avec des autres choses.

Share this post


Link to post
Share on other sites

Yes, mais comme on dit l'hâte fait des déchets. Merci beaucoup quand même. Pour l'instant je vais m'occuper avec des autres choses.

:busted_blue: @Jolt Android Please use English language, thank you! (=

Please note that rpgmakervxace.net is an English-speaking community and thus discussion is expected to be communicated in English. That includes all topics and postings.

Share this post


Link to post
Share on other sites

 

Yes, mais comme on dit l'hâte fait des déchets. Merci beaucoup quand même. Pour l'instant je vais m'occuper avec des autres choses.

:busted_blue: @Jolt Android Please use English language, thank you! (=

Please note that rpgmakervxace.net is an English-speaking community and thus discussion is expected to be communicated in English. That includes all topics and postings.

Sorry, I'm a bad boy sometimes. I just never get to use french. Won't do it again.

 

I modified a bunch more stuff and tested it ,this should work fine :

 

https://www.dropbox.com/s/p4dx4p2xkj2uzlw/dual_wield.rb?dl=0&s=sl

 

I had to overwrite some methods,try to use it above other scripts

 

Well, it kind of does what I want it to do now. Now, the features from both weapons are applied each time. For example. weapon1 is a silencing claw, weapon2 is a poison claw. Now both hits seem to do both silence and poison.

 

Thanks again for your talents :)

Edited by Jolt Android

Share this post


Link to post
Share on other sites

That's weird , I tested it with an elemental weapon , and only the elemental weapon does elemental damage

Edit : I tested with a poison and a sleep weapon , each weapon hit with each effect (but second attack can wake up the enemy put asleep by the first attack)

Edited by Shiggy

Share this post


Link to post
Share on other sites

hmm, my game maybe has too many scripts or something =_='' I tried moving the script around, but since certain methods are overwritten again later it messes up.

 

I'll try it again later. Working on the smooth targeting again XD

Share this post


Link to post
Share on other sites

use Ctrl+Shift+F and search for "def use_item" ,

give me the name of the scripts that you get with this and I will try to work on a fix

Edited by Shiggy

Share this post


Link to post
Share on other sites

YEA Ace Battle Engine 1.22+ (alias)

Yami Battle Symphony (overwrite)

Hime Skill links (overwrite)

Yami Skill Effect Tags (alias)

VE Materia (alias)

Hime Common Event Variables (alias)

Hime Skill Change (alias)

Hime Effect Manager (alias)

Hime Mime Effect (alias)

 

in this order in the script editor.

Perhaps my Skill links script should go on top of Battle Symphony, since it's not an alias?

Edit: nevermind, the script stops working if I do that.

Edited by Jolt Android

Share this post


Link to post
Share on other sites

It's hard to adapt the script for battlesymphony because battle symphony has a lot of customable elements.

I write a version of the script that work with aliases instead (but doesn't have the mirror animations for off-ands attack) but I think you will still have to fiddle with it to make it look right.

 

https://www.dropbox.com/s/5bzqrpewe3mb8yh/battle_symphony_dual_wield.rb?dl=0&s=sl

Share this post


Link to post
Share on other sites

There, that works for me now. :)

Wow, the code went from something sooo long to something so short XD

 

I'll need to find a way to make it not look silly in battle symphony though, as it stands the dual-wielding attacker attacks once, runs back to their initial position, and then runs back to do their second attack XD

Edited by Jolt Android

Share this post


Link to post
Share on other sites

It's because what my code do is : - remove one weapon use normal attack

                                                     - put back weapons
                                                      - remove other weapon use normal attack

                                                     - put back weapons

 

the battle symphony animations can be set up in any way , I can't do something specific

 

 

But if you tell me where in the animation sequence he damage is applied , I may be able to make something better:

 

like there is : -setup actions

                     -follow actions

                     -target actions

                     -follow actions

                     -finish actions

 

I suppose the animations should be duplicated in target actions but I don't know where the effct actually apply

Edited by Shiggy

Share this post


Link to post
Share on other sites

I believe that I read in the manual for symphony that everything damage-wise happens in target actions.

 

I tried doing some symphony scripting but it didn't work out at all ^_^'''

 

I use this script that Dhoom made me that fixes some issues with dual-wielding and symphony. Here it is, maybe it can help you...

 

 

 

#Dhoom Dual Wield Fix
#Above Follow Up Skill, Skill Links, etc.
module SYMPHONY
  module DEFAULT_ACTIONS
    PHYSICAL_SETUP2 =[
      ["MESSAGE"],
      ["MOVE USER", ["FORWARD", "WAIT"]],
    ]
    PHYSICAL_TARGET2 =[
      ["ICON DELETE", ["USER", "WEAPON"]],
      ["IMMORTAL", ["TARGETS", "TRUE"]],
      ["POSE", ["USER", "FORWARD"]],
      ["STANCE", ["USER", "FORWARD"]],
      ["MOVE USER", ["TARGET", "BODY", "WAIT"]],
      ["AUTO SYMPHONY", ["SINGLE SWING2"]],
      ["AUTO SYMPHONY", ["SKILL FULL", "unless attack"]],
      ["AUTO SYMPHONY", ["ATTACK FULL2", "if attack"]],
    ]
    PHYSICAL_WHOLE2 =[
    ]
    PHYSICAL_FOLLOW2 =[
      ["WAIT FOR MOVE"],
    ]
    PHYSICAL_FINISH2 =[
      ["IMMORTAL", ["TARGETS", "FALSE"]],
      ["ICON DELETE", ["USER", "WEAPON2"]],
      ["AUTO SYMPHONY", ["RETURN ORIGIN"]],
      ["WAIT FOR MOVE"],
      ["WAIT", ["12", "SKIP"]],
    ]
  end
end

module SYMPHONY
  AUTO_SYMPHONY_FIX = {       
    "SINGLE SWING2" => [      
      ["ICON CREATE", ["USER", "WEAPON2"]],
      ["ICON", ["USER", "WEAPON2", "SWING"]],
      ["POSE", ["USER", "2H SWING"]],
      ["STANCE", ["USER", "ATTACK"]],
    ],
    
    "ATTACK FULL2" => [
      ["ATTACK EFFECT", ["COUNTER CHECK"]],
      ["ATTACK ANIMATION", ["WAIT","2"]],
      ["ATTACK EFFECT", ["WHOLE"]],
      ["MOVE TARGETS", ["BACKWARD"]],
    ],
  }
  AUTO_SYMPHONY.merge!(AUTO_SYMPHONY_FIX)
end

class RPG::BaseItem
  attr_accessor :setup_actions_list2
  attr_accessor :whole_actions_list2
  attr_accessor :target_actions_list2
  attr_accessor :follow_actions_list2
  attr_accessor :finish_actions_list2
  
  alias dhoom_symphonyfix_rpgbase_create_default_symphony create_default_symphony
  def create_default_symphony    
    @setup_actions_list2 = []; @finish_actions_list2 = []
    @whole_actions_list2 = []; @target_actions_list2 = []
    @follow_actions_list2 = []
    #---
    if self.is_a?(RPG::Skill) and self.physical?
      @setup_actions_list2 = SYMPHONY::DEFAULT_ACTIONS::PHYSICAL_SETUP2
      @whole_actions_list2 = SYMPHONY::DEFAULT_ACTIONS::PHYSICAL_WHOLE2
      @target_actions_list2 = SYMPHONY::DEFAULT_ACTIONS::PHYSICAL_TARGET2
      @follow_actions_list2 = SYMPHONY::DEFAULT_ACTIONS::PHYSICAL_FOLLOW2
      @finish_actions_list2 = SYMPHONY::DEFAULT_ACTIONS::PHYSICAL_FINISH2
    end
    dhoom_symphonyfix_rpgbase_create_default_symphony
  end
end

class Scene_Battle < Scene_Base
  
  #--------------------------------------------------------------------------
  # overwrite method: use_item
  #--------------------------------------------------------------------------
  def use_item
    @scene_item = item = @subject.current_action.item
    targets = @subject.current_action.make_targets.compact
    #---
    attack = @subject.current_action.attack?
    weapon = @subject.weapons[0]
    w_action = attack && weapon
    #---
    targets = targets * 2 if attack && @subject.dual_attack?
    #--- Setup Actions ---
    actions_list = item.setup_actions_list
    actions_list = weapon.setup_actions_list if w_action && weapon.valid_actions?(:setup)
    if attack && @subject.dual_attack?
      actions_list2 = item.setup_actions_list2
      perform_actions_list(actions_list, [targets[0]])
      perform_actions_list(actions_list2, [targets[1]])
    else
      perform_actions_list(actions_list, targets)
    end
    #--- Item Costs ---
    @subject.use_item(item)
    refresh_status
    #--- YEA - Cast Animation
    process_casting_animation if $imported["YEA-CastAnimations"]
    #--- YEA - Lunatic Object
    if $imported["YEA-LunaticObjects"]
      lunatic_object_effect(:before, item, @subject, @subject)
    end
    #--- Whole Actions ---
    actions_list = item.whole_actions_list
    actions_list = weapon.whole_actions_list if w_action && weapon.valid_actions?(:whole)
    if attack && @subject.dual_attack?
      actions_list2 = item.whole_actions_list2
      perform_actions_list(actions_list, [targets[0]])
      perform_actions_list(actions_list2, [targets[1]])
    else
      perform_actions_list(actions_list, targets)
    end
    #--- Target Actions ---
    actions_list = item.target_actions_list
    actions_list = weapon.target_actions_list if w_action && weapon.valid_actions?(:target)
    if attack && @subject.dual_attack?
      actions_list2 = item.target_actions_list2
      perform_actions_list(actions_list, [targets[0]])
      perform_actions_list(actions_list2, [targets[1]])
    else
      targets.each { |target| 
        next if target.dead?
        perform_actions_list(actions_list, [target])
      }
    end
    #--- Follow Actions ---
    actions_list = item.follow_actions_list
    actions_list = weapon.follow_actions_list if w_action && weapon.valid_actions?(:follow)
    #error from here
    if attack && @subject.dual_attack?
      actions_list2 = item.follow_actions_list2
      perform_actions_list(actions_list, [targets[0]])
      perform_actions_list(actions_list2, [targets[1]])
    else
      perform_actions_list(actions_list, targets)
    end
    #--- Finish Actions ---
    actions_list = item.finish_actions_list
    actions_list = weapon.finish_actions_list if w_action && weapon.valid_actions?(:finish)
    immortal_flag = ["IMMORTAL", ["TARGETS", "FALSE"]]
    if !actions_list.include?(immortal_flag)
      if SYMPHONY::Fixes::AUTO_IMMORTAL_OFF
        actions_list = [immortal_flag] + actions_list
      end
    end
    if attack && @subject.dual_attack?
      actions_list2 = item.finish_actions_list2
      if !actions_list2.include?(immortal_flag)
        if SYMPHONY::Fixes::AUTO_IMMORTAL_OFF
          actions_list2 = [immortal_flag] + actions_list2
        end
      end
      perform_actions_list(actions_list, [targets[0]])
      perform_actions_list(actions_list2, [targets[1]])
    else
      perform_actions_list(actions_list, targets)
    end
    #--- YEA - Lunatic Object
    if $imported["YEA-LunaticObjects"]
      lunatic_object_effect(:after, item, @subject, @subject)
    end
    targets.each { |target| 
      next unless target.actor?
      @status_window.draw_item(target.index)
    }
  end
  
  def action_create_icon
    targets = get_action_targets
    return if targets.size == 0
    return if SYMPHONY::View::EMPTY_VIEW
    #---
    case @action_values[1]
    when "WEAPON", "WEAPON1"
      symbol = :weapon1
      attachment = :hand1
    when "WEAPON2"
      symbol = :weapon2
      attachment = :hand1
    when "SHIELD"
      symbol = :shield
      attachment = :shield
    when "ITEM"
      symbol = :item
      attachment = :hand1
    else
      symbol = @action_values[1]
      attachment = :middle
    end
    #---
    case @action_values[2]
    when "HAND", "HAND1"
      attachment = :hand1
    when "HAND2", "SHIELD"
      attachment = :hand2
    when "ITEM"
      attachment = :item
    when "MIDDLE", "BODY"
      attachment = :middle
    when "TOP", "HEAD"
      attachment = :top
    when "BOTTOM", "FEET", "BASE"
      attachment = :base
    end
    #---
    targets.each { |target|
      next if target.sprite.nil?
      next if !target.use_charset? && !SYMPHONY::Visual::WEAPON_ICON_NON_CHARSET && [:weapon1, :weapon2].include?(symbol)
      target.create_icon(symbol, @action_values[3].to_i)
      next if target.icons[symbol].nil?
      target.icons[symbol].set_origin(attachment)
    }
  end
end

class Scene_Battle < Scene_Base
  def perform_collapse_check(target)
    target.perform_collapse_effect if target.can_collapse?
  end
end

 

 

 

You're helping me so much, do you have paypal by any chance? I'd like to contribute to you for all your effort...

Edited by Jolt Android

Share this post


Link to post
Share on other sites

I'm at the gym now so I'll get to it in a few hours.

6JWL6vs.png
Posted 2 hours and 36 minutes later

Should I change class Scene_Battle < Scene_Test to class Scene_Battle < Scene_Base?

anyway I tried that so the script could start up, but it says undefined local variable or method `item' for #<Scene_Battle:0x142910d0> at line 48

Edited by Rikifive
I've merged your posts ~ no worries, I'm just cleaning stuff, please continue. (= ~Riki

Share this post


Link to post
Share on other sites

Yes it should be scene_base and i added the line item = @scene_item above the if for the other error.

The dropbox file have been updated

Share this post


Link to post
Share on other sites

Works but now I get four damage values when dual attacking: 2 for the first hit (the first one is wrong, the second one is right) and the same for the second hit.

 

EDIT: It's actually fine, I commented out a line in Yami Symphony before to prevent a crash, now your script works as intended. I hope the crash from before doesn't come back though ^_^'''

EDIT2: I spoke too soon, it's not fine... still get four damage values like before.

EDIT3: Fixed the crash, was a bug with the reflect script I posted XD... I will try the script again, maybe moving around some more.

Edited by Jolt Android

Share this post


Link to post
Share on other sites

What about the actual damage values ? Are they fine or does the enemy loses twice more hp ?

 

Can you describe the animation in detail and compare to what happen when you attack with two weapons without the script ?

(if you can make a video it's even better ) the more I know how the animations / effects are ordered the easier it is

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted