State effects in Damage Formula

Greetings RPGmaker creators,

I have been hard at work studying damage formulas recently inspired by Roninator2, seeing the potential they could have in the Combat Stealth system I have in the works. I applied this formula to the base attack formula

a.atk * 4 - b.def * 2; a.remove_state(13);

as anticipated it removed state 13, but it delivers no damage.

My question is:What am I doing wrong?
Probably :
Missed
Hit but has negative damage value
forgot to set HP Damage above the formula
Resisted
or anything script related (for me usually forgot to put :target_damage )
@Dragon Brother
the answer from @mashedcookie is wrong.

the eval of the damage formula means that the damage is the last number processed by the formula.
if the last command doesn't give a number, zero is assumed.


a.remove_state(13); a.atk * 4 - b.def * 2

will work
Andar, I just tested this and it functions.
Thank You for once again for the assistance, sir.
a.atk * 4 - b.def * 2; a.remove_state(13);
If I recall I put that damage formula into a variable, and specified that variable at the end.
That would have been the only difference.
It was because you were changing the damage result depending on a condition.
If the damage formula never changes then, yes what andar said, put it at the end.
Into a Variable, You say? I just tried that and it didn't work for Me;
that is because he wasn't talking about game variables but about ruby variables
Into a Variable
Do you remember
dam = a.atk * 4 - b.def * 2; if b.def <= 7; b.add_state(2); else dam = 0; end; dam

the word 'dam' is the variable here like Andar said. you could type out 'damage' but the formula window has a character limit. so depending on how complex the formula is you sometimes need to make short variables in the formula.
Using game variables can work, but you can't use formulas. so kind of useless.
Do you remember
Yes I have been adapting it ever since You showed that formula to Me.

I believe it is time for Me to look up 'Game Variables' any clue as to where to look for them in the system?

Original thread: https://forums.rpgmakerweb.com/threads/state-effects-in-damage-formula.146171/