ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
870
Reaction score
553
First Language
English
Primarily Uses
RMMV
This plugin has been updated to a much newer, easier to use version. I completely advise against continuing to use the deprecated version contained in this topic. Please visit the topic for the new version here.

The newest version fixes many bugs that this version had, but is no longer compatible with the functions from this plugin.
  • It correctly handles barehanded offhand or mainhand weapons
  • It supports two-handed weapons, which can't be equipped into the offhand, and cannot be wielded with a weapon in the offhand
  • It also supports offhand and mainhand only weapons, which can only be equipped on their respective slots
  • Also supports light shields that can be equipped alongside a two-handed weapon (like a buckler)
  • It allows the player to equip a shield into the offhand weapon slot of a dual wield actor
  • The basic setup for this new version is plug and play - there is virtually no setup required to get it working out of the box.
  • Has fewer plugin requirements, only needed YEP_BattleEngineCore
  • Supports special weapon animations from YEP_WeaponAnimations
  • Has a powerful menu extension plugin that shows separate attack values for the main and offhand weapons, and interfaces with my shield block plugin as well to show that if desired.
Once again, this topic contains the old version of this plugin, which is inferior to the new version in every way. Please update to the new version rather than use this one.

Check inside the spoiler for the original content of this post.
By default, dual wielding is pretty terrible in RM MV. For one thing, it's difficult to balance dual wielding at all, and you often need to use plugins to get around a lot of logic problems concerning it. But WORST OF ALL (probably not really), the battle setup for it is GROSS.


I dunno about you guys, but my vision for dual wielding involves actually attacking twice, and by default, that isn't how dual wielding works. If you add an extra weapon attack to a dual wielding state, you fix that problem, but then you have a glaring animation issue, namely that stupid cross shaped... thing. When dual wielding was one hit, this was alright, but now that you're hitting twice, it looks like you're actually hitting four times. Well I set out to fix it... and was mostly successful.


Ramza's True Dual Wield Plugin for RMMV: version 1.0.5




What does it do?

  • New in v1.0.5:

  • Bug fixes regarding missed hits

  • New in v1.0.1:

  • Actors do damage per swing based on the attack of their equipped weapon in their main/offhand

  • V1.0.0:

  • Changes the default behavior of the attack animation of dual wielding actors

  • The default battle animation was originally two battle animations played on top of each other, the one from the offhand mirrored.

  • Using this plugin, an actor who is dual wielding will alternate between his mainhand weapons animation and his offhands

  • also alternates the weapon sprite graphic between both weapons

  • supports odd numbers of hits (skills that do 3 hits) without losing weapon metadata



Why?


The original dual wielding animation was gross if you were using it with a state that made dual wielding hit multiple times. After I mucked with the animation thing, making the weaponsprite show up correct was also a priority.


Usage:

  • In v1.0.1b and above RamzaDWMissCorrection(user) can be called from an action sequence if a miss is detected, to force the attack immediately following the missed attack to deal the proper amount of damage and use the correct animation. The weaponsprite currently still displays as the one that just missed, however. Fixed in v1.0.5.

  • In v1.0.1 and above, if you are using an action sequence that calls the 'action effect' before you call the 'attack animation', there is a new parameter in the plugin that needs to be set to true, and a function call to RamzaDMGsetup(user); must be made in your setup sequence.

  • This plugin overwrites the function Window_BattleLog.prototype.showActorAttackAnimation from rpg_windows.js As such it will be incompatible with any other plugins that change that function

  • YEP_WeaponAnimation is required for this plugin to function. All weapons should have a <Weapon Image: x> note tag on them to prevent weird behavior

  • This plugin needs a new save to be tested correctly, unless the weapon animation plugin was already installed and set up when the original save was made

  • I have not tested it without the use of action sequences. I specifically use the Finish Action to call a cleanup function to ensure that weapon metadata isn't lost in certain circumstances

  • For it to properly work, you need dual wielding to be set up as a state that increases attack by (at least) 1. See image:

dwtrait.PNG

  • An action sequence that calls an 'attack animation:' event will trigger this plugin automatically

  • In the finish action, a script must be called to do cleanup to make sure that weapon metadata isn't lost

RamzaDWCleanup()

  • This can be added right into the finish action sequence, or from a common event that is called from it. Do not call it from inside the whole or target actions or data may be lost



How does it look?


before:

View attachment 2016-03-07-0020-26.webm


0Mxdowz.gif



after:


Individual Damages:

JRFANLe.gif

Terms of Use:


Free for all types of use. You don't even have to credit me for it (although it's be neato if you did).


Also remember that you need a couple of Yanfly's plugins for this to completely work so... abide by his terms of use too.


Known Issues:

  • If an actor is dual wield type, but has no weapon in his main hand either of his hands, all attacks will be animated with the metadata of his offhand equipped hand(animation weaponsprite swingtype) the weapon damage of both hands remains as it should. This seems to be rmmv preventing a scenario where someone who is actually using a weapon at all would show a barehanded animation. I will attempt to fix this behavior for the next release.

  • If your attack action sequence has a conditional hit system built into it (not showing the attack animation unless a hit is detected) if a dual wield character misses on the mainhand attack, the offhand attack will use the metadata from the mainhand. The cleanup script detects this as an odd numbered attack (because you only called the animation once) it turns out this happens whether or not your action sequence is setup to detect hit before showing any animation or not Fixed in v1.0.5.

  • v1.0.1b: if the new RamzaDWMissCorrection(user) function is used when a miss is detected during an action sequence the above problem will only show the weaponsprite of the primary weapon, while showing the battle animation of the offhand, and dealing damage as if it were the offhand weapon



Happy RPGMaking everyone. If you have any bugs or suggestions, feel free to post them. I'm pretty new at this so it might not be in my wheelhouse to fix, but I'll give it a try,


Link is updated to v1.0.5


RamzaDualWield.js v1.0.5
 
Last edited:

Radis3D

Just a Devilz
Veteran
Joined
Nov 1, 2015
Messages
172
Reaction score
33
First Language
Indonesian
Primarily Uses
RMVXA
Naisu... 


2 different attack with dual hand :3


Bookmarked :3


Will check it later //rmwforums.s3.amazonaws.com/emoticons/default_smile.gif


Sankyu.. 
 

HeroicJay

Veteran
Veteran
Joined
Jun 23, 2014
Messages
329
Reaction score
180
First Language
English
Primarily Uses
RMMV
Do the two hits each ignore the weapon in the hand not being used? For instance, if you dual-wield a sword and a spear, will the first hit (with the sword) take into account the attack power of the spear?
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
870
Reaction score
553
First Language
English
Primarily Uses
RMMV
Currently both attacks are calculated by the default system.


you can use a complicated damage formula or action sequence to achieve this though.


something like $dataWeapons[$gameActors._data[a.actorId()]._equips[0]._itemId].params[2] will give the atk value of weapon 1, and $dataWeapons[$gameActors._data[a.actorId()]._equips[1]._itemId].params[2] gives the attack of the weapon in the offhand. It's not outside of the scope of this plugin mind, I will see if I can properly cook that up next.
 

HeroicJay

Veteran
Veteran
Joined
Jun 23, 2014
Messages
329
Reaction score
180
First Language
English
Primarily Uses
RMMV
I'm already using a complicated action sequence for dual wielding. But it's a huge and kind of inflexible mess. //rmwforums.s3.amazonaws.com/emoticons/default_tongue.gif
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
870
Reaction score
553
First Language
English
Primarily Uses
RMMV
I have updated the plugin to v1.0.1c.


Change log:

  • 1.0.1b - added a missdetect function which currently makes the dw attack immediately following a missed attack deal the proper amount of damage and show the correct battle animation. Unfortunately, the weaponsprite doesn't seem to update before the second attack so it still looks like the missed attack.
  • Weaponswings with main or offhand no longer benefit from the attack stat on the other hand.
  • If you have a spear that has an attack 50 in your mainhand, and a dagger in your off hand with an attack of 12, the main hand attack will do damage as if you were single-wielding the spear, and the offhand as if you were single-wielding the dagger.
  • Skills that utilize more than one hit will also display this behavior
  • Skills that do not use more than one hit, and do not use 'attack animation' in their action sequence will function normally, with actor attack accounting for both weapons
  • Skills that do not have more than one hit, but DO use 'attack animation' will only deal damage with the mainhand weapon.
  • Cleanup script was updated to check for lost weapon attack data before clearing
  • a new script RamzaDMGsetup(user) needs to be used in your setup sequence if your 'action effect' plays before your 'attack animation'

example action sequence:

Code:
<Setup Action>
	display action
	eval: RamzaDMGsetup(user);
	if user.attackMotion() !== 'missile'
		move user: target, front base, 20
		wait for move
	end
immortal: target, true
</Setup Action>
<Target Action>
	wait: 15
	perform action: user
	action effect: target
	if target.result().isHit()
		attack animation: target
		wait for animation
  	else
  		eval: RamzaDWMissCorrection(user);
	end
	wait: 20
</Target Action>
<Finish Action>
	clear battle log
	perform finish
	eval: RamzaDWCleanup();
	wait: 10
	immortal: target, false
</Finish Action>
 
Last edited by a moderator:

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
870
Reaction score
553
First Language
English
Primarily Uses
RMMV
NOTE:


I have updated the plugin to v1.0.1c to fix an issue with the cleanup script not resetting a variable value which was causing it to work incorrectly.

JRFANLe.gif



RamzaDualWield.js
 
Last edited by a moderator:

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
870
Reaction score
553
First Language
English
Primarily Uses
RMMV
@nicomamengo


It is possible to switch between any weapons, but if your attack action sequence involves moving to the target ONLY if you're using a melee weapon, it will not move you to the target between attacks. If you put the gun in the offhand, it'll actually look cool, as he swings with the sword and then shoots the target in melee, but the reverse will cause him to stand out at gun range and swing his sword at nothing.


I'm sure an action sequence could be modified to force the attacker to move to the target if he isn't already before any attack, but that's probably outside of the scope of this plugin.


Setting a switch to ON during the setup phase (if melee - after moving to the target) and then doing an if condition to check if the switch is on or not, and forcing the user to move to the target again if he's not already there would work if you had the gun in the mainhand, but it would break if you could also dual wield guns. Unless you come up with a way to tell the action sequence you ALSO have a gun in your offhand. Unfortunately, for action sequence purposes, the engine will always think you have the weapontype of your mainhand, so you can't check for that on the fly. :/
 
Last edited by a moderator:

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
870
Reaction score
553
First Language
English
Primarily Uses
RMMV
I am in the process of trying to correct several bugs with this plugin right now.


The barehanded attack bug, where attacking with an unarmed strike in your mainhand always shows the weaponsprite and swingtype of your offhand seemed easy enough to fix, but I have no idea where it's getting the input to do that automatically.


The issue where missed attacks cause the followup attack to share the weaponsprite and swingtype of the previous (missed) attack, while still doing the damage and showing the correct animation of the current attack seems to me to be caused by the engine not looking for updated weapon data between attacks if the first attack missed. I'm not sure if it's doing this to save memory or what. But I have no idea where's it's making that decision either (if it is).


If anyone wants to help me, that'd be pretty cool. I also have a topic up on the help boards too, just saying.


halp pls


-Ramza
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
870
Reaction score
553
First Language
English
Primarily Uses
RMMV
After some cursory googling, I can see that @Victor Sant has created a dual wield plugin that treads a lot of the same ground as this plugin, and has several features that I would've liked to add at some point if I ever figured it out. Why have two people do the same thing anyway?


Victor's improved plugin


I am personally now using his plugin instead of my own, and see no reason to continue troubleshooting this one anymore.


Cheers.
 

killerfer

Veteran
Veteran
Joined
Nov 4, 2015
Messages
198
Reaction score
50
First Language
Portuguese
@ramza


Did you manage to use VE - Dual Wield with YEP - Weapon Animation? I was using your plugin because it works better with YEP. I think too, Victor's plugin has more features and is overall better but since my game has a lot of Yanfly Plugins, your plugin was the one to go.
 

Chaos17

Dreamer
Veteran
Joined
Mar 13, 2012
Messages
1,311
Reaction score
486
First Language
French
Why have two people do the same thing anyway?

For the sake of compatibility.


Victor combat plugins enter a lot in conflict with Yanfly battle plugins.


As much I like Victor plugins, I can't use them in general (fortunaly some work) with Yanfly so I appreciate that your plugin exist.
 
Last edited by a moderator:

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
870
Reaction score
553
First Language
English
Primarily Uses
RMMV
@ramza


Did you manage to use VE - Dual Wield with YEP - Weapon Animation? I was using your plugin because it works better with YEP. I think too, Victor's plugin has more features and is overall better but since my game has a lot of Yanfly Plugins, your plugin was the one to go.

I have noticed this compatibility problem, and I also suspect it was the source of my weaponsprite/swingtype problem I was having on misses. I tried to test my plugin without the weaponanimation plugin turned on, but I relied on some extra weapondata from that plugin to use the animations from those weapons in the first place, so I wasn't able to see if that worked without it or not.


@Chaos17 I am willing to try to make this work for compatibility reasons, but Victor's plugin is much more complete, and much easier to use than mine. And the issue remains that I still have some pretty major problems to fix, and no experience in even trying to figure out where the issue is coming from.
 

killerfer

Veteran
Veteran
Joined
Nov 4, 2015
Messages
198
Reaction score
50
First Language
Portuguese
@ramza


I see. Battle Engine Core changes too much of the default battle system so it is too hard to make things compatible right? Well, I'll keep using your plugin as long as it keep working until something better comes up. Thanks for the plugin you made and all the time dedicated for the community Ramza.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
870
Reaction score
553
First Language
English
Primarily Uses
RMMV
I can see that the reason yanfly's weapon animation and VE's dual wield is incompatible is because weaponanimation creates some new parameters on each weapon, which Victor either doesn't know about or ignores, but I can't figure out where that information is stored on a weapon without yanfly's plugin. I peeked at victor's code, but I'm basically JS illiterate, and it sorta gave me a headache trying to figure out even where he's doing a weapon animation switch, if at all.


So arrive at this impasse for my plugin:

  • Either @Yanfly's weapon animation has a bug in it, where it doesn't check for updated weaponAttackMotion OR weaponImageIndex after a miss has occurred
  • Or the engine itself doesn't treat a second attack after a miss as a second attack, and is causing those values to remain cached somewhere else until an attack actually hits.

I have debug console output showing me that the AttackMotion and ImageIndex values are changed before the second attack, and the battle animation/damage calculation changes as it should at the same time, so those are really the only two things that can be wrong here. I don't know where to go from here.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
870
Reaction score
553
First Language
English
Primarily Uses
RMMV
Alright, so I managed to uhh stumble on some code in the weapon animations plugin that is probably the compatibility issue for both of our plugins.


It looks like yanfly's system caches the weapon sprite and possibly the swing type. I haven't found where it clears that cache in the plugin, but it's safe to say it doesn't do it if the attack itself doesn't resolve as in, if it misses. I added a line to change the value in the cached variable to whatever I had set in the actual weapon data variable and it appears that the problem with it has been resolved.


I suspect that this cache value is also interfering with Victor's plugin, causing both attacks to look like the mainhand weapon because of differences in our scripting. I will make sure that the weapon swing is also being cached and fix that as well if needed. More updates to follow shortly.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
870
Reaction score
553
First Language
English
Primarily Uses
RMMV
Updated to v1.0.5:


Changelog:


When using a skill or attack that does multiple hits, if a single hit misses, a subsequent hit will no longer use the weaponsprite and swing motion of the attack that had missed.


Issues:


If the actor who is dualwielding has either of his hands empty, all attacks will have the appearance of his equipped weapon. In previous versions, this only happened if the mainhand was empty, but testing in this version has proven that is happens regardless of which hand is empty. If the actor is dual wielding but has no weapons equipped, all attacks will be barehanded, as intended.


RamzaDualWield.js v1.0.5
 

Victor Sant

Veteran
Veteran
Joined
Mar 17, 2012
Messages
1,694
Reaction score
1,454
First Language
Portuguese
Primarily Uses
Victor combat plugins enter a lot in conflict with Yanfly battle plugins.

More specifically with the Battle Engine Core. This happen due to the different design decisions.


I decided to design my plugins after the rpg maker core code as base, using the window battle log to process battle actions.


Yanfly decided to go on a different way, not using the default processing and making it's own code to process battle actions.


Obviously this decision stretch for other plugins, many of my plugins that has some type of incompatibility with the battle core has calls related to the Window Battle Log.


@ramza


For the issue with weapon sprites. you should look at Game_Actor.prototype.performAttack


This uses the fuction this.weapons(), to get the weapons, the issue is that this fuction only returns the equiped weapons and ignore unnequiped weapons.


On the other hand, if you use the fuction this.equips(), it will not ignore empty slots. So you can use this.equips()[0] for the first slot and this.equips()[1] for the second.


This was the issue with my plugin, that always used the default maker performAttack for the first weapon, using the custom peformAttack only for the second attack.
 
Last edited by a moderator:

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
870
Reaction score
553
First Language
English
Primarily Uses
RMMV
@ramza


For the issue with weapon sprites. you should look at Game_Actor.prototype.performAttack


This uses the fuction this.weapons(), to get the weapons, the issue is that this fuction only returns the equiped weapons and ignore unnequiped weapons.


On the other hand, if you use the fuction this.equips(), it will not ignore empty slots. So you can use this.equips()[0] for the first slot and this.equips()[1] for the second.


This was the issue with my plugin, that always used the default maker performAttack for the first weapon, using the custom peformAttack only for the second attack.

I'm sure this info is useful to me in some way, but I can't for the life of me figure it out.


I tried using it to make barehanded attacks work, but this.equips() is null if the mainhand is empty, so it doesn't have any properties to take, and if I detect a null value and manually set the imageId and weaponMotion to reflect an unarmed attack, it still pulls the weapon data from the offhand weapon instead.


The only way I can think to solve this problem would be to detect a null value and then set a 'barehanded' weapon in that slot using the script, that can store a sprite and a weaponMotion, instead of manually trying to change the values, so that whatever is stealing the offhand weapon's properties will detect a weapon and not do that.


This isn't an ideal solution, as it requires the developer to create a 'blank' weapon in their database, which I must reserve... But I will give it a shot tonight, and see what we get.
 

Latest Threads

Latest Posts

Latest Profile Posts

Is it necroposting if I ask for more info in my own months old thread? All the information in the thread is relevant
JRPG TextBox HTML - Part 2:
So I'm resuming work on the Shadowstar Trilogy. I've decided that it will take place between the end of G4 and the start of G5, and two of the Lost Rulers will be Twilight Sparkle and Sunset Shimmer (who is the moon princess in my AU).
Been working on some sprites, My favorite out of all of them is this guy, his name is Moss:

Forum statistics

Threads
108,958
Messages
1,040,868
Members
141,418
Latest member
Emileewitt
Top