Author Topic: [XP] Rewriting System of PDEF and/or MDEF?  (Read 1646 times)

Offline AJNR95

  • Awakened Visionist
  • **
  • Posts: 82
  • LV: 7
  • This User is Banned
    • View Profile
[XP] Rewriting System of PDEF and/or MDEF?
« on: February 09, 2012, 01:13:26 AM »
Sorry if I've posted in the wrong forum, I just have to pop in real quick because this is probably the only real active forum that is in the RMXP and RMVX Fields and I needed a question to ask out of curiosity and the fact that I have 0% Knowledge of making scripts by scratch.

All I would like to know is:

Can you rewrite the formula for how damage is received by both Player and Enemy?

If you can, are you able to rewrite a new script that has the value of PDEF and/or MDEF reduce the final value of the damage being dealt? Much like Dragon Age: Origin's "Armor" Statistic.

(click to show/hide)

I have no interest in changing how damage is generated in RMXP, it's satisfactory, but is there someway to achieve this type of armor system in the game? And a note is that I mainly use the Blizz-ABS, just to add so if anyone comes up with an idea, it'd be nice if it was compatible with the Active Battle System.
(click to show/hide)

by Blizz: Spoilered, because image is 2.6 MB.
by AJNR95: Unspoilered, because fuck you - ¡Viva la Revolución!
by Blizz: Spoilered again, and Banned.

Offline ForeverZer0

  • CP's Pedophile
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3255
  • LV: 298
  • Gender: Male
  • Remember you are unique, just like everyone else.
    • View Profile
Re: [XP] Rewriting System of PDEF and/or MDEF?
« Reply #1 on: February 09, 2012, 06:29:38 AM »
It is quite possible to change the way damage is calculated, specifically the "attack_effect" method in Game Battler 2.

Here is the default method:
(click to show/hide)

As you can see, its a bit more complicated than a simple PDEF vs. ATK formula, critical rates, elements, evasion, etc. are factored in as well. If you wanted to create an armor that would apply this effect only when equipped, you could do something like this:

(click to show/hide)

The question is, do you want elements and criticals to have an effect, or just make it a straight-forward simple formula?
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Offline AJNR95

  • Awakened Visionist
  • **
  • Posts: 82
  • LV: 7
  • This User is Banned
    • View Profile
Re: [XP] Rewriting System of PDEF and/or MDEF?
« Reply #2 on: February 09, 2012, 11:47:39 PM »
It is quite possible to change the way damage is calculated, specifically the "attack_effect" method in Game Battler 2.

I would've never guessed. I've been tinkering with Game_Battler 3's lines 42-97

The question is, do you want elements and criticals to have an effect, or just make it a straight-forward simple formula?

Criticals I've set to do x3 the normal damage so I guess that can be set to the side.

To tell you now, the parameters follow the curve of TESV: Skyrim. Being the Health and Stamina/Mana being at intervals
of 10 and the parameters having a much smaller amount. I assume that RMXP is comfortable with higher statistics versus
smaller statistics, sadly I use the smaller statistics system. But I've always seen the system being either of Attack and Armor
being too powerful or too weak, which is why I disagree with the damage formula.

Elemental Effects I would like to have in the game, if that isn't a problem.
(click to show/hide)
(click to show/hide)

As you can see, its a bit more complicated than a simple PDEF vs. ATK formula, critical rates, elements, evasion, etc. are factored in as well. If you wanted to create an armor that would apply this effect only when equipped, you could do something like this:

Well in general view, I would like to formula to be like:
Physical Attack: Damage + (Strength/3) - PDEF (Armor) = Final Value
Magical Attack: Spell Damage + (Intelligence/3) - MDEF (Ward) = Final Value

And if the Final Value is a negative value because the Armor/Ward is much higher than
the Attack, then the value should just be set to 1, I don't believe in "0 Damage".

Looking something like
Physical Damage
Code: [Select]
     # Calculate basic damage
      atk = [attacker.atk + attacker.str / 3, 0].max # Is there someway to make the attacker.atk not be effect by the dividing of 3?
      arm = [self.pdef]
      self.damage = atk - arm

It'd be a lot easier if the Enemy's Attack is the incoming attack increased by 33% of his Strength, this would make the Enemy
creation easier for me so that the player doesn't take too much damage from a higher level enemy but doesn't take no damage
from a lower level enemy. I hate the fact that most RPG games let enemies that are far ahead of you kill you quickly. Skyrim does
a great job of allowing the player to fight at any level and Dragon Age giving the Levels a tight system and prolonged battle duration.
And that it also makes a giant distinction between Clothing, Light Armor, and Heavy Armor, showing that Heavy is much useful for
absorbing damage, but reducing Evasion and Light Armor doing vice versa of Extra Evasion and less Damage Absorption.
I'm sorry if my reply was irrelevant or immature because I can't fully grasp the concept of this whole situation at the moment.
But please tell me what I do need to tell you, I'm really eager to get some help. Thank you Zer0.
« Last Edit: February 09, 2012, 11:50:18 PM by AJNR95 »
(click to show/hide)

by Blizz: Spoilered, because image is 2.6 MB.
by AJNR95: Unspoilered, because fuck you - ¡Viva la Revolución!
by Blizz: Spoilered again, and Banned.

Offline Aqua

  • Lexima Warrior
  • *******
  • Posts: 2554
  • LV: 118
  • Gender: Female
  • Quack!
    • View Profile
Re: [XP] Rewriting System of PDEF and/or MDEF?
« Reply #3 on: February 10, 2012, 05:32:43 AM »
Code: [Select]
    # Calculate basic damage
      atk = [attacker.atk + attacker.str / 3, 1].max # Is there someway to make the attacker.atk not be effect by the dividing of 3?
      arm = [self.pdef]
      self.damage = atk - arm

You want that 0 to be a 1, since you don't believe in "0 damage."
And RGSS follows PEMDAS, so only the attacker's strength is being divided by 3.


Oh... this is my 2500th post...

Offline ForeverZer0

  • CP's Pedophile
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3255
  • LV: 298
  • Gender: Male
  • Remember you are unique, just like everyone else.
    • View Profile
Re: [XP] Rewriting System of PDEF and/or MDEF?
« Reply #4 on: February 10, 2012, 06:14:03 AM »
Code: [Select]
# Calculate basic damage
atk = attacker.atk + (attacker.str / 3)
self.damage = [atk - self.pdef, 1].max
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Offline Aqua

  • Lexima Warrior
  • *******
  • Posts: 2554
  • LV: 118
  • Gender: Female
  • Quack!
    • View Profile
Re: [XP] Rewriting System of PDEF and/or MDEF?
« Reply #5 on: February 10, 2012, 04:15:39 PM »
Oops... totally wasn't paying attention... lol

Did you want the critical strike's 3x damage modifier to kick in before or after defense is applied?

Offline AJNR95

  • Awakened Visionist
  • **
  • Posts: 82
  • LV: 7
  • This User is Banned
    • View Profile
Re: [XP] Rewriting System of PDEF and/or MDEF?
« Reply #6 on: February 11, 2012, 06:57:48 AM »
Code: [Select]
# Calculate basic damage
atk = attacker.atk + (attacker.str / 3)
self.damage = [atk - self.pdef, 1].max

Thank You! I'm mad it was that easy

Oops... totally wasn't paying attention... lol

Did you want the critical strike's 3x damage modifier to kick in before or after defense is applied?

Before the effect. That was a point I would've never brought up, but now that you did, Before. :)

I think my MDEF system is good for now. Thank you all so much :D
(click to show/hide)

by Blizz: Spoilered, because image is 2.6 MB.
by AJNR95: Unspoilered, because fuck you - ¡Viva la Revolución!
by Blizz: Spoilered again, and Banned.