Variables in Damage formula

Hi

I got the actual 2 Damage formula for my skills:
Physical DamageFormula
((a.atk*a.atk)/b.def)*v[1]

Magical DamageFormula:
((a.mat*a.mat)/b.mdf)*v[1]

With:
a.atk = User.Attack
b.def = Target.Defense
a.mat= User.MagicalAttack
b.mdf = Target.MagicalDefense
v[1] = Skill's Modifier

For exemple, on the following skill:
Capture d’écran 2025-01-12 153122.png

with on note:
Code:
<target>
Change variable 1 = 1
wait: 110
action animation
action effect

wait: 10
action animation
action effect

wait: 10
action animation
action effect

wait: 10
action animation
action effect

wait: 10
action animation
action effect

wait: 10
action animation
action effect

wait: 10
action animation
action effect

wait: 10
action animation
action effect

wait: 10
action animation
action effect

wait: 10
Change variable 1 = 3
action animation
action effect
</target>



But i want to create some skills who're ignoring a percent of Target's Def (or target's mdf), and somes "hybride" skills (with a damage formula based on Atk & Mat) a percent of Target's Def & a percent of Target's Mat


Then
Is this possible to add mutiples Variables in a same Damage formula ?

like:
((a.atk*a.atk)/((b.def)-((v[2]/100)*b.def)))*v[1]
in a more readable way:
Capture d’écran 2025-01-12 154321.png

with:
v[1] = Skill's Modifier
v[2] = IgnoreDef Percentage


And/Or (for hybride skills):
((((a.atk*a.atk)/(b.def-((v[2]/100)*b.def)))+((a.mat*a.mat)/(b.mdf-((v[3]/100)b.mdf))))/2)*v[1]
in a more readable way:
Capture d’écran 2025-01-12 160606.png


with:
v[1] = Skill's Modifier
v[2] = IgnoreDef Percentage
v[3] = IgnoreMdf Percentage
Is this possible to add mutiples Variables in a same Damage formula ?
yes. you just use the extra variables in the formula. your formula is entirely defined as how you set it it. it can contain anything as long as youre working with numbers.

((a.atk*a.atk)/((b.def)-((v[2]/100)*b.def)))*v[1]
((((a.atk*a.atk)/(b.def-((v[2]/100)*b.def)))+((a.mat*a.mat)/(b.mdf-((v[3]/100)b.mdf))))/2)*v[1]
as long as you dont have any syntax errors in there and youve set the variables' values before the damage is calculated like you already are within the action sequence, it should be fine. have you tried them and encountered an issue?
I don't know anything about coding at all, and as I'm afraid of breaking everything in my game, so I play it safe, I prefer to ask questions in order to learn by myself (my grandmother said "there are no stupid questions), rather than directly testing random things and then asking for help to find out why everything is broken.
rather than directly testing random things and then asking for help to find out why everything is broken.
The thing is - the medium is very friendly towards experimentation. Theres no consequence for getting something wrong other than the time spent in the attempt. Its not like you spend a quarter to start a battle test and lose another if an error happens.
Im not saying to never ask for help, but oftentimes trying stuff gets you a faster answer than asking about it. Especially when there is little time required to set up the test.

You already wrote out a usable formula for the thread that could be copy-pasted into a skill. Testing it at that point would just take a few seconds to load up a playtest and use the skill as opposed to asking about it here and waiting for a response to something you might have already unknowingly gotten correct.

I don't know anything about coding at all, and as I'm afraid of breaking everything in my game, so I play it safe
Testing a formula wouldnt put your game at risk of breaking. You'd just make a new skill in the database with the new formula or change the formula of an existing one and try it out. The absolute worst thing that could happen for testing a skill is that the playtest crashes and youll know something is wrong. Your database wont explode and need reconstructing or anything

Original thread: https://forums.rpgmakerweb.com/threads/variables-in-damage-formula.174638/