Skill Formula error

The game crashed when I tried to use a healing spell created as so
Code:
if isActor() 300 + (a.mat * v[44]); else 300 + (a.mat * 3) + a.hrg * a.mrg;
Does anybody know where I might have went wrong here?
Is this enabled to target enemies? Just curious as you are checking if either the user or the target is an actor.

As for the formula, you can try this alternative:

if (b.isActor()){300 + (a.mat * v[44])} else {300 + (a.mat * 3) + a.hrg * a.mrg}
Try this

Code:
a.isActor() === true ? (300 + (a.mat * v[44])) : (300 + (a.mat * 3) + a.hrg * a.mrg)
Code:
if a.isActor() === true 300 + (a.mat * v[44]); else 300 + (a.mat * 3) + a.hrg * a.mrg;
I tried this fix but it threw up the same error message Landazar.
It is meant to target one chosen ally Junane but enemies can also use the spell.
It worked like this
Code:
if (b.isActor()) 300 + (a.mat * v[44]); else 300 + (a.mat * 3) + a.hrg * a.mrg;
isn't b.isActor meant to check the target though? so I am guessing it would be the same to just put a.isActor within the brackets.
I thought you pasted it directly... without if ... It must looks like that:
Clipboard01.jpg

ps, a is for your party members in battle, b is for opponents...
ps, a is for your party members in battle, b is for opponents...
a stands for attacker and b for the defender so it would carry both ways.

I wasn't looking to find out what it looked like without if.
I noticed the mistake I made with your correction though.

Edit: I retried your method and it still threw up the error message.
Code:
if a.isActor() === true 300 + (a.mat * v[44]); else 300 + (a.mat * 3) + a.hrg * a.mrg;
It's just a syntax error, the conditional statement that is being evaluated needs to be enclosed with parenthesis. And a semi-colon isn't use to separate the 'if' from the 'else', curly braces are used for that.

You can find all of the information on how to construct these here, along with heaps of examples:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else
I know it normally does but in the damage formula, it works that way too.
https://www.rpgmakercentral.com/topic/36290-damage-formulas-101-mv-edition/
if (v[10] > 100) a.atk*4 - b.def*2; else a.atk*2 - b.def*2;
I had made the mistake by not having it enclosed in parenthesis though.
True. If you only have 1 statement under the 'if' and only 1 statement under the 'else', the curly braces are optional. That's helpful in the damage formula because it's easier to read (and the box is so small)
And a semi-colon isn't use to separate the 'if' from the 'else', curly braces are used for that.
In fairness, you only need the curly braces when the if/else statements are working with multiple lines.

Try this

Code:
a.isActor() === true ? (300 + (a.mat * v[44])) : (300 + (a.mat * 3) + a.hrg * a.mrg)
When checking whether something is true or false, you don't need the a.isActor() === true part since a.isActor() already returns true or false. a.isActor() === true is basically asking if (true === true).

---

All that aside, I think this is what the OP is looking for:

Code:
b.isActor() ? 300 + a.mat * v[44] : 300 + a.mat * 3 + a.hrg * a.mrg

Note that you don't put a semicolon at the end of a statement in the damage formula box when you want that statement's result to be used to calculate damage

Edit: Or replace b.isActor with a.isActor if it's supposed to check whether the caster is an actor rather than the target. I got the feeling it was mean to be based on the target though, so I changed the a to b.
Edit: Or replace b.isActor with a.isActor if it's supposed to check whether the caster is an actor rather than the target. I got the feeling it was mean to be based on the target though, so I changed the a to b.
It is meant to be based on the user of the spell. So a is what I was looking for.

All that aside, I think this is what the OP is looking for:
Code:
b.isActor() ? 300 + a.mat * v[44] : 300 + a.mat * 3 + a.hrg * a.mrg
I found and fixed the error with
Code:
if (a.isActor()) 500 + (a.mat * v[44]); else 500 + (a.mat * 3) + a.hrg * a.mrg
already.

Original thread: https://forums.rpgmakerweb.com/threads/skill-formula-error.103221/