Need help with an error

After creating a new skill to test out a TP draining skill, my playtesting comes to a crashing halt thanks to some stupid error. At first I thought it was caused by using SRD's HUD Maker to customize my Battle HUD, so I disabled both plugins & tried again with the default layout (default for YEP Battle Core). I'm still getting the error:

Stupid error!.png
Don't know why the Skill Core needs to draw Actor HP but its apparently causing enough of a conniption fit to crash the game. Only does this with my new Absorb skill. God I wish this engine would stop sucking!
1. Do you have YEP Damage Core installed?
2. You say this happens after you execute a skill, show us that skill's damage formula
Is this an error that happens when you use new plugins on an old project?

What version of MV are you using? You can find that in Help About or somewhere like that, in the menu.
What version are your core files? You can find out by opening the project folder, going into the js subfolder, and opening the rpg_core.js file - the core file version should be on the first few lines. If there's no version shown there, it means you have 1.0.0
1. Do you have YEP Damage Core installed?
2. You say this happens after you execute a skill, show us that skill's damage formula
Yeah, I have Damage Core. Here's the skill's setup:
TP Drain Skill.png

Is this an error that happens when you use new plugins on an old project?

What version of MV are you using? You can find that in Help About or somewhere like that, in the menu.
What version are your core files? You can find out by opening the project folder, going into the js subfolder, and opening the rpg_core.js file - the core file version should be on the first few lines. If there's no version shown there, it means you have 1.0.0
There's hardly any 'new' plugins as I've been using this setup for a while now. I'm using Version 1.6.1 & the rpg core js file is version 1.6.1 as well.
even if there is no new plugin, can you still give us a screenshot of your plugin manager with all plugins listed?
Sometimes errors like this are caused by incompatible plugins or plugins that are in the wrong order - and sometimes such errors don't get triggered until a playthrough gets to a certain data combination that disturbs the plugins.

EDIT:
And please try adding an ;0 to your damage formula. The engine expects a return number to be processed as the result of any damage formula, only using javascript code without returns can cause problems, so force a zero as the last number of the damage formula.
Here's the list:
Plugin List.png
The MV code includes a safety check against "undefined" return values in the damage formula. I've described the technical details of the issue here, if you are curious.

To verify what I'm saying, use that exact same damage formula in a project without plugins and there will be no crash.

The reason I asked if you had YEP Damage Core installed is that plugin for some reason removes that safety check against undefined values, I would consider that a bug/oversight in the plugin.

Please follow the advice of Andar's edit, add a single statement "0;" to the end of the formula, and that will solve your issue.
Now I have not 1 but 2 errors! (It never ends!)
Stupid error!.png

Also, I deleted the damage formula afterward & it didn't crash with either of these 2 errors, so the damage formula is still flawed.
Code:
a.gainTp(50);b.gainTp(-50) 0;
Put the semi-colon before the zero, not after.
a.gainTp(50);b.gainTp(-50) 0;
that is the wrong code, @Aloe Guvner misspelled his advice.
Like I said above you should have added ;0 and not 0;

That is the cause for the first error - but it has nothing to do with the second one (as far as I know).
My guess is that the second one is something different that was masked by the original type error because the computer can only report errors to the point where they break the engine.
Yay! It finally works without crashing. Now if only I can regulate the TP drained to not take more than what the target has.
regulate the TP drained to not take more than what the target has.
Code:
r=b.tp;a.gainTP(r);b.gainTP(-r);0
will create a temporary variable r to store the current tp value of the target. you can then use it in any code inside the damage formula, even with an if to give two different formula depending on what value it has or whatever other code you want
Code:
r=b.tp;a.gainTP(r);b.gainTP(-r);0
will create a temporary variable r to store the current tp value of the target. you can then use it in any code inside the damage formula, even with an if to give two different formula depending on what value it has or whatever other code you want
So how would this work if I wanted to set it to take only x% but only up to whatever it has?
r=0.5*b.tp would be 50% of current TP for example
for comparison you'll need an if structure, but I don't have the correct syntax ready as I haven't done much with javascript.

something like
if r<50 then drain r else drain 50
If you want to take up to 30% of TP, but less if they have less, it would be this:

Code:
r = Math.min(b.tp, 30); a.gainTP(r); b.gainTP(-r); 0
mY hAtE fOr ThIs EnGiNe Is ReAl!
Another stupid error!.png
sorry.

a.gainTp and b.gainTp, not .gainTP
OK, it works finally! Sucks that the coding is case sensitive.

Original thread: https://forums.rpgmakerweb.com/threads/need-help-with-an-error.109328/