This plugin injects its calculation into the damage formula, so it should be fully compatible with any other plugins that change how damage is calculated, as long as they still use the damage formula box in the database to deal any sort of damage.
I have found and corrected the issue. This plugin does a check during the damage calculation where it checked to see if the project was using the dual wield plugin, by checking if a certain function had been defined. With the latest version of the MZ dual wield plugin, the function it was checking is defined, but the function it calls is not the same, and is not defined anymore.
I changed that check to also make sure the second function was defined already. The update will be uploaded momentarily.
Just wanted to ask, if this will work with Galv's Weapon Proficiency plugin? Galv's plugin has a function to use Weapon Proficiency as part of the damage formula.
I actually haven't tested these two together, so I don't know 100% if they're compatible.
I think they should work together. This plugin replaces the entire attack skill formula with the one you set on a weapon, and if that should happen to contain a weapon proficiency in it, it should still resolve normally, as it's still in a damage formula.
If you use the option to conditionally replace part of a skill's damage formula with its weapon attack formula, it should still work the same way, as, it's still inside a damage formula and should still resolve normally.
I can't speak to whether it would work in reverse or not though, so keep that in mind.
Hi Ramza, a follow up question, please. Is there a Lunatic mode of sorts to this plugin, e.g., if a player has something equipped, a certain skill, etc., the weapon will have a multiplier to the formula, basically giving maybe 2-5 possible damage formula depending on the conditions met?
I'm not sure I'd technically call it a lunatic mode, but the way the formula is evaluated is line by line, like a standard function, so you could conceivably make a very complex formula with if checks that could return different values based on whether or not the user has a state, or a switch is on, or they have a specific item equipped.
I would like to ask a question. Is it possible to add a additional formula alongside the weapon's formula? From my understanding, the formula gets overwritten no matter what else is put alongside the eval, except multiplication?
For example, a skill that deals [a.mhp*0.1 + eval(this.weaponFormula())] damage. If not, if it's not too much trouble, I'd like to offer it as a suggestion.
The function you're making reference to is specifically designed to 'inject' the users weapon formula into the damage formula for any skill. The note tag <weaponskill> will completely replace the damage formula with that of the weapon, but eval(this.weaponFormula(altFormula)) should allow the other parts of the formula to modify it just fine. Although, I honestly haven't tested it since the last bug report that it wasn't working correctly with some formulas, so maybe that isn't the case anymore.
You might have to do something like
var wpn = eval(this.weaponFormula(1)); a.mhp * 0.1 + wpn
To get it to work correctly. I'll look into it. It's also important to note that enemies do not have weapons, so they will not have a weapon formula, unless you specifically gave them one via a note tag, and this.weaponFormula() has an argument to evaluate an alternate formula if there is no weapon formula present. In the above example it'll return 1 instead. If you don't use this, it'd come back undefined or NaN, which would cause the skill to do zero damage.
Edit:
I tested in a test project with the below formula
a.mhp * 0.1 + eval(this.weaponFormula())
The weapon formula was set to a.atk, the actor has an atk of 57, and 450 hp. With the skill, he did 102 damage, as expected.
Keep in mind that these formulas don't work in the attack skill, or in any skill that is set as a weaponskill via note tag.
Ah, that's what was tripping me up! Nothing was happening for the attack skill so I assumed it didn't work for anything else. Just tried it and it works just fine for skills!
I probably would've been confused if it was intended or a bug if I tried it for skills earlier.
Thanks for clearing it up, as it was a huge oversight on my behalf. Looking forward to future scripts!
If you wanted to have something like a weapon unleash could you replace the yanfly plugin with this or would it still be necessary to use the yanfly plugin for something like that?
What I mean is have the % chance to do a skill that had different effects and animations.
At this point, weapon unleash isn't something this plugin can do. And the weapon unleash effect from yanfly's weapon unleash plugin is not strictly very compatible with dual wielding.
I'll see what I can do to add a similar feature to this plugin in the future.
Thank you for your quick response. I was just curious as I am trying to keep down the number of plugins I use. All your work is very appreciated! Thanks
If I may suggest a small improvement.. or rather two... 1- As you said, this prevents me from having to create many different attack formulas for different weapons. But the formula can only be used for weapons... what about adding a way to set formulas for enemies too? So I can have an enemy with a different formula that still uses the default attack skill? (a way to set the attack animation too would be nice too, but not really that big a deal) 2- Is there a way for me to use the weapon formula only as a value in a skill instead of using the whole damage? For example, a skill that attacks three times with 75% hit chance, but that deals 3/4ths of the default attack as damage... how would I make it still do it with the weapon formula instead of exchanging the whole old formula for it? (already bought it, by the way)
These are both good suggestions. The first is definitely doable via an update, it shouldn't be too difficult for me to figure out.
The second thing... might sort of be doable right now without an update, but it'd be kind of hacky.
In your damage formula you can get the string which holds the custom formula and eval it as a function. So you could put something in place to check if the user is an actor or not, then check his weapon for a custom formula (if (user.weapons()[0]._customFormula)) and then eval that formula using eval(user.weapons()[0]._customFormula).
A damage formula might look something like this:
var w = (user.isActor() && user.weapons()[0] && user.weapons()[0]._customFormula) ? eval(user.weapons()[0]._customFormula) : (a.atk * 4 - b.def *2); w
Obviously, that's a bit hacky, so I will attempt to come up with a much better way to make it a little easier.
I have updated the plugin to v1.10 and have implemented both of your suggestions. Enemies can now have custom formulas, and I added a new function that you can use to replace a part of a damage formula with the custom weapon formula of the user. Check it out here.
As for swapping out enemy battle animations when they use the default attack, I can't do that as easily, because the damage calculation and the animation happen independently of each other. Specifically, action sequences can call the attack animation before making a damage calculation, so it would show the default animation in that case.
The good news is that YEP_BattleEngineCore already has an enemy note tag to change their default attack animation: <Attack Animation: x>, and since I'm pretty sure you're also using my dual wield plugin, you also already have BattleEngineCore!
← Return to plugin
Comments
Log in with itch.io to leave a comment.
How does this work with visustella plugins?
This plugin injects its calculation into the damage formula, so it should be fully compatible with any other plugins that change how damage is calculated, as long as they still use the damage formula box in the database to deal any sort of damage.
Why thank you this makes ultimate weapons much easier
Hello. I'm commenting to inform you that I found a bug with the plugin when using the latest version of your DualWield plugin.
I keep getting an error in the console command that "Ramza.DW.damageCalc" is not a function. It also displays:
at Window_BattleLog.callNextMethod (rmmz_windows.js:5422:31) 'a.atk * 4 - b.def * 2' 'DAMAGE FORMULA ERROR'
When the DualWield plugin is turn OFF, the WeaponAttackFormulas plugin works perfectly.
Hello there.
I have found and corrected the issue. This plugin does a check during the damage calculation where it checked to see if the project was using the dual wield plugin, by checking if a certain function had been defined. With the latest version of the MZ dual wield plugin, the function it was checking is defined, but the function it calls is not the same, and is not defined anymore.
I changed that check to also make sure the second function was defined already. The update will be uploaded momentarily.
~Ramza
Thank you for your hard work!
Just wanted to ask, if this will work with Galv's Weapon Proficiency plugin? Galv's plugin has a function to use Weapon Proficiency as part of the damage formula.
Good day.
I actually haven't tested these two together, so I don't know 100% if they're compatible.
I think they should work together. This plugin replaces the entire attack skill formula with the one you set on a weapon, and if that should happen to contain a weapon proficiency in it, it should still resolve normally, as it's still in a damage formula.
If you use the option to conditionally replace part of a skill's damage formula with its weapon attack formula, it should still work the same way, as, it's still inside a damage formula and should still resolve normally.
I can't speak to whether it would work in reverse or not though, so keep that in mind.
~Ramza
Thanks Ramza for the response! Glad to hear that there should, technically speaking, be no conflict.
Hi Ramza, a follow up question, please. Is there a Lunatic mode of sorts to this plugin, e.g., if a player has something equipped, a certain skill, etc., the weapon will have a multiplier to the formula, basically giving maybe 2-5 possible damage formula depending on the conditions met?
Hey there.
I'm not sure I'd technically call it a lunatic mode, but the way the formula is evaluated is line by line, like a standard function, so you could conceivably make a very complex formula with if checks that could return different values based on whether or not the user has a state, or a switch is on, or they have a specific item equipped.
Would be a very simple example pf this.
~Ramza
thanks!!
Hey,
I really like this script!
I would like to ask a question. Is it possible to add a additional formula alongside the weapon's formula? From my understanding, the formula gets overwritten no matter what else is put alongside the eval, except multiplication?
For example, a skill that deals [a.mhp*0.1 + eval(this.weaponFormula())] damage. If not, if it's not too much trouble, I'd like to offer it as a suggestion.
That feature already exists.
The function you're making reference to is specifically designed to 'inject' the users weapon formula into the damage formula for any skill. The note tag <weaponskill> will completely replace the damage formula with that of the weapon, but eval(this.weaponFormula(altFormula)) should allow the other parts of the formula to modify it just fine. Although, I honestly haven't tested it since the last bug report that it wasn't working correctly with some formulas, so maybe that isn't the case anymore.
You might have to do something like
To get it to work correctly. I'll look into it. It's also important to note that enemies do not have weapons, so they will not have a weapon formula, unless you specifically gave them one via a note tag, and this.weaponFormula() has an argument to evaluate an alternate formula if there is no weapon formula present. In the above example it'll return 1 instead. If you don't use this, it'd come back undefined or NaN, which would cause the skill to do zero damage.
Edit:
I tested in a test project with the below formula
The weapon formula was set to a.atk, the actor has an atk of 57, and 450 hp. With the skill, he did 102 damage, as expected.
Keep in mind that these formulas don't work in the attack skill, or in any skill that is set as a weaponskill via note tag.
Ah, that's what was tripping me up!
Nothing was happening for the attack skill so I assumed it didn't work for anything else. Just tried it and it works just fine for skills!
I probably would've been confused if it was intended or a bug if I tried it for skills earlier.
Thanks for clearing it up, as it was a huge oversight on my behalf. Looking forward to future scripts!
If you wanted to have something like a weapon unleash could you replace the yanfly plugin with this or would it still be necessary to use the yanfly plugin for something like that?
What I mean is have the % chance to do a skill that had different effects and animations.
At this point, weapon unleash isn't something this plugin can do. And the weapon unleash effect from yanfly's weapon unleash plugin is not strictly very compatible with dual wielding.
I'll see what I can do to add a similar feature to this plugin in the future.
Thank you for your quick response. I was just curious as I am trying to keep down the number of plugins I use. All your work is very appreciated! Thanks
If I may suggest a small improvement.. or rather two...
1- As you said, this prevents me from having to create many different attack formulas for different weapons. But the formula can only be used for weapons... what about adding a way to set formulas for enemies too? So I can have an enemy with a different formula that still uses the default attack skill? (a way to set the attack animation too would be nice too, but not really that big a deal)
2- Is there a way for me to use the weapon formula only as a value in a skill instead of using the whole damage? For example, a skill that attacks three times with 75% hit chance, but that deals 3/4ths of the default attack as damage... how would I make it still do it with the weapon formula instead of exchanging the whole old formula for it?
(already bought it, by the way)
These are both good suggestions. The first is definitely doable via an update, it shouldn't be too difficult for me to figure out.
The second thing... might sort of be doable right now without an update, but it'd be kind of hacky.
In your damage formula you can get the string which holds the custom formula and eval it as a function. So you could put something in place to check if the user is an actor or not, then check his weapon for a custom formula (if (user.weapons()[0]._customFormula)) and then eval that formula using eval(user.weapons()[0]._customFormula).
A damage formula might look something like this:
Obviously, that's a bit hacky, so I will attempt to come up with a much better way to make it a little easier.
Greetings.
I have updated the plugin to v1.10 and have implemented both of your suggestions. Enemies can now have custom formulas, and I added a new function that you can use to replace a part of a damage formula with the custom weapon formula of the user. Check it out here.
As for swapping out enemy battle animations when they use the default attack, I can't do that as easily, because the damage calculation and the animation happen independently of each other. Specifically, action sequences can call the attack animation before making a damage calculation, so it would show the default animation in that case.
The good news is that YEP_BattleEngineCore already has an enemy note tag to change their default attack animation: <Attack Animation: x>, and since I'm pretty sure you're also using my dual wield plugin, you also already have BattleEngineCore!
Thanks!
I hope more people enjoy them too.
...and I actually never noticed that notetag for battle engine core. Huh.