In my game, all levels have a maximum of 20MP. There's a certain mechanic that goes along with this, and magical skills require MP to be over a certain amount to be used. MP also fluctuates in battle depending on your actions, yet is never spent
anyway, what I'm wanting to know, is if i can use something like this in a damage formula
a.mat*1.((a.mp))
so if MP is maxed out, the formula would be
a.mat*1.2
were as if it was only at 9 it would be this
a.mat*1.09
I'm asking on here because i also want to share the idea if anyone wants to use it
I'm not sure about it working exactly as you wrote it, but I think this would work:
a.mat + a.mat * (a.mp/100)
That will do the same thing, where if you have 2 mp, then it does 1.02 * your mat, and if you have 10 mp it does 1.10 * your mat.
Hmm, I'm not too sure about that formula... maybe try:
a.mat*(1+a.mp/100)
that should max out to a.mat*1.2
edit: (Nevermind, they're the same 😛 )
@Oddball, yep. So set the division number appropriately.
@Petite Elite: Yep, I distributed the a.mat through first. Yours is a tad more compact though, so if you are near the character limit it is the better to use.
If you ever get near the character limit just put the formula into a new method in Game_Battler. For example:
def custom_formula_cappedmagic(a, b )
a.mat*(1+a.mp/100)
end
Then in the formula box put a.custom_formula_cappedmagic(a, b )
Obviously this one fits no problem, but for future reference it might be handy to know.
You might want to make one of the numbers used in the division a float (by using 100.0 instead of 100 for example), otherwise the result is rounded down to an integer.
As an alternative, you can do the multiplication before you divide to minimize rounding errors:
a.mat * (100 + a.mp) / 100