MZ Question about VisuStella Elements and Status Menu Core

Hello.
I have a question about how to correctly write Javascript code in the Notetags, while using VisuStella's plugins. In this exact case - Elements and Status Menu Core.

I'm willing to make a state, which boosts Dealt Element Flat based on caster's magical attack.
For example, if caster had mat = 10, then it should boost Dealt Element Flat by 10%, if mat = 25, then boost should be 25%, and so on.

What Notetag and how should I write to make that work?
I'm willing to make a state, which boosts Dealt Element Flat based on caster's magical attack.
For example, if caster had mat = 10, then it should boost Dealt Element Flat by 10%
There isn't a notetag that lets you refer to the total of the flat bonus. In fact, as far as I can see in the documentation, the notetags don't let you refer to any portion of the damage being dealt.

So you could add 10% of the caster's mat value, but not use the caster's mat to boost the bonus damage by 10%.

I think this would more easily be done without needing any plugins, just in the skill's damage formula.


So, pretending your existing formula is a.mat - b.mdf you could do:
Code:
(a.mat - b.mdf) * (1 + (a.isStateAffected(42) ? a.mat * .01 : 0))
where 42 is the ID of the state that's causing the bonus damage.

That would make the skill do additional damage equal to the caster's mat as a percentage as long as they have the state on.

Or, if you're using the Element core for other things, you could put a.mat * .01 in the JS Element Rate notetag. I know that's not precisely what you were asking for.
There isn't a notetag that lets you refer to the total of the flat bonus. In fact, as far as I can see in the documentation, the notetags don't let you refer to any portion of the damage being dealt.

So you could add 10% of the caster's mat value, but not use the caster's mat to boost the bonus damage by 10%.

I think this would more easily be done without needing any plugins, just in the skill's damage formula.


So, pretending your existing formula is a.mat - b.mdf you could do:
Code:
(a.mat - b.mdf) * (1 + (a.isStateAffected(42) ? a.mat * .01 : 0))
where 42 is the ID of the state that's causing the bonus damage.

That would make the skill do additional damage equal to the caster's mat as a percentage as long as they have the state on.

Or, if you're using the Element core for other things, you could put a.mat * .01 in the JS Element Rate notetag. I know that's not precisely what you were asking for.
Oh, maybe I should explain a bit better.
In the plugin, there is a Notetag -
<Dealt Element name Flat: +x%>
Which boosts the elemental damage of the specific element by a certain percentage.
So, if I put this Notetag for the state,
<Dealt Element Earth Flat: +50%>
Then it works and boosts Earth damage by 50%.

Yet, I wish to create a boost spell, which boosts the elemental damage not by the exact amount, by the percentage amount equal to caster's magic attack.
So I thought, if it could be written by the Javascript Notetag,
<JS Received Element name Flat: code>

But I'm not really familiar with the Javascript, so I don't know, how to write the code there correctly, or if that is possible at all.
Okay. You have a few bits of confusion.

Yet, I wish to create a boost spell, which boosts the elemental damage not by the exact amount, by the percentage amount equal to caster's magic attack.
Sure, you can do that. That's not the same as how you originally said it, that you wanted to modify the bonus damage by that percentage.

So I thought, if it could be written by the Javascript Notetag,
<JS Received Element name Flat: code>
Why would you turn it into Received? You're still talking about the person doing the damage, the person Dealing damage.

But I'm not really familiar with the Javascript, so I don't know, how to write the code there correctly, or if that is possible at all.
You just put the code I already showed you in my first reply.
Code:
<JS Dealt Element Earth Flat: a.mat * .01>
Okay. You have a few bits of confusion.


Sure, you can do that. That's not the same as how you originally said it, that you wanted to modify the bonus damage by that percentage.


Why would you turn it into Received? You're still talking about the person doing the damage, the person Dealing damage.


You just put the code I already showed you in my first reply.
Code:
<JS Dealt Element Earth Flat: a.mat * .01>
Oh, about the Received part - it's my mistake, I copied the wrong line.
I meant Dealt damage, yes.

If I put this, exact amount one,
<Dealt Element Earth Flat: +50%>
It works flawlessly. Damage dealt by earth attack goes from 1000 to 1500.

But if I use this one from you instead,
<JS Dealt Element Earth Flat: a.mat * .01>
Or
<JS Dealt Element Earth Flat: +(a.mat * .01)>
It does nothing for some reason, damage stays at 1000 without a slightest change.
Caster's magic attack is 50 and they are casting the spell, which inflicts the state, on themselves.

I have tried to change the formula a bit, yet to no avail.
Am I missing something?
I'm pretty sure you would want Rate, not Flat. The value of rate would be a percentage, whereas flat should be just the number (which might be a decimal).

Aside from that, try user instead of a.
I'm pretty sure you would want Rate, not Flat. The value of rate would be a percentage, whereas flat should be just the number (which might be a decimal).

Aside from that, try user instead of a.
I'm using Flat, because
- Formula works as follows: (base + plus) * rate + flat

So I want it to simply be used after all the other calculations from other stuff, and as I said, this one works fine
<Dealt Element Earth Flat: +50%>

Yet even if changing to user.mat, it still doesn't work, mh.
I don't want to spend too much time figuring out, what exactly is wrong, so I'll stick to the very first advice about modifying the damage formula itself, instead of using the state Notetag.

Thank you very much for that and for overall responses.
May the Goddess of Luck and Love bless you~
- Formula works as follows: (base + plus) * rate + flat
Yes, the flat is +. It's added. You don't want this portion of the user's mat to be added, you want to multiply the damage by it. In math, that's what saying "+50%" is, you have to multiply to get the value of what 50% is.

Yet even if changing to user.mat, it still doesn't work, mh.
Sorry, I tried. I find the documentation of these notetags to be very unclear; if you want to try again, you could replace the user with BattleManager._subject

I don't want to spend too much time figuring out, what exactly is wrong, so I'll stick to the very first advice about modifying the damage formula itself, instead of using the state Notetag.
Unfortunately, I think that might be easier. Good luck with your project.

Original thread: https://forums.rpgmakerweb.com/threads/question-about-visustella-elements-and-status-menu-core.172956/