You might want to read through some of this - the replies here are presuming some basic understanding of how the damage formula works which you don't have.
Please note: A discussion has already been started about different things you can do with these formulas so please direct those comments and question to the appropriate thread. https://forums.rpgmakerweb.com/index.php?threads/rmmv-damage-formula-ideas-and-help.47099/ A link to the list of...
forums.rpgmakerweb.com
The key to the damage formula is
the last thing is the number of the damage dealt. So when
@Robro33 says that removeState() doesn't return a number, he means exactly that:
And if the value of your damage formula is
undefined, MV interprets that as 0 damage.
So you must put the removeState() in there
before the final number that represents the damage dealt.
However, note that if you use any auto-battle trait in your game, you shouldn't be doing that at all. You should put it into a Skill Core notetag, because the game evaluates your damage formulae when it's considering which skill to use. And if you put extra code in there, that code will be run whether you actually select that skill or not.
basic attack :
(a.atk * 2 - b.def) * (1 + a.getStateCounter(9)*.05|| 0)
I know you got this from
@Robro33, but he made a little mistake. OR has a higher operator precedence than multiplication, so that's going to evaluate as "0.5 || 0", which will always be 0.5, and not affect the value you get from getStateCounter().
It should be:
Code:
(a.atk * 2 - b.def) * (1 + a.getStateCounter(9) || 0 * 0.5)
and If I try to do :
(a.atk * 2 - b.def) * (1 + a.getStateCounter(9)*.05|| 0);a.removeState(9)
According to the thread and instructions I gave above, combined with the correction to the OR usage, that's:
Code:
a.removeState(9); (a.atk * 2 - b.def) * (1 + a.getStateCounter(9) || 0 * 0.5)
But, again, you may want to move the removeState() to a Skill Core notetag to ensure it works correctly.