Proper Damage Dealt Script Request

Hey there, I was wondering if there was a script for VX Ace that overrides the programs 0 damage against high defense?

Basically what I’m asking, is there a script that when an enemy or actor attacks another enemy or actor with a higher defense it will play out the skill formula and deal the proper damage rather than just doing 0 damage? I’ve seen posts about how you can set it to at least 1 damage, but I want the full damage to be dealt based off the formulas no matter how high the enemy or actor defense is. Like in Pokémon, you don’t just deal 0-1 damage because the other trainer’s Pokémon has a higher defense.

I hope my explanation of this request made sense.
You will need to clarify. Do you want a script that just makes 1 the minimum, but it does the formula first, and if that is 0, it sets it to 1? That is doable, and I think it already exists somewhere. However if you want no DEF affecting your damage that is up to you to set, you need to set the formula in your skills to not use DEF then, as no script can assist with that part.
I think that’s what I’m asking for, but I’ll try to elaborate just in case.

I want a script that when a damage inflicting skill is used against an enemy or actor that has high defense it doesn’t default and deal 0 damage. So yes I suppose having it be set to 1 as the minimum is what I am asking for. BUT if the damage is supposed to be 2 or 3 or 4 (etc.) I don’t want it to just default to 1, just as the program already defaults to 0, I want to make sure that it always deals some sort of damage based off whatever formula I am using.

An example I can think of is the default Attack skill that is with the program. Let’s say we’re using all the default program stuff. Level 1 actor Eric decides to attack the final boss Demon (King/Lord/God). The damage will default to 0, but what if it was actually supposed to be 2 damage? The programs default script will disregard the formula outcome because the defense of the enemy is too high.

Did that make more sense?
Or am I just dumb and not realizing how the formula works? I’m starting to think that’s the case haha, and if so, then I suppose I just need it to do a minimum of 1 damage. 😳
To me it sounds like something that you can do simply by using the default damage formula:
Code:
r = your_formula; r > 0 ? r : 1

This does not keep into account your attack element, if you need that as well, you should do something like this:
Code:
r = your_formula; r * b.element_rate(attack_element_id) > 0 ? r : 1
Nah, variance probably is going in the way. 20% variance of 1 would probably still nullify it to zero. I would say, something like this would work.
Code:
r = your_formula; r > 0 ? r : 2

@Heirukichi btw, you write b.element_rate wrong 😛
I’ll definitely try those out then! Thanks y’all!
@TheoAllen I swear, I hate touchscreen. Thank you for pointing out the mistake, I have now fixed it.
Or am I just dumb and not realizing how the formula works?
yes, because there never is a default. The damage dealt is always that what is the result of the mathematical formulae, and is only 0 if zero is the result of the mathematical operation.

Example:
Eric has an attack value of 50 and a crab has a defense value of 200.
The attack formula is 4*atk - 2*def or 4*50-2*200 or 200-400. This value is less than zero, so the attack deals zero damage.

There are some traits that affect damage as a multiplier, like element rates or physical damage rate, but that is always a multiplier to the number of damage. So if the result is zero then either the defense value was high enough in the formula or the damage element makes the enemy immune (0% damage)


But that is why you can set the formula in the skills - if you don't like to use this damage calculation you can replace it with another one.

and FYI: even the formula given above can result in 0 damage, because if the enemy has a damage reduction against the damage dealt (like -10% fire damage or -20% physical damage), then that reduction can reduce the result below 1 damage, rounded down to zero again. And while the second formula removes any elemental reduction there are still other reductions from other possible traits.

Original thread: https://forums.rpgmakerweb.com/threads/proper-damage-dealt-script-request.117227/