Hi, I'm a noob I'm terrible with formulas, could you please help me ?
I want an spelll that gives x dmg + y dmg if the target has a certain state, but not just one state. Like Y dmg for poison, α dmg for burning, ß dmg for blind and so on.
I saw someone somewhere using this formula: if b.isStateAfffeced(x) ? a.atk * 6 - b.def * 2 : a.atk * 4 - b.def
My noob question is how do I add more states to this formula ? Do I use a comma and repeat the formula or a "if" ? I have no idea.
I don't know how to do the short version of ifs but you can do the long and ugly version until someone more experienced show up :rswt2:. Something like this should work.
if (b.isStateAffected(x)) {damage formula for state x here} else if (b.isStateAffected(y)) {damage formula for state y here}
and so on until the last one where you use just 'else' instead of 'else if'.
How many states are you looking at?
I'm using parentheses to keep things organized - use state ids instead of descriptions:
(b.isStateAffected(poison) ? 10 : 0) + (b.isStateAffected(burning) ? 15 : 0) + (b.isStateAffected(blind) ? 20 : 0)
and just keep going until you go through all your states.
What is after the ? is what will be used if the state is present; what is after the : is what will be used if the state is not present.
The 10/15/20 is what will be added to the damage if those states are inflicted. 0 damage will be added if the state isn't inflicted. So if the target has all of those 3 states, the damage will be 45, and if they have none of them, the damage will be 0.
The MV damage formula box can hold a LOT of text, but I suggest if it's going to be long, you write it somewhere else and save it, because if you make a mistake, it's going to be hard to find!
the formula has a maximum length, so, depending on the amount of checks, you'll run out of space.
I suggest you make up a system of states that univocally negate one another, just so they will remove the need for checks on that formula, if not remove them from the formula completely.
EDIT:
would it be practical to send the value to a manager event and recieve the result?
I'm asking to expert MV users.
if one could send the value elsewhere, then it wouldn't matter how many checks there would be.