MV multiples DamageFormula in a single Skill

Hi
In the recently closed mobile game "Final Fantasy Brave Exvius", there are 2 "categories" of damage-dealers:

The Chainers, who use skills that inflict a large number of hits in a single attack, in order to increase the hit-count.
Chain.png

Example here:
The skill inflicts 9 hits with a total power modifier of 250x, which therefore represents 9 successive hits each having a power modifier of 28x each


The Finishers, who use skills that inflict a single huge hit in a single attack, in order to maximize damage when the hit-count is high enough.
Finish.png

Example here:
The skill inflicts 1 single hit with a total power modifier of 750x

However, some rare characters who are more powerful than the others have skills that inflict a large number of hits in a single attack to increase the hit-count AND just after a single, huge hit to maximize the damage.
Chain+Finish.png

Example here:
The skill inflicts 9 hits with a total power modifier of 50x, which therefore represents 9 successive hits each having a power modifier of 5x each
and just after, in the same skill, inflict 1 single hit with a total power modifier of 200x


I want to know if it's possible to make a skill like the last one ( a skill with 2 differents damage formula for differents hits in this single skill), or if i need a script/plugin for this ? (or if it's impossible)
I want to know if it's possible to make a skill like the last one ( a skill with 2 differents damage formula for differents hits in this single skill), or if i need a script/plugin for this ?
Well, there's clearly no way in the skill section of the database to have two different damage formulae, so yes, you'd need a plugin (MV doesn't use scripts).

Yanfly's Action Sequences allows you to program skills to do whatever you like.

You can have one kind of hit based on your damage formula, which is triggered by action effect, then you can separately calculate another amount of damage and use the gainHp() function on its targets.
Example here:
The skill inflicts 9 hits with a total power modifier of 50x, which therefore represents 9 successive hits each having a power modifier of 5x each
and just after, in the same skill, inflict 1 single hit with a total power modifier of 200x
for stuff like this i use Yanfly's action sequence plugin and reserve a variable for skill multipliers. the variables are used as a part of the damage formula for the skill and is manipulated mid skill.

for your end loaded chain case, the formula is multiplied by the variable. then i'd start off the sequence by setting the variable to 5, use a loop or repeat some lines that involves 9 action effects, and then after the 9th hit id change the variable to 200 so that the 10th hit has the higher multiplier

EDIT:
i never considered it before now, but changing the variable into a string of the intended formula for each hit mid skill and making the damage formula for the skill within the database be an eval() of the variable would allow for entirely different formulas too...
Thanks for the lead

Could you show me and explain how to do it?
Action Sequence is one of the rare Yanfly plugins that I have never managed to understand (which one to use between the 1, or 3, , when, where, how, in what order, etc...)
(which one to use between the 1, or 3, , when, where, how, in what order, etc...)
The order you load yanfly plugins are the same order they show up in on their website

you can use all 3 together just fine, but iirc either pack 2 or some other yanfly plugin has a bug that disables screen shaking in pack 3.

Could you show me and explain how to do it?
the basic form of the damage modifier one would be something like this as your action sequence notetag:
Spoiler
Code:
<target>
Change variable 1 = 5
action animation
action effect

wait: 12
action animation
action effect

wait: 12
action animation
action effect

wait: 30
Change variable 1 = 50
action animation
action effect
</target>
where at the start you set the variable, you do however many hits you need, and then just before the last hit you change the variable again. then you make your damage formula be a.atk*$gameVariables.value(1) or whatever you need it to be, so long as it uses that variable's value.

I suggest using a plugin that adds loops into action sequences so that youre not copy-pasting the same things 9 times in the same skill
1)

Code:
<target>
Change variable 1 = 5
action animation
action effect

wait: 12
action animation
action effect

wait: 12
action animation
action effect

wait: 30
Change variable 1 = 50
action animation
action effect
</target>

Where does i need to write this ? in the skill notes, right ?



2)
"Change variable 1 = 5"
what does the variable represent? the damage modifier, if im right ?


3)
My damage formula is :
((UserAtk²)/EnemyDef)*Modifier*WeaponVariance*FinalVariance

with FinalVariance=Variable number randomly chosen between 0,85 and 1, with 0,01 steps and averages to 0,925.

Then, according with that you said, my new formula should be:
((UserAtk²)/EnemyDef)*$gameVariables.value(1)*WeaponVariance*FinalVariance



4)
"so that youre not copy-pasting the same things 9 times in the same skill"

copy paste what and for what ?
Where does i need to write this ? in the skill notes, right ?
yes

2)
"Change variable 1 = 5"
what does the variable represent? the damage modifier, if im right ?
depends on how you use it. the way i described it, it would be a multiplier, but how you use it in the formula is what impact itll have on the damage.

Then, according with that you said, my new formula should be:
((UserAtk²)/EnemyDef)*$gameVariables.value(1)*WeaponVariance*FinalVariance
yes

copy paste what and for what ?
the action sequence. every time you type in
Code:
action animation
action effect
the skill hits once and plays its animation once. the example i gave you only hits 4 times. if you wanted to make an attack like Esther's Bolting Strike, the skill would have to hit 9 times and you would need to either copy-paste
Code:
action animation
action effect
wait: 6
8 additional times or use a loop. making an Auriole Ray chaining skill would be 30 of them and at that point you'd really want a loop
Just to mention it, you don't need to use the long script call - the damage formula instructions provide you with v[n] to get the value of variable n 😉
ok, so :

1) then, my damage formula must be :
((UserAtk²)/EnemyDef)*v[n]*WeaponVariance*FinalVariance


2)
You quoted BoltingStrike, then let's use it for training
BoltingStrike hits 9 times with a global modifier of 35x (we are going to ignore the IgnoreDef thing for my try ^^ ). Means each hit got a damage mod of 3.8 (35 divided by 9)

BoltingStrike.png


BoltingStrikeFrame.png

i create a "Bolting Strike" skill

in the damage formula, i need to write
((UserAtk²)/EnemyDef)*v[7]*WeaponVariance*FinalVariance

in the note, i need to write:
Code:
<target>
Change variable 7 = 3.8
wait: 42
action animation
action effect

wait: 6
action animation
action effect

wait: 6
action animation
action effect

wait: 6
action animation
action effect

wait: 6
action animation
action effect

wait: 6
action animation
action effect

wait: 6
action animation
action effect

wait: 6
action animation
action effect

wait: 6
action animation
action effect
</target>


Now, i try with a skill Chain+Finish. Let's use again the BladeOfCarnage i used in my 1st post
Chain+Finish.png

Chain+Finish Frame.png

i create a "Blade Of Carnage" skill
BladeOfCarnage hits 10 times with a global modifier of 50x, means each hit got a damage mod of 5.5 (50 divided by 9), and just after, a single hit with a modifier of 200x.
in the damage formula, i need to write
((UserAtk²)/EnemyDef)*v[7]*WeaponVariance*FinalVariance

In the Note, i write:
Code:
<target>
Change variable 7 = 5.5
wait: 110
action animation
action effect

wait: 10
action animation
action effect

wait: 10
action animation
action effect

wait: 10
action animation
action effect

wait: 10
action animation
action effect

wait: 10
action animation
action effect

wait: 10
action animation
action effect

wait: 10
action animation
action effect

wait: 10
action animation
action effect

wait: 10
Change variable 7 = 200
action animation
action effect
</target>

Am i right ?
Am i right ?
assuming that youre placing valid values for your battler stats and variances, then yes. Did you try it and it out and it didnt work? if so, then what exactly did you use as a formula?
((UserAtk²)/EnemyDef)*v[7]*WeaponVariance*FinalVariance
this is a fine representation for the formula, but if you would put this as it is into the formula box, it wouldnt do any damage. you need a.atk, b.mat, etc.

EDIT:
Change variable 7 = 5.5
just remembered that the engine rounds number variables down when you set them. to use x5.5 as a modifier, youd need to change the variables to 55 and 2000 within the skill's notebox and divide them by 10 when used in the formula. otherwise, its just be x5
"this is a fine representation for the formula, but if you would put this as it is into the formula box, it wouldnt do any damage. you need a.atk, b.mat, etc."

Better with:
((a.atk*a.atk)/b.def)*v[7]

( or something else, i dont konw if i can use the ( ) inside formula ?)
?
or something else, i dont konw if i can use the ( ) inside formula ?
Have you tried it? the fastest way to know is to test it and see. if something goes wrong, then its a good question to ask.

you can use () in formulas. you just need to make sure that every set is closed properly. in the case of the FFBE damage formula theres no need for them. everything that goes into it is either multiplied or divided. nothing has any priority. a.atk*a.atk/b.def*v[7] is the same as ((a.atk*a.atk)/b.def)*v[7]
seems like its working
i got my 10 hit, the 9 first hit low,the last one hit hard :


Thanks a lot for the explanations , its better thhan just copy-past a solution without to understand how its working 🙂

Besides, speaking of DamageFormula, rather than having to make other posts to ask, you might as well ask straight away.

As said above, I would like to have the following formula:

((a.atk*a.atk)/b.def)*v[7]*WeaponVariance*FinalVariance

1) How can I apply directy a variance to a Weapon Type?
Like:
Twinblades WeaponVariance: [90%-115%]
and
Scythe WeaponVariance:
[125%-175%]
Which means that ALL Twinblades will apply a randomly chosen modifier between 0.9 and 1.15, and ALL Scythes will apply a randomly chosen modifier between 1.25 and 1.75.

2) How can I create a FinalVariance, which is a variable number randomly chosen between 0.85 and 1, with 0.01 steps and averages to 0.925?
How can I apply directy a variance to a Weapon Type?
my recommendation would be to either create or request a plugin thatll define a battler function that checks the equipped weapons of an actor and pulls custom variance data off of the weapon's notebox or uses a weapon type specific value as a fallback to use in your formulas. if you want outliers like Fixed Dice or the Angel Slayer youll want to be able to break away from it.

2) How can I create a FinalVariance, which is a variable number randomly chosen between 0.85 and 1, with 0.01 steps and averages to 0.925?
the math to do it in you formula would be
Code:
Math.random() * .15 + .85

Although id suggest a similar thing to above. make it a plugin for a function with the same output so that its easier so call and so that if it needs to change down the line in any way, you'd just need to adjust the function instead of every skill.

Code:
function FV() {
    return Math.random() * .15 + .85;
}
then you'd call it like this
Code:
a.atk*a.atk/b.def*v[7]*FV()
ok, let me recap.
For the FinalVariance, is need
1) Use Notepad++ for create the following script:
Code:
function FV() {
    return Math.random() * .15 + .85;
}
and add it in my plugin list

2) add the created fonction "FV" to my Damage formula, as :
a.atk*a.atk/b.def*v[7]*FV()

Im right ?


And for the Weapon Variation, just ask in the Request section, then
Im right ?
Yes

And for the Weapon Variation, just ask in the Request section, then
Also yes. Be as clear as you can to describe what you need when you make the request. You may also want to link back to this thread when you do

Original thread: https://forums.rpgmakerweb.com/threads/multiples-damageformula-in-a-single-skill.173691/