Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Do magic skills operate under a different damage formula?

Sooth

Sponsor

I've been wrestling with balancing skill damages in my game for a while; I reached the point where physical attack skills made sense to me, only to find that things seem to work differently for skills that *don't* use attack power.

When I tested a spell with a power of 1, 100% Int-F, 0% Magic Defense-F, against an enemy with resistance C, I found that the spell would often do... maybe, at most, 3-5 damage, possibly none at all, despite the user's Intelligence being 70 or higher. Should not the spell be doing 70 or so damage, plus-minus variance?

The attack damage formula seems to make sense; a skill with 100% attack-F seems to add 100% of the user's attack. But damage seems drastically reduced than what it should be for skills that rely on a stat for damage. I've tried looking through the scripts myriad times to figure out why this is, as well as the help file and websites such as this which purport to list the calculations. I also tried making a new game with a "Blank slate" on changed scripts, and running a similar experiment, to find very similar results: changing the default 'Fire' skill to 1 power and 0% Magic-Defense-F, it would only do about 4 damage to a basilisk with 100% elemental effect.

Changing the power back to 140 causes the skill's damage to jump to 900-ish; I was under the impression power was meant to be *added* to damage? Is this not the case with: power = skill.power + user.atk * skill.atk_f / 100 ... ?

Am I vastly misunderstanding the damage formulas used by RMXP? Is this true for anyone else?

Thanks,
- Kriss

(In my personal game, the only change I've made to the skill damage script in Game_Battler3 was on lines 130-131, changing the / 200 to / 100, so damage would no longer be half of the differences).
 
The reason it's not doing much is because you're setting power so low. If Int-F 100% is used you get (power * (1 + Int/20)), so 70 Int is power * 4.5, the reason you got 4 I'm guessing. Basically power is added to damage when using attack, then the result whether you have Atk-F or not is multiplied by the other stat-Fs.
 

Sooth

Sponsor

That makes sense, thank you.

I would like to make the damages easy and concisely predictable for all skills. If I could just have a stat add itself to damage when its set to 100%, without being divided by 20 or multiplied by a thousand, that would be fantastic. I went into the script editor and set rate to 1 and removed the /20, and magic skills work fine now...

... but now skills that use attack power and another stat, like Might, do hundreds or thousands more damage than they should. Is this because the bonus damage from a stat is being multiplied by attack power, or something? Is it easy to rewrite a few things to make these skills "streamlined", so to speak, and how would I go about doing that?
 

Sooth

Sponsor

I fiddled with it some more and came up with this:

Moved rate so it'd be calculated before power, and moved the user.atk bit so it's part of rate now. My intention is so that no matter what the skill, physical or magical, if a stat has 100% effect, *exactly* 100% of that stat is added to the damage, plus power, with no additional division or multiplications (except for things like elements, etc).

Does this look like it does the job and won't cause problems later on?

# Calculate rate
rate = 1
rate += user.atk * (skill.atk_f / 100)
rate += (user.str * skill.str_f / 100)
rate += (user.dex * skill.dex_f / 100)
rate += (user.agi * skill.agi_f / 100)
rate += (user.int * skill.int_f / 100)
# Calculate power
power = skill.power + rate
if power > 0
power -= self.pdef * skill.pdef_f / 100
power -= self.mdef * skill.mdef_f / 100
power = [power, 0].max
end
# Calculate basic damage
self.damage = power
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top