Need help with an error

Animebryan

Need more resources!
Veteran
Joined
Jul 31, 2012
Messages
444
Reaction score
225
First Language
English
Primarily Uses
RMMZ
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!
 
Last edited:

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,115
First Language
English
Primarily Uses
RMMV
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
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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
 

Animebryan

Need more resources!
Veteran
Joined
Jul 31, 2012
Messages
444
Reaction score
225
First Language
English
Primarily Uses
RMMZ
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.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
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.
 

Animebryan

Need more resources!
Veteran
Joined
Jul 31, 2012
Messages
444
Reaction score
225
First Language
English
Primarily Uses
RMMZ
Here's the list:
Plugin List.png
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,115
First Language
English
Primarily Uses
RMMV
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.
 

Animebryan

Need more resources!
Veteran
Joined
Jul 31, 2012
Messages
444
Reaction score
225
First Language
English
Primarily Uses
RMMZ
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;
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
Put the semi-colon before the zero, not after.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
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.
 

Animebryan

Need more resources!
Veteran
Joined
Jul 31, 2012
Messages
444
Reaction score
225
First Language
English
Primarily Uses
RMMZ
Yay! It finally works without crashing. Now if only I can regulate the TP drained to not take more than what the target has.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
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
 

Animebryan

Need more resources!
Veteran
Joined
Jul 31, 2012
Messages
444
Reaction score
225
First Language
English
Primarily Uses
RMMZ
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?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
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
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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
 

Animebryan

Need more resources!
Veteran
Joined
Jul 31, 2012
Messages
444
Reaction score
225
First Language
English
Primarily Uses
RMMZ
mY hAtE fOr ThIs EnGiNe Is ReAl!
Another stupid error!.png
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
sorry.

a.gainTp and b.gainTp, not .gainTP
 

Animebryan

Need more resources!
Veteran
Joined
Jul 31, 2012
Messages
444
Reaction score
225
First Language
English
Primarily Uses
RMMZ
OK, it works finally! Sucks that the coding is case sensitive.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,049
Members
137,569
Latest member
Shtelsky
Top