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.

Skill damage algorithm request

This is a request for a new script, an edit or debug of an existing script.

Script Title:
Arte Damage Algorithm

Detailed Description:
I want this script to be a skill-based script. If you have played the Tales games (i.e. Tales of Symphonia/Phantasia/Destiny/etc), then Tech or Artes or whatever are the names of abilities characters use in battle. Well, my aim is for each tech/arte to deal damage based off of a characters attack power or intelligence. For example:

Demon Fang = 1.4 * atk power
Sonic Thrust = 1.5 * attack power
Demonic Circle = 3.2 * attack power

and so on and so forth. I know how I want it done, but scripting is not my specialty. I want to use the ATK_F parameters in the skill editor to be the damage multiplier. So, say I want the 1.4x damage from Demon Fang, I would set ATK_F to 40. That make any sense? I've tried fiddling with the Battler 3 script in the SDK script, but I can't make it work properly. Basically, if an enemy's physical def is high, your damage is low, and so will be the damage of your tech, though it'll still be higher than a regular attack. I hope that makes sense. Of course, I want magic to work the same way, but with INT and MDEF.

Other Scripts I am using (in order):
SDK v. 2.4
Letter by Letter Message Window
Player: Swap Dead Actor
 
You shouldn't need to modify the scripts. Set the ATK-F for the Demon Fang skill to 140 instead of 40. (It's a %). You can adjust (lower) the PDEF-F & MDEF-F if you want a certain skill to do more damage.
 
You shouldn't need to modify the scripts. Set the ATK-F for the Demon Fang skill to 140 instead of 40. (It's a %). You can adjust (lower) the PDEF-F & MDEF-F if you want a certain skill to do more damage.
Setting the ATK-F to 140 will only make the skill do 140% damage against enemies with a Pdef score of 0 or 1. Against enemies with reasonable Pdef scores, that skill would do far more than 140% damage.

Anyway, back to the request. There's an annoying limit to ATK-F of 200, so making ATK-F an +% multiplier wouldn't allow you to create skills with a multiplier higher than 300%. However, we could make ATK-F increase the damage with a higher multiplier. All examples provided has a +% damage multiplier that is divisible by 10. So one could let each point of ATK-F mean a damage increase of +10% or +5% or whatever you desire.

There's also the question of how to identify the skills as physical now. By default, skills that have an ATK-F higher than 0 counts as physical. If you want spells to also have a damage multiplier, you need a new way to identify a skill as physical (STR-F maybe?).

Finally, I'm not entirely sure how you want damage to be calculated period. Can you give me a formula or a description? I get the feeling that what you want is not just one modification to the damage algorithm.
 
alright, let's try this...

Damage = force × multiplier ÷ 20 × elemental modifier × critical modifier × defense modifier (± variance %)

Force = Skill's force
+ (A's attack power × skill's attack power F ÷ 100)
- (B's physical defense × skill's physical defense F ÷ 200)
- (B's magic defense × skill's magic defense F ÷ 200)

Rate(multiplier) = 20
+ (A's strength × skill's strength F ÷ 100)
+ (A's dexterity × skill's dexterity F ÷ 100)
+ (A's agility × skill's agility F ÷ 100)
+ (A's intelligence × skill's intelligence F ÷ 100)

Set ATK-F to 140
Set STR-F, DEX-F, AGI-F, INT-F, PDEF-F, MDEF-F & Variance to 0
Set skills force (Power) to 0
No Element Attributes

Do the math, you end up with...

Damage = (A's attack power × 1.4) × critical modifier × defense modifier

Essentially what he asked for. No modifications to the battle formulas. And the problem with identifying physical from magical attacks only exists for these specific skills. (not really these either, since tech/arte are physical skills anyways.)

We could overcome the 200% limit programatically. But rather than modifying the battle formulas, we could load the custom values into the $data_skills structure at the start of the game.

I get the feeling you're trying to make this more difficult than it needs to be.??? :scruff:

Be Well
 
Basically, if an enemy's physical def is high, your damage is low, and so will be the damage of your tech, though it'll still be higher than a regular attack.
If you set PDEF-F to zero, this part of the request will not be fulfilled.

Of course, I want magic to work the same way, but with INT and MDEF.
While I'm not sure, I do think he want MDEF to subtract from INT just like PDEF subtracts from ATK. This cannot be done with the default formula.
 
How I love damage formula requests =D

I think this should work for you.
In Battler_3 replace everything from calculate power down to (and including) calculate base damage.
Code:
 

# Calculate physical power and magic power

      physical = user.atk

      magic    = user.int

      if physical > 0

        physical -= self.pdef * skill.pdef_f / 200

        physical = [physical, 0].max

      end

      if skill.power > 0

        magic -= self.mdef * skill.mdef_f / 200

        magic  = [magic, 0].max

      end

      # Multipliers

      multi_p = skill.atk_f

      multi_m = skill.power

      # Calculate "rate"

      rate   = 20

      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 basic damage

      self.damage = ((physical * multi_p/100) + (magic * multi_m/100)) * rate/20

 

also in the miss section [# if power is 0 section] add this to the IF statment
Code:
 

if skill.power == 0 [color=#FF0000]and skill.atk_f == 0[/color]

 

As you can probably see its just an edited and rearranged version of the original formula.
Physical Skill Damage = [ATK - PDEF] * "RATE" / 20 * MULTIPLIER P [plus element weakness and variance etc]
Magic Skill Damage = [INT - MDEF] * "RATE" / 20 * MULTIPLIER B [plus element weakness and variance etc]

the physical multiplier is controled by atk_f in the skill section of the data base
(ex: atk_f = 150 is 1.5x damage multiplier)
the magic multiplier is now controled by power in the skill section of the data base
(ex: power = 200 is 2x damage multiplier)

The rate part of the formula is the same as before, it determines which stats is being used as a multiplier.
I included it because there is a stat multiplier in the basic attack damage formula as well.
[note: for a physical skill if only str is used [str_f = 100] as the rate multiplier then the damage dealt should be the characters normal attack damage x the multiplier_p]

EDIT:
I just noticed that ATK_F only goes up to 200
you can fix this by doing what brewmeister suggested
or by changing the formula so that the physical multiplier is divided by 10 instead of 100.
This would make atk = 10 equal to the base damage and would make it so you could
only make multipliers to the tenths postion.
[ex: 1.5x, 3.2x, 0.5x, 20x, etc]
 

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