Formula with two different objectives

Hello, I have a problem with a skill formula, let's see if you can help me. I use rpg maker mv but it would really work for anyone. I am trying to make a skill that damages an enemy but at the same time adds a state to the fighter who uses the skill, that is, the skill performs two actions on different targets. I have set (a.mat + a.atk) * 5 - (b.def + b.mdf) * 2 && a.AddState(69)
but it does not work. Does anyone know how it would be written? Thanks
So a couple of things:
1. "&&" is used for conditional checks not for adding things together.
2. i believe you have to add the state first before the damage.
3. you were close, it's "addState" not "AddState".

I haven't tested this but here's my solution:
JavaScript:
a.addState(69); (a.mat + a.atk) * 5 - (b.def + b.mdf) * 2
I have set (a.mat + a.atk) * 5 - (b.def + b.mdf) * 2 && a.AddState(69)
two issues.

first, the last statement of the formula must have a numerical value. when you have the entire formula like than and then toss in && a.AddState(69) at the end, you turn the value from a number to something else. if youre going to do stuff like that in the formula box, you need to use a semicolon to split the statements so that the actual formula is the last part and all the other mechanics happen before it.

second, its a.addState, not a.AddState.

to make it work, you'd need to do
Code:
a.addState(69); (a.mat+a.atk)*5 - (b.def+b.mdf)*2

that being said, using the formula box to run functions that actually change things (like adding states to battlers) can result in the code being ran even when you dont intend on it.
as an example, If an actor with autobattle active has access to that skill, the formula has to be ran in order for the game to consider what action they should use per target. thatll cause the game to give them that state (multiple times even) far before they even choose the skill theyll use, even if thats not the skill theyll settle on using

EDIT: Ninja'd
works! thank you so much!!

Original thread: https://forums.rpgmakerweb.com/threads/formula-with-two-different-objectives.170823/