Damage Formula help

Is this possible in the damage formula box?  If not, how do I accomplish this effect?

Formula for nearly all skills:

(User's Offensive parameter plus y) minus (target Defensive parameter plus w) = z
If z higher than target's Defensive Parameter multiplied by x, then inflict/remove state (ignoring state percentage chance).
Regardless, do damage/heal.  With some skills, inflict stun.

y = a random number between 0 and the user's level
x = a number that is specific to the skill.
w = the first actor's level

"Offensive parameter" can mean ATK, MAT, or LUK, depending on the skill

"Defensive parameter" can mean DEF, MDF, or AGL, depending on the skill.
Nearly all skills add or remove a state.

I understand that with this formula, enemies get stronger as the player gains levels.  They don't level up from grinding, they level up from completing quests.  They mainly get stronger through other means, like perks and talent ranks.

I'm using a script by Victor Sant to create traits that raise the effectiveness of elements for each skill using that element.  Damage represents effectiveness of skills, whether they're for DPS or for inflicting states.  All skills using the above formula deal damage and can inflict a state.  This is to prevent wasting a turn on a skill that MIGHT only inflict a state.
Try something like this (I'll use OFF for the offensive parameter - ATK, MAT, LUK, and DEF for the defensive parameter - DEF, MDF, AGL)

b.add_state(id) if (a.OFF + y) - (b.DEF + w) > (b.def * x); b.add_state(stun_id); <damage_calc>where you can do b.add_state or b.remove_state with the state's id
b.add_state(stun_id) had the id for the stun skill, and this section is optional - only use for those skills that you want to add the stun state;


<damage_calc> is replaced with the normal formula to calculate damage


This might end up with the states applied/removed, even if damage ends up being 0.


I'm only assuming Victor's scripts don't alter the way damage is calculated.
I'm only assuming Victor's scripts don't alter the way damage is calculated.
So am I, haha.  What's the code for w, x, and y?
oh, sorry - I didn't read the rest of that.


For y, put

Code:
Math.rand(a.level) + 1
For w, do you mean Actor 1, or do you mean the leader? It will be one of these:
Code:
$game_party.leader.level
Code:
$game_actors[1].level
The value for x will be something you'll have to work out, as all you've said is it's "a number that's specific to the skill". All that tells me is that each skill will probably have a different number here, but gives me no information as to what that number actually is.
The value for x will be something you'll have to work out, as all you've said is it's "a number that's specific to the skill". All that tells me is that each skill will probably have a different number here, but gives me no information as to what that number actually is.
Er... yes.

Anyway, thanks for the help, I'll be testing this formula extensively.
Well, if you can tell me what "x = a number that is specific to the skill" means, then I can give you the formula 🙂 Is it the skill id? Is it calculated on the skill id? Is it some parameter on the skill? Is it something you want to put into the note box on the skill? See what I mean?
Oh, it's just going to be an integer unique to the skill.  I also made a mistake with my request, in that x and y should be switched.  I can do that myself, though.

Also, for state IDs, do I include parentheses?
Yes, because you're passing an argument to a method or function.

Original thread: https://forums.rpgmakerweb.com/threads/damage-formula-help.20309/