Why is this formula not working?

The Problem is this custom damage formula:

v[23]=a.tp;a.tp-v[23];((a.atk+(1.5+a.atk*0.5)*a.luk+(v[41]/10)+v[71]))+v[23]-((b.def*0.5)*b.luk)

Ok, i know, the formula is very long, but most of it works fine. The only part which is not working, is, to set the attackers TP to 0. (For explanation: Beside the normal damage, the skill recives bonus damage like the Execute-Skill from WOW. That Means it is usable at any time, but the inflicted damage depends on the amount of TP, the user had. Mor TP means more damage, but after Using this skill, the users TP hits 0.

(v[23]=a.tp;a.tp-v[23];

And this part is not working. The damage of the skill ist correctly calculated ... more TP means more damage. But the Skill did not reducing the useres TP at all, and i'm not understanding, why.

Please help.

Thank you.
Erm, why don't you just add a -100% TP effect for the skill? 😳


Wow, I just checked and we can't give negative amount of TP in the effects tab. Well, that's a bummer. >.>


Okay, I tested it with this:

v[1] = a.tp; a.tp = 0; (a.atk * 4 - b.def * 2)*v[1]And this works for me just fine.
Make sure that the skill's TP Gain is 0 or else it will add the TP Gain value at the end of the skill.
Your Problem is here:

a.tp-v[23]The result of that calculation is indeed zero in your formula - but you don't do anything with this result.Try:

Code:
a.tp=a.tp-v[23]
if you don't want to use the simple a.tp=0 as described above...
Thank you for your help, but i did not work.

i changed the formula to

v[23]=a.tp;a.tp=0;((a.atk+(1.5+a.atk*0.5)*a.luk+(v[41]/10)+v[71]))+v[23]-((b.def*0.5)*b.luk)

The skill emptied the TP correct now, but it think, that the game calculated "a.tp=0" at first, and then "v[23]=a.tp" because the damage is much to low now. Or better ... the damage now is exactly 100 points lower, in compairsion to the first formula ... the 100 Point that should be the TP.
It can't calculate the tp reset first, it goes in order. You stored the variable before the reset, so the variable should have the stored amount.

Make a shorter and simpler formula, so you can test it directly.

Like:

v[23]=a.tp;a.tp=0;a.atk*v[23]
To see exact damage changes, turn off variance (set it to 0) and switch criticals off.

You will see that the damage will depend on the current TP for sure.
Hi,

Does your attack trigger multiple hits or do you use "Auto Battle" for your character?

In the first case the TP will get drained during the first strike, lowering the damage for the other ones, in the second case, the formula gets executed to test its estimated effect on each enemy, draining the actors TP without actually using the skill.

Despite from that, I'd recommend what Sixth said.
Ok Guys, i found the Problem. As my battle-System is depending much on tactics, i'm using a calculated-Damage preview. Obviously this preview calculates the expected damage of the skill correct, but emptied the TP before the skill is used. So the preview says 150 Dam and the Attack itself causes only 50 Dam because the TP-Bar is already empty if you press enter.

That's weird.

Is there any other Way to set the Users TP to 0 ? Maybe with a state or common event? The Problem is, i could not predict, which party member can use this skill.
You must use a custom script for that than.


Ask it in the Script Request/Script Support section, maybe someone can help you there.


Make sure to mention the scripts you are using for that preview damage thingy.

Original thread: https://forums.rpgmakerweb.com/threads/why-is-this-formula-not-working.37466/