I presently find myself stuck trying to make a skill do a certain thing with the damage formula. Here's what I want it to do:
Target: Self
Lose 1-2 MP, Gain 1-2 TP
If you are at 0 MP, gain 4 TP
I decided to try making this happen via the damage formula and use of gain.Tp/Mp, but I also wanted that conditional second effect to happen at 0 MP: Here's the formula I concocted.
MP Damage, No Element
if (a.mp = 0) { a.gainTp(4); } else { a.gainTp(Math.randomInt(1)+1); Math.randomInt(1)+1; }
Alas, it doesn't seem to be working. What seems to happen when the skill is used is the primary effect of losing MP and gaining TP, but it always seems to be 1 MP lost and 1 TP gained. There's no variation like I wanted from the Math.randomInt component, and the secondary effect of gaining 4 TP at 0 MP just never happens.
I suspect my subpar knowledge on how JavaScript works is the source of my problems. I've already looked through a bunch of guides on here like Damage Formulas 101 to try and figure out how to make it work, but... If anyone more versed in these skills can enlighten me as to how to fix it, I would be most grateful.
Target: Self
Lose 1-2 MP, Gain 1-2 TP
If you are at 0 MP, gain 4 TP
I decided to try making this happen via the damage formula and use of gain.Tp/Mp, but I also wanted that conditional second effect to happen at 0 MP: Here's the formula I concocted.
MP Damage, No Element
if (a.mp = 0) { a.gainTp(4); } else { a.gainTp(Math.randomInt(1)+1); Math.randomInt(1)+1; }
Alas, it doesn't seem to be working. What seems to happen when the skill is used is the primary effect of losing MP and gaining TP, but it always seems to be 1 MP lost and 1 TP gained. There's no variation like I wanted from the Math.randomInt component, and the secondary effect of gaining 4 TP at 0 MP just never happens.
I suspect my subpar knowledge on how JavaScript works is the source of my problems. I've already looked through a bunch of guides on here like Damage Formulas 101 to try and figure out how to make it work, but... If anyone more versed in these skills can enlighten me as to how to fix it, I would be most grateful.