formulas not dealing damage

 I'm having a little trouble with my overdrive formulas (overdrive damage scales with tp then sets tp to 0)

these three formula don't deal any damage for some reason:

c = a.tp; ((a.atk * a.mdf) - b.def) * (1+(c/25));  a.tp = 0

c = a.tp; (a.mat * (1+rand(6))) * (1+(c/25)); a.tp = 0

c = a.tp; b.result.critical=true; ((a.atk * a.mdf) - b.def) * (1+(c/25)); a.tp = 0

this one works just fine though
c = a.tp; d = ((a.atk * a.mdf) - b.def) * (1+(c/25)); a.tp = 0; b.state?(47) ? d * 2.5  : d

I'm not sure what I'm missing.
Try to put the formula in the end of line.

For example :

Code:
c = a.tp;  a.tp = 0;  ((a.atk * a.mdf) - b.def) * (1+(c/25))
damage is always the last part (or in explicit return cases, the return value that you set) so on your code the last part will be a.tp = 0 meaning it will be the one used as the damage value, which will then be 0. The last formula worked because the last part will return either d*2.5 or d which has non-zero values
c = a.tp; ((a.atk * a.mdf) - b.def) * (1+(c/25));  a.tp = 0


c = a.tp; (a.mat * (1+rand(6))) * (1+(c/25)); a.tp = 0


c = a.tp; b.result.critical=true; ((a.atk * a.mdf) - b.def) * (1+(c/25)); a.tp = 0
Yep, you can do all sorts of weird and wonderful stuff in the damage formula, but the last part MUST be the damage itself. In your first 3 statements, you end with


a.tp = 0


That's just going to return true (probably - because you're doing an assignment which succeeds). It does NOT provide a value to pass back to the script.


If you want to make the middle bit the actual damage and leave the user with no tp, do it like this:


c = ((a.atk * a.mdf) - b.def) * (1 + (a.tp / 25)); a.tp = 0; c


c = (a.mat * (1 + rand(6))) * (1 + (a.tp / 25)); a.tp = 0; c


b.result.critical = true; c = ((a.atk * a.mdf) - b.def) * (1 + (a.tp / 25)); a.tp = 0; c


Some of those brackets are superfluous, too. Remember the mathematical order of operations.


This:


((a.atk * a.mdf) - b.def) * (1 + (c / 25))


is the same as this:


(a.atk * a.mdf - b.def) * (1 + c / 25)

Original thread: https://forums.rpgmakerweb.com/threads/formulas-not-dealing-damage.28619/