MZ Help with damage Formulas

1) I have a state 'NulFire' that works exactly as it does in Final Fantasy X, where it negates one Fire-element ability used on the person with the state but I'm not 100% on the formula?

b.states().includes($dataStates[56]) ? 0 : Math.max((a.atk * 2.25) - b.def, 1);

'56' would be where it checks for the state but it doesn't seem to?


2) This one is supposed to deal more damage the lower the user's HP but doesn't seem to deal ANY damage?.

((b.hp.to_f / b.mhp) + 1).to_i * a.atk * 2.5 - b.def * 2, 1)
b.states().includes($dataStates[56]) ? 0 : Math.max((a.atk * 2.25) - b.def, 1);
you said its a state, but formulas are for skills. just to be sure, is that formula an example that you have in your fire skills or is it something else?

((b.hp.to_f / b.mhp) + 1).to_i * a.atk * 2.5 - b.def * 2, 1)
to_f and to_i is ruby, not javascript. using them is going to invalidate any term that involves them. also theres an extra closing parenthesis - which would be a separate error
you said its a state, but formulas are for skills. just to be sure, is that formula an example that you have in your fire skills or is it something else?


to_f and to_i is ruby, not javascript. using them is going to invalidate any term that involves them
I'm trying to create a skill that checks FOR the nulFire state '59' and if the target has it, it would deal 0 damage.

What would the formula look like in javascript then?

you said its a state, but formulas are for skills. just to be sure, is that formula an example that you have in your fire skills or is it something else?


to_f and to_i is ruby, not javascript. using them is going to invalidate any term that involves them. also theres an extra closing parenthesis - which would be a separate error

b.isStateAffected(61) ? (0) : Math.max((a.atk * 2.25) - b.def, 1)

does this work better?
I'm trying to create a skill that checks FOR the nulFire state '59' and if the target has it, it would deal 0 damage.
across 3 different posts, youve said 3 different state ids. So provided that you havent made any mistakes there...

b.isStateAffected(61) ? (0) : Math.max((a.atk * 2.25) - b.def, 1)
should just be identical in terms of functionality to what you had before assuming you arent using any plugins. if youve tried both, what exactly happened each time?

What would the formula look like in javascript then?
the reverse hp scaling one? fixing the syntax errors, itd be
Code:
(b.hpRate()+1) * a.atk * 2.5 - b.def * 2
but thats not addressing that the formula also wouldnt do what you said you wanted
deal more damage the lower the user's HP
you were not only looking at the target's hp, but the formula leads to more damage dealt the higher the target's hp% is.

you'd want something like...
Code:
(2-a.hpRate()) * a.atk * 2.5 - b.def * 2
As for the Nul Fire, I really think you're making it more complicated than it needs to be.

Just make a State called "Null Fire" and set the Element rate to 0% for your fire element.

For the Null Fire skill, just make sure it's adding the "Null Fire" state.

Now, to remove by a "Fire" only element spells/skills, just add Remove State, 'Null Fire" to each fire element spell.
As for the Nul Fire, I really think you're making it more complicated than it needs to be.

Just make a State called "Null Fire" and set the Element rate to 0% for your fire element.

For the Null Fire skill, just make sure it's adding the "Null Fire" state.

Now, to remove by a "Fire" only element spells/skills, just add Remove State, 'Null Fire" to each fire element spell.
this is so deceptively simple... idk if anyone's ever mentioned that before. lol
across 3 different posts, youve said 3 different state ids. So provided that you havent made any mistakes there...


should just be identical in terms of functionality to what you had before assuming you arent using any plugins. if youve tried both, what exactly happened each time?


the reverse hp scaling one? fixing the syntax errors, itd be
Code:
(b.hpRate()+1) * a.atk * 2.5 - b.def * 2
but thats not addressing that the formula also wouldnt do what you said you wanted

you were not only looking at the target's hp, but the formula leads to more damage dealt the higher the target's hp% is.

you'd want something like...
Code:
(2-a.hpRate()) * a.atk * 2.5 - b.def * 2
okay, I think I got it?

Math.max(2 - a.hpRate()) * a.atk * 2.5 - b.def, 1)

Would this be correct then, ensuring that no matter what the attack always does '1' damage, even if the enemy's defense is insanely high?

Original thread: https://forums.rpgmakerweb.com/threads/help-with-damage-formulas.182820/